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 {
584584 .native => try argv.append(exe_path),
585585 .unavailable => return, // No executor available; pass test.
586586
587 .qemu => |qemu_bin_name| {
588 if (enable_qemu) qemu: {
589 // TODO Ability for test cases to specify whether to link libc.
590 const need_cross_glibc = false; // target.isGnuLibC() and self.is_linking_libc;
591 const glibc_dir_arg = if (need_cross_glibc)
592 glibc_multi_install_dir orelse break :qemu
593 else
594 null;
595 try argv.append(qemu_bin_name);
596 if (glibc_dir_arg) |dir| {
597 const linux_triple = try target.linuxTriple(arena);
598 const full_dir = try std.fs.path.join(arena, &[_][]const u8{
599 dir,
600 linux_triple,
601 });
602
603 try argv.append("-L");
604 try argv.append(full_dir);
605 }
606 try argv.append(exe_path);
587 .qemu => |qemu_bin_name| if (enable_qemu) {
588 // 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 glibc_dir_arg = if (need_cross_glibc)
591 glibc_multi_install_dir orelse return // glibc dir not available; pass test
592 else
593 null;
594 try argv.append(qemu_bin_name);
595 if (glibc_dir_arg) |dir| {
596 const linux_triple = try target.linuxTriple(arena);
597 const full_dir = try std.fs.path.join(arena, &[_][]const u8{
598 dir,
599 linux_triple,
600 });
601
602 try argv.append("-L");
603 try argv.append(full_dir);
607604 }
605 try argv.append(exe_path);
606 } else {
608607 return; // QEMU not available; pass test.
609608 },
610609
......@@ -628,7 +627,7 @@ pub const TestContext = struct {
628627
629628 break :x try std.ChildProcess.exec(.{
630629 .allocator = allocator,
631 .argv = &[_][]const u8{exe_path},
630 .argv = argv.items,
632631 .cwd_dir = tmp.dir,
633632 });
634633 };