diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:22:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:22:51 +0000 |
commit | 9ada0093e92388590c7368600ca4e9e3e376f0d0 (patch) | |
tree | a56fe41110023676d7082028cbaa47ca4b6e6164 /xtests/run-xtests.sh | |
parent | Initial commit. (diff) | |
download | pam-upstream/1.5.2.tar.xz pam-upstream/1.5.2.zip |
Adding upstream version 1.5.2.upstream/1.5.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | xtests/run-xtests.sh | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/xtests/run-xtests.sh b/xtests/run-xtests.sh new file mode 100755 index 0000000..14f585d --- /dev/null +++ b/xtests/run-xtests.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +SRCDIR=$1 +shift 1 +[ -z "${SRCDIR}" ] && SRCDIR='.' + +if test `id -u` -ne 0 ; then + echo "You need to be root to run the tests" + exit 1 +fi + +XTESTS="$@" + +failed=0 +pass=0 +skipped=0 +all=0 + +mkdir -p /etc/security +for config in access.conf group.conf time.conf limits.conf ; do + cp /etc/security/$config /etc/security/$config-pam-xtests + install -m 644 "${SRCDIR}"/$config /etc/security/$config +done +mv /etc/security/opasswd /etc/security/opasswd-pam-xtests + +for testname in $XTESTS ; do + for cfg in "${SRCDIR}"/$testname*.pamd ; do + install -m 644 $cfg /etc/pam.d/$(basename $cfg .pamd) + done + if test -f "${SRCDIR}"/$testname.sh ; then + test -x "${SRCDIR}"/$testname.sh || chmod 755 "${SRCDIR}"/$testname.sh + "${SRCDIR}"/$testname.sh > /dev/null + else + ./$testname > /dev/null + fi + RETVAL=$? + if test $RETVAL -eq 77 ; then + echo "SKIP: $testname" + skipped=`expr $skipped + 1` + elif test $RETVAL -ne 0 ; then + echo "FAIL: $testname" + failed=`expr $failed + 1` + else + echo "PASS: $testname" + pass=`expr $pass + 1` + fi + all=`expr $all + 1` + rm -f /etc/pam.d/$testname* +done +mv /etc/security/access.conf-pam-xtests /etc/security/access.conf +mv /etc/security/group.conf-pam-xtests /etc/security/group.conf +mv /etc/security/time.conf-pam-xtests /etc/security/time.conf +mv /etc/security/limits.conf-pam-xtests /etc/security/limits.conf +mv /etc/security/opasswd-pam-xtests /etc/security/opasswd +if test "$failed" -ne 0; then + echo "===================" + echo "$failed of $all tests failed" + echo "$skipped tests not run" + echo "===================" + exit 1 +else + echo "==================" + echo "$all tests passed" + echo "$skipped tests not run" + echo "==================" +fi +exit 0 |