| 1 |
#!/bin/sh |
| 2 |
set -e |
| 3 |
# NB: -e is required. |
| 4 |
|
| 5 |
|
| 6 |
# These tests are taken from the "sudotest" targets from the various Makefiles. |
| 7 |
# Unfortunately, it seems to be easier to just copy them here, rather than |
| 8 |
# patching up the Makefiles to work with binaries built for autopkgtest. |
| 9 |
|
| 10 |
TESTARCH=`dpkg-architecture -qDEB_HOST_MULTIARCH` |
| 11 |
TESTDIR="/usr/lib/${TESTARCH}/libcap2/tests" |
| 12 |
|
| 13 |
echo "@@@ Running upstream tests (root required) @@@" |
| 14 |
|
| 15 |
if [ "`id -u`" -ne 0 ] |
| 16 |
then |
| 17 |
echo "These tests must be run as root. Aborting." >&2 |
| 18 |
exit 1 |
| 19 |
fi |
| 20 |
|
| 21 |
echo "## Preparation ##" |
| 22 |
cp pam_cap/capability.conf pam_cap/sudotest.conf "$AUTOPKGTEST_TMP"/ |
| 23 |
cp -f "${TESTDIR}"/* "$AUTOPKGTEST_TMP"/ |
| 24 |
cd "$AUTOPKGTEST_TMP" |
| 25 |
|
| 26 |
echo "## libcap2 tests ##" |
| 27 |
# From <src>/tests/Makefile |
| 28 |
echo exit | "$TESTDIR"/uns_test |
| 29 |
./libcap_launch_test |
| 30 |
./exploit || echo "exploit failed" |
| 31 |
./noexploit |
| 32 |
|
| 33 |
echo "## libpsx tests ##" |
| 34 |
# From <src>/tests/Makefile |
| 35 |
./libcap_psx_launch_test |
| 36 |
|
| 37 |
echo "## PAM tests ##" |
| 38 |
# From <src>/pam_cap/Makefile |
| 39 |
./test_pam_cap root 0x0 0x0 0x0 config=./capability.conf |
| 40 |
./test_pam_cap root 0x0 0x0 0x0 config=./sudotest.conf |
| 41 |
./test_pam_cap alpha 0x0 0x0 0x0 config=./capability.conf |
| 42 |
./test_pam_cap alpha 0x0 0x1 0x80 config=./sudotest.conf |
| 43 |
./test_pam_cap beta 0x0 0x1 0x0 config=./sudotest.conf |
| 44 |
./test_pam_cap gamma 0x0 0x0 0x81 config=./sudotest.conf |
| 45 |
./test_pam_cap delta 0x41 0x80 0x41 config=./sudotest.conf |