test-many-klibcs: Make sure shell runs external commands with local QEMU
Due to bugs in QEMU user-mode emulation, I want to be able to run all
klibc tests with a locally built QEMU in a chroot or container, and
not whatever version the host may have registered with binfmt_misc.
Currently run_built explicitly invokes QEMU, but the shell test
invoking an external command does not. Fix that.
diff --git a/test-many-klibcs b/test-many-klibcs
index 3f33e0b..827bc66 100755
--- a/test-many-klibcs
+++ b/test-many-klibcs
@@ -65,18 +65,21 @@
rm -rf "build/$tools-$toolsarch"
}
-run_built() {
+qemu_prefix() {
# XXX We assume build architecture is x86_64
case "$arch" in
i386 | x86_64)
- "$@"
;;
*)
- "qemu-$qemuarch-static" -- "$@"
+ echo "qemu-$qemuarch-static --"
;;
esac
}
+run_built() {
+ $(qemu_prefix) "$@"
+}
+
patch_interp() {
# Patching in a longer interpreter name can break things, so
# use a short-ish relative filename
@@ -180,12 +183,12 @@
run_tests_flavour static || err=1
run_shell_static "exit" || err=1
- run_shell_static "build/$tools-$toolsarch/usr/utils/static/true; exit" || err=1
+ run_shell_static "$(qemu_prefix) build/$tools-$toolsarch/usr/utils/static/true; exit" || err=1
run_tests_flavour shared || err=1
run_shell_shared "exit" || err=1
patch_interp "build/$tools-$toolsarch/usr/utils/shared/true"
- run_shell_shared "build/$tools-$toolsarch/usr/utils/shared/true; exit" || err=1
+ run_shell_shared "$(qemu_prefix) build/$tools-$toolsarch/usr/utils/shared/true; exit" || err=1
return $err
}