Move the tests into a subdirectory
authorRichard W.M. Jones <rjones@redhat.com>
Fri, 1 Sep 2023 12:42:37 +0000 (13:42 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Fri, 1 Sep 2023 13:17:26 +0000 (14:17 +0100)
Makefile.am
configure.ac
tests/Makefile.am [new file with mode: 0644]
tests/run-qemu-sanity-check [moved from run-qemu-sanity-check with 94% similarity]
tests/sleeper [moved from sleeper with 100% similarity]
tests/test-bad-kernel [moved from test-bad-kernel with 94% similarity]
tests/test-bad-options [moved from test-bad-options with 91% similarity]
tests/test-bad-qemu [moved from test-bad-qemu with 95% similarity]
tests/test-bad-userspace [moved from test-bad-userspace with 96% similarity]
tests/test-timeout [moved from test-timeout with 93% similarity]

index 5f22f79..657b6dc 100644 (file)
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
+SUBDIRS = . tests
+
 EXTRA_DIST = \
        .gitignore \
        qemu-sanity-check.1 \
        qemu-sanity-check.in \
        qemu-sanity-check.pod \
-       qemu-sanity-check.pod.in \
-       sleeper \
-       $(TESTS)
+       qemu-sanity-check.pod.in
 
 CLEANFILES = \
        *~ \
@@ -61,15 +61,6 @@ qemu-sanity-check.1: qemu-sanity-check.pod
 
 endif
 
-# Tests.
-TESTS = \
-       run-qemu-sanity-check \
-       test-timeout \
-       test-bad-options \
-       test-bad-kernel \
-       test-bad-qemu \
-       test-bad-userspace
-
 # Tag HEAD with current version (maintainer only).
 
 maintainer-tag:
index 06b21f6..432c63e 100644 (file)
@@ -71,6 +71,6 @@ AM_CONDITIONAL([HAVE_POD2MAN], [test "x$POD2MAN" != "xno"])
 dnl Produce output files.
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_FILES([qemu-sanity-check],[chmod 0555 qemu-sanity-check])
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile tests/Makefile])
 
 AC_OUTPUT
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644 (file)
index 0000000..7185f14
--- /dev/null
@@ -0,0 +1,33 @@
+# Makefile for qemu-sanity-check
+# Copyright (C) 2013 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+EXTRA_DIST = \
+       sleeper \
+       $(TESTS)
+
+CLEANFILES = \
+       *~
+
+TESTS_ENVIRONMENT = PATH=$(abs_top_builddir):$(PATH)
+
+TESTS = \
+       run-qemu-sanity-check \
+       test-timeout \
+       test-bad-options \
+       test-bad-kernel \
+       test-bad-qemu \
+       test-bad-userspace
similarity index 94%
rename from run-qemu-sanity-check
rename to tests/run-qemu-sanity-check
index 79745e5..ec015af 100755 (executable)
@@ -17,4 +17,4 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-./qemu-sanity-check -v --initrd=./initrd "$@"
+qemu-sanity-check -v --initrd=../initrd "$@"
similarity index 100%
rename from sleeper
rename to tests/sleeper
similarity index 94%
rename from test-bad-kernel
rename to tests/test-bad-kernel
index 78756f4..09d2f97 100755 (executable)
@@ -17,7 +17,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-./run-qemu-sanity-check --kernel=/dev/null
+$srcdir/run-qemu-sanity-check --kernel=/dev/null
 r=$?
 if [ $r -ne 1 ]; then
     echo "$0: unexpected exit code $r (expecting 1)"
similarity index 91%
rename from test-bad-options
rename to tests/test-bad-options
index 4783158..bbe9a65 100755 (executable)
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-./qemu-sanity-check --foobar
+qemu-sanity-check --foobar
 r=$?
 if [ $r -ne 2 ]; then
     echo "$0: bad argument: unexpected exit code $r (expecting 2)"
     exit 1
 fi
 
-./qemu-sanity-check --kernel=/nosuchfile
+qemu-sanity-check --kernel=/nosuchfile
 r=$?
 if [ $r -ne 2 ]; then
     echo "$0: missing kernel: unexpected exit code $r (expecting 2)"
     exit 1
 fi
 
-./qemu-sanity-check --initrd=/nosuchfile
+qemu-sanity-check --initrd=/nosuchfile
 r=$?
 if [ $r -ne 2 ]; then
     echo "$0: missing initrd: unexpected exit code $r (expecting 2)"
similarity index 95%
rename from test-bad-qemu
rename to tests/test-bad-qemu
index a2404b9..6d80ad4 100755 (executable)
@@ -20,7 +20,7 @@
 # Choose a fake qemu which won't immediately fail, but also won't work
 # properly when it's run for real.
 
-./run-qemu-sanity-check --qemu=true
+$srcdir/run-qemu-sanity-check --qemu=true
 r=$?
 if [ $r -ne 1 ]; then
     echo "$0: unexpected exit code $r (expecting 1)"
similarity index 96%
rename from test-bad-userspace
rename to tests/test-bad-userspace
index 7543679..ab46046 100755 (executable)
@@ -19,7 +19,7 @@
 
 # Test what happens if the userspace (ie. initrd) is bad.
 
-./qemu-sanity-check --initrd=/dev/null
+qemu-sanity-check --initrd=/dev/null
 r=$?
 if [ $r -ne 1 ]; then
     echo "$0: unexpected exit code $r (expecting 1)"
similarity index 93%
rename from test-timeout
rename to tests/test-timeout
index fd2b5ca..704b0f1 100755 (executable)
@@ -19,7 +19,7 @@
 
 # Check the --timeout option is functional.
 
-./run-qemu-sanity-check --timeout=10 --qemu=./sleeper
+$srcdir/run-qemu-sanity-check --timeout=10 --qemu=./sleeper
 r=$?
 if [ $r -ne 1 ]; then
     echo "$0: unexpected exit code $r (expecting 1)"