| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Configure the tests to run |
| 4 |
TESTS="unittest" |
| 5 |
|
| 6 |
# Run portions of the autopkgtest suite, with an autopkgtest-like environment |
| 7 |
RESULT="succeeded" |
| 8 |
for TEST in ${TESTS}; do |
| 9 |
|
| 10 |
# Create the $AUTOPKGTEST_TMP directory like autopkgtest |
| 11 |
export AUTOPKGTEST_TMP=`mktemp -d` |
| 12 |
if [ $? != 0 ]; then |
| 13 |
echo "${TEST} failed: failed to create \$AUTOPKGTEST_TMP" |
| 14 |
exit 1 |
| 15 |
elif [ ! -d "${AUTOPKGTEST_TMP}" ]; then |
| 16 |
echo "${TEST} failed: could not create \$AUTOPKGTEST_TMP" |
| 17 |
exit 1 |
| 18 |
fi |
| 19 |
|
| 20 |
# Create the $AUTOPKGTEST_ARTIFACTS directory like autopkgtest |
| 21 |
export AUTOPKGTEST_ARTIFACTS=`mktemp -d` |
| 22 |
if [ $? != 0 ]; then |
| 23 |
echo "${TEST} failed: failed to create \$AUTOPKGTEST_ARTIFACTS" |
| 24 |
exit 1 |
| 25 |
elif [ ! -d "${AUTOPKGTEST_ARTIFACTS}" ]; then |
| 26 |
echo "${TEST} failed: could not create \$AUTOPKGTEST_ARTIFACTS" |
| 27 |
exit 1 |
| 28 |
fi |
| 29 |
|
| 30 |
# Execute the testcase |
| 31 |
TESTCASE="debian/tests/${TEST}" |
| 32 |
if [ ! -f "${TESTCASE}" ]; then |
| 33 |
echo "${TEST} failed: testcase does not exist" |
| 34 |
RESULT="failed" |
| 35 |
else |
| 36 |
sh ${TESTCASE} -r # -r to run in "debian/rules" mode |
| 37 |
if [ $? != 0 ]; then |
| 38 |
echo "${TEST} failed: non-zero exit status" |
| 39 |
RESULT="failed" |
| 40 |
fi |
| 41 |
fi |
| 42 |
|
| 43 |
# Remove the temporary directories |
| 44 |
rm -rf ${AUTOPKGTEST_TMP} |
| 45 |
rm -rf ${AUTOPKGTEST_ARTIFACTS} |
| 46 |
done |
| 47 |
|
| 48 |
# Exit with non-zero upon failure, to kill the build |
| 49 |
if [ "${RESULT}" = "failed" ]; then |
| 50 |
exit 1 |
| 51 |
fi |
| 52 |
|