aboutsummaryrefslogtreecommitdiff
path: root/libexec/build-make-test
blob: e72dfd9d387116eccdbc78c8536b2a340ca91d92 (plain)
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
32
33
34
#!/usr/bin/env build

build_make_test_cleanup()
{
	ret=$?

	if [ ${ret} -ne 0 ]; then
		echo "error: test failed for ${CATEGORY}/${NAME}" >&2
		echo "logfile: '${PKG_LOGFILE}'" >&2
		exit ${ret}
	fi
	exit 0
}

pkg_test() { echo "test: no test defined"; }

build_make_test()
{(
	trap build_make_test_cleanup 0
	echo "testing: ${1}"
	load_rules "${1}"
	mkenv "test"
	PKG_LOGFILE="${L}/test"

	cd "${W}"
	pkg_test >> "${PKG_LOGFILE}" 2>&1
 )}

if test "${BUILDER_CALL_STACK}" = '__main__'; then
	simple_usage 'test' '[all|[<category>/]<package|all>]' "$@"
	build_make_test "${@}"
fi

# vim: filetype=sh