blob: 40040a873a61ba98f4b93008ccd74bc36f9ad497 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001From e8e8ccfd57e0274b431bc5717bf37c488285b07b Mon Sep 17 00:00:00 2001
2From: Mingli Yu <mingli.yu@windriver.com>
3Date: Wed, 27 Oct 2021 10:30:46 +0800
4Subject: [PATCH] run-xtests.sh: check whether files exist
5
6Fixes:
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
16Upstream-Status: Backport [https://github.com/linux-pam/linux-pam/commit/e8e8ccfd57e0274b431bc5717bf37c488285b07b]
17
18Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
19---
20 xtests/run-xtests.sh | 20 +++++++++++++-------
21 1 file changed, 13 insertions(+), 7 deletions(-)
22
23diff --git a/xtests/run-xtests.sh b/xtests/run-xtests.sh
24index 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--
642.32.0
65