authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-04 15:39:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-04 15:39:59-07:00
logd61a9e37ae8f140407d1369500d21efbe2b198ab
tree186712048ce25e1fc0710dd876afbf5b7943cdb3
parente4eb4396c27010d8d07b6fc73e7c7557170f06ad

stage2 tests: fix qemu logic

I made two mistakes in the previous commit; it was not actually using the argv that we built, and also the qemu logic was unconditionally skipping the test. Now I have verified that when mangling the RISC-V "hello world" test and then using -Denable-qemu, we get a test failure.

1 files changed, 20 insertions(+), 21 deletions(-)

src-self-hosted/test.zig+20-21
...@@ -584,27 +584,26 @@ pub const TestContext = struct {...@@ -584,27 +584,26 @@ pub const TestContext = struct {
584 .native => try argv.append(exe_path),584 .native => try argv.append(exe_path),
585 .unavailable => return, // No executor available; pass test.585 .unavailable => return, // No executor available; pass test.
586586
587 .qemu => |qemu_bin_name| {587 .qemu => |qemu_bin_name| if (enable_qemu) {
588 if (enable_qemu) qemu: {588 // TODO Ability for test cases to specify whether to link libc.
589 // TODO Ability for test cases to specify whether to link libc.589 const need_cross_glibc = false; // target.isGnuLibC() and self.is_linking_libc;
590 const need_cross_glibc = false; // target.isGnuLibC() and self.is_linking_libc;590 const glibc_dir_arg = if (need_cross_glibc)
591 const glibc_dir_arg = if (need_cross_glibc)591 glibc_multi_install_dir orelse return // glibc dir not available; pass test
592 glibc_multi_install_dir orelse break :qemu592 else
593 else593 null;
594 null;594 try argv.append(qemu_bin_name);
595 try argv.append(qemu_bin_name);595 if (glibc_dir_arg) |dir| {
596 if (glibc_dir_arg) |dir| {596 const linux_triple = try target.linuxTriple(arena);
597 const linux_triple = try target.linuxTriple(arena);597 const full_dir = try std.fs.path.join(arena, &[_][]const u8{
598 const full_dir = try std.fs.path.join(arena, &[_][]const u8{598 dir,
599 dir,599 linux_triple,
600 linux_triple,600 });
601 });601
602602 try argv.append("-L");
603 try argv.append("-L");603 try argv.append(full_dir);
604 try argv.append(full_dir);
605 }
606 try argv.append(exe_path);
607 }604 }
605 try argv.append(exe_path);
606 } else {
608 return; // QEMU not available; pass test.607 return; // QEMU not available; pass test.
609 },608 },
610609
...@@ -628,7 +627,7 @@ pub const TestContext = struct {...@@ -628,7 +627,7 @@ pub const TestContext = struct {
628627
629 break :x try std.ChildProcess.exec(.{628 break :x try std.ChildProcess.exec(.{
630 .allocator = allocator,629 .allocator = allocator,
631 .argv = &[_][]const u8{exe_path},630 .argv = argv.items,
632 .cwd_dir = tmp.dir,631 .cwd_dir = tmp.dir,
633 });632 });
634 };633 };