summaryrefslogtreecommitdiff
path: root/selftest/s3-selftest.sh
blob: 8b44629bc3c064ae2f58360e34b82ade6d95fe69 (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
35
36
37
38
39
40
41
42
43
44
#!/bin/sh

FILTER_XFAIL="${PYTHON} -u ${SELFTESTDIR}/filter-subunit --expected-failures=${SOURCEDIR}/selftest/knownfail"
SUBUNIT_FORMATTER="${PYTHON} -u ${SELFTESTDIR}/format-subunit --prefix=${SELFTESTPREFIX} --immediate"
FORMAT_TEST_OUTPUT="${FILTER_XFAIL} | ${SUBUNIT_FORMATTER}"

cleanup_and_exit() {
	if test "$1" = 0 -o -z "$1"; then
		exit 0
	else
		exit $1
	fi
}

st_test_done() {
	test -f ${SELFTESTPREFIX}/st_done || { echo "SELFTEST FAILED"; cleanup_and_exit 1; }
}

if [ "x${RUN_FROM_BUILD_FARM}" = "xyes" ]; then
	( rm -f ${SELFTESTPREFIX}/st_done && \
		${PERL} ${SELFTESTDIR}/selftest.pl \
			--prefix=${SELFTESTPREFIX} --target=samba3 \
			--testlist="${SOURCEDIR}/selftest/tests.sh|" \
			--exclude=${SOURCEDIR}/selftest/skip \
			--socket-wrapper ${TESTS} \
	&& touch ${SELFTESTPREFIX}/st_done ) | \
		${FILTER_XFAIL} --strip-passed-output

	st_test_done
	test -f ${SELFTESTPREFIX}/summary && cat ${SELFTESTPREFIX}/summary
else
	( rm -f ${SELFTESTPREFIX}/st_done && \
		${PERL} ${SELFTESTDIR}/selftest.pl \
			--prefix=${SELFTESTPREFIX} --target=samba3 \
			--testlist="${SOURCEDIR}/selftest/tests.sh|" \
			--exclude=${SOURCEDIR}/selftest/skip \
			--socket-wrapper ${TESTS} \
	&& touch ${SELFTESTPREFIX}/st_done ) | \
		${SUBUNIT_FORMATTER}

	st_test_done
fi

cleanup_and_exit