# 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 = \
*~ \
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:
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
--- /dev/null
+# 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
# 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 "$@"
# 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)"
# 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)"
# 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)"
# 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)"
# 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)"