aboutsummaryrefslogtreecommitdiff
path: root/tests/scripts/gen-simple
blob: ddec9a42e489ff19a0e4560ce2ec998acf93d12e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh

NAME=
PROGS=
while getopts "n:p:" opt; do
	case "$opt" in
		n) NAME="$OPTARG";;
		p) PROGS="$PROGS $OPTARG";;
		*) echo "unrecognised option -$OPTARG" >&2; exit 1;;
	esac
done

if [ -z "$NAME" ]; then
	echo "No name given for tests" >&2; exit 2;
fi

if [ -z "$PROGS" ]; then
	echo "No programs to add to initrd" >&2; exit 3;
fi

echo "build/$NAME/initrd: build/$NAME/init \$(COMMON) \$(KMI)"		>> tests.mk
echo "	echo build/$NAME/init | \$(GEN_INITRD) build/$NAME/initrd"	>> tests.mk
echo "reports/$NAME/log: build/$NAME/initrd"				>> tests.mk
echo "	mkdir -p reports/$NAME"						>> tests.mk
echo "	rm -f reports/$NAME/*"						>> tests.mk
echo "	timeout --foreground 30s \$(QEMU) \
	build/$NAME/initrd > reports/$NAME/log" >> tests.mk

echo "TESTS += $NAME"			>> tests.mk
echo ".PHONY: do-$NAME"			>> tests.mk
echo "do-$NAME: reports/$NAME/log"	>> tests.mk