illumos-lx: Fix test so it works under virtualization
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 23 Jun 2022 13:38:55 +0000 (14:38 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 23 Jun 2022 13:44:00 +0000 (14:44 +0100)
Tests need to provide dummy sbin/virt-what-cpuid-helper, dmidecode and
uname.  This ensures that if we are running the test suite under (eg)
KVM, that virt-what doesn't discover this.

The failure was:

./test.sh: test failed because output did not match expected
Expected output was:
----------------------------------------
illumos-lx
----------------------------------------
But the actual output of the program was:
----------------------------------------
illumos-lx
kvm
----------------------------------------

Fixes: commit 763cf1b1123136751b71f475610c5ac1eeaba0ad

tests/illumos-lx/Makefile.am
tests/illumos-lx/sbin/dmidecode [new file with mode: 0755]
tests/illumos-lx/sbin/uname [new file with mode: 0755]
tests/illumos-lx/sbin/virt-what-cpuid-helper [new file with mode: 0755]

index b7f942a..88c4179 100644 (file)
@@ -22,4 +22,7 @@ TESTS = test.sh
 EXTRA_DIST = \
        test.sh \
        proc/1/environ \
-       proc/version
+       proc/version \
+       sbin/dmidecode \
+       sbin/uname \
+       sbin/virt-what-cpuid-helper
diff --git a/tests/illumos-lx/sbin/dmidecode b/tests/illumos-lx/sbin/dmidecode
new file mode 100755 (executable)
index 0000000..d9992ad
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh -
+cat <<'EOF'
+# dmidecode 2.11
+/dev/mem: Operation not permitted
+EOF
+exit 1
diff --git a/tests/illumos-lx/sbin/uname b/tests/illumos-lx/sbin/uname
new file mode 100755 (executable)
index 0000000..ab0ec89
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo x86_64
diff --git a/tests/illumos-lx/sbin/virt-what-cpuid-helper b/tests/illumos-lx/sbin/virt-what-cpuid-helper
new file mode 100755 (executable)
index 0000000..ad82504
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo @