From 9f12880096ac745f1f00e35935217c1a30d05605 Mon Sep 17 00:00:00 2001 From: illiliti Date: Thu, 5 Aug 2021 09:03:47 +0300 Subject: [PATCH] test/*: rewrite check.sh in Makefile --- Makefile | 4 +++- test/Makefile | 16 ++++++++++++++++ test/check.sh | 53 --------------------------------------------------- 3 files changed, 19 insertions(+), 54 deletions(-) create mode 100644 test/Makefile delete mode 100755 test/check.sh diff --git a/Makefile b/Makefile index f940a4f..8786b46 100644 --- a/Makefile +++ b/Makefile @@ -18,4 +18,6 @@ uninstall: rm -rf ${DESTDIR}${LIBDIR}/tinyramfs check: - (cd test && ./check.sh) + (cd test && ${MAKE}) + +.PHONY: install uninstall check diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..5d66d39 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,16 @@ +.POSIX: + +.SUFFIXES: +.SUFFIXES: .test + +TEST = bare luks lvm zfs + +all: ${TEST} + +.test: + ./$< > $@.out 2>&1 + +clean: + rm -f *.out + +.PHONY: all clean diff --git a/test/check.sh b/test/check.sh deleted file mode 100755 index c7c6f43..0000000 --- a/test/check.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -if [ "$(id -u)" != 0 ]; then - printf '%s: must be run as root' "$0" - exit 1 -fi - -if [ "$DEVMGR" ]; then - : -elif command -v mdev; then - DEVMGR=mdev -elif command -v mdevd; then - DEVMGR=mdevd -elif command -v udevd; then - DEVMGR=eudev -elif command -v /lib/systemd/systemd-udevd; then - DEVMGR=systemd-udev -elif [ -e /proc/sys/kernel/hotplug ]; then - DEVMGR=proc -else - printf '%s: device manager not found' "$0" >&2 - exit 1 -fi > /dev/null - -export DEVMGR - -if command -v modprobe > /dev/null; then - modprobe kvm - modprobe nbd - modprobe zfs - modprobe dm_mod - modprobe dm_crypt -fi - -[ "$1" ] || set -- *.test - -for file; do - if [ "$DEBUG" ]; then - "./${file}" 2>&1 - else - "./${file}" > /dev/null 2>&1 - fi - - case $? in - 222) status=SKIP ;; - 0) status=PASS ;; - *) status=FAIL failed=1 ;; - esac - - printf '%s: %s\n' "$file" "$status" >&2 -done - -[ -z "$failed" ]