self-hosted: first passing test

* introduce std.atomic.Int
 * add src-self-hosted/test.zig which is tested by the main test suite
   - it fully utilizes the multithreaded async/await event loop so the
     tests should Go Fast
 * `stage2/bin/zig build-obj test.zig` is able to spit out an error if 2 exported
   functions collide
 * ability for `zig test` to accept `--object` and `--assembly`
   arguments
 * std.build: TestStep supports addLibPath and addObjectFile
This commit is contained in:
Andrew Kelley
2018-07-10 20:18:43 -04:00
parent 8fba0a6ae8
commit 574e31f0a0
11 changed files with 432 additions and 107 deletions

View File

@@ -891,15 +891,19 @@ int main(int argc, char **argv) {
add_package(g, cur_pkg, g->root_package);
if (cmd == CmdBuild || cmd == CmdRun) {
codegen_set_emit_file_type(g, emit_file_type);
if (cmd == CmdBuild || cmd == CmdRun || cmd == CmdTest) {
for (size_t i = 0; i < objects.length; i += 1) {
codegen_add_object(g, buf_create_from_str(objects.at(i)));
}
for (size_t i = 0; i < asm_files.length; i += 1) {
codegen_add_assembly(g, buf_create_from_str(asm_files.at(i)));
}
}
if (cmd == CmdBuild || cmd == CmdRun) {
codegen_set_emit_file_type(g, emit_file_type);
codegen_build(g);
codegen_link(g, out_file);
if (timing_info)