Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1 | From e8e8ccfd57e0274b431bc5717bf37c488285b07b Mon Sep 17 00:00:00 2001 |
| 2 | From: Mingli Yu <mingli.yu@windriver.com> |
| 3 | Date: Wed, 27 Oct 2021 10:30:46 +0800 |
| 4 | Subject: [PATCH] run-xtests.sh: check whether files exist |
| 5 | |
| 6 | Fixes: |
| 7 | # ./run-xtests.sh . tst-pam_access1 |
| 8 | mv: cannot stat '/etc/security/opasswd': No such file or directory |
| 9 | PASS: tst-pam_access1 |
| 10 | mv: cannot stat '/etc/security/opasswd-pam-xtests': No such file or directory |
| 11 | ================== |
| 12 | 1 tests passed |
| 13 | 0 tests not run |
| 14 | ================== |
| 15 | |
| 16 | Upstream-Status: Backport [https://github.com/linux-pam/linux-pam/commit/e8e8ccfd57e0274b431bc5717bf37c488285b07b] |
| 17 | |
| 18 | Signed-off-by: Mingli Yu <mingli.yu@windriver.com> |
| 19 | --- |
| 20 | xtests/run-xtests.sh | 20 +++++++++++++------- |
| 21 | 1 file changed, 13 insertions(+), 7 deletions(-) |
| 22 | |
| 23 | diff --git a/xtests/run-xtests.sh b/xtests/run-xtests.sh |
| 24 | index 14f585d9..ff9a4dc1 100755 |
| 25 | --- a/xtests/run-xtests.sh |
| 26 | +++ b/xtests/run-xtests.sh |
| 27 | @@ -18,10 +18,12 @@ all=0 |
| 28 | |
| 29 | mkdir -p /etc/security |
| 30 | for config in access.conf group.conf time.conf limits.conf ; do |
| 31 | - cp /etc/security/$config /etc/security/$config-pam-xtests |
| 32 | + [ -f "/etc/security/$config" ] && |
| 33 | + mv /etc/security/$config /etc/security/$config-pam-xtests |
| 34 | install -m 644 "${SRCDIR}"/$config /etc/security/$config |
| 35 | done |
| 36 | -mv /etc/security/opasswd /etc/security/opasswd-pam-xtests |
| 37 | +[ -f /etc/security/opasswd ] && |
| 38 | + mv /etc/security/opasswd /etc/security/opasswd-pam-xtests |
| 39 | |
| 40 | for testname in $XTESTS ; do |
| 41 | for cfg in "${SRCDIR}"/$testname*.pamd ; do |
| 42 | @@ -47,11 +49,15 @@ for testname in $XTESTS ; do |
| 43 | all=`expr $all + 1` |
| 44 | rm -f /etc/pam.d/$testname* |
| 45 | done |
| 46 | -mv /etc/security/access.conf-pam-xtests /etc/security/access.conf |
| 47 | -mv /etc/security/group.conf-pam-xtests /etc/security/group.conf |
| 48 | -mv /etc/security/time.conf-pam-xtests /etc/security/time.conf |
| 49 | -mv /etc/security/limits.conf-pam-xtests /etc/security/limits.conf |
| 50 | -mv /etc/security/opasswd-pam-xtests /etc/security/opasswd |
| 51 | + |
| 52 | +for config in access.conf group.conf time.conf limits.conf opasswd ; do |
| 53 | + if [ -f "/etc/security/$config-pam-xtests" ]; then |
| 54 | + mv /etc/security/$config-pam-xtests /etc/security/$config |
| 55 | + else |
| 56 | + rm -f /etc/security/$config |
| 57 | + fi |
| 58 | +done |
| 59 | + |
| 60 | if test "$failed" -ne 0; then |
| 61 | echo "===================" |
| 62 | echo "$failed of $all tests failed" |
| 63 | -- |
| 64 | 2.32.0 |
| 65 | |