From d61a9e37ae8f140407d1369500d21efbe2b198ab Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 4 Aug 2020 15:39:59 -0700 Subject: [PATCH] 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. --- src-self-hosted/test.zig | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src-self-hosted/test.zig b/src-self-hosted/test.zig index e075de23bb..6f21b2f49c 100644 --- a/src-self-hosted/test.zig +++ b/src-self-hosted/test.zig @@ -584,27 +584,26 @@ pub const TestContext = struct { .native => try argv.append(exe_path), .unavailable => return, // No executor available; pass test. - .qemu => |qemu_bin_name| { - if (enable_qemu) qemu: { - // TODO Ability for test cases to specify whether to link libc. - const need_cross_glibc = false; // target.isGnuLibC() and self.is_linking_libc; - const glibc_dir_arg = if (need_cross_glibc) - glibc_multi_install_dir orelse break :qemu - else - null; - try argv.append(qemu_bin_name); - if (glibc_dir_arg) |dir| { - const linux_triple = try target.linuxTriple(arena); - const full_dir = try std.fs.path.join(arena, &[_][]const u8{ - dir, - linux_triple, - }); + .qemu => |qemu_bin_name| if (enable_qemu) { + // TODO Ability for test cases to specify whether to link libc. + const need_cross_glibc = false; // target.isGnuLibC() and self.is_linking_libc; + const glibc_dir_arg = if (need_cross_glibc) + glibc_multi_install_dir orelse return // glibc dir not available; pass test + else + null; + try argv.append(qemu_bin_name); + if (glibc_dir_arg) |dir| { + const linux_triple = try target.linuxTriple(arena); + const full_dir = try std.fs.path.join(arena, &[_][]const u8{ + dir, + linux_triple, + }); - try argv.append("-L"); - try argv.append(full_dir); - } - try argv.append(exe_path); + try argv.append("-L"); + try argv.append(full_dir); } + try argv.append(exe_path); + } else { return; // QEMU not available; pass test. }, @@ -628,7 +627,7 @@ pub const TestContext = struct { break :x try std.ChildProcess.exec(.{ .allocator = allocator, - .argv = &[_][]const u8{exe_path}, + .argv = argv.items, .cwd_dir = tmp.dir, }); };