[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tests: fix skipping in some tests
From: |
Pádraig Brady |
Subject: |
[PATCH] tests: fix skipping in some tests |
Date: |
Wed, 4 Jul 2018 17:52:03 -0700 |
* tests/cp/cp-a-selinux.sh: Use 'skip_' rather than the probably
undefined 'skip'.
* tests/du/2g.sh: Likewise.
* tests/install/install-Z-selinux.sh: Likewise.
* tests/misc/chcon.sh: Likewise.
* tests/misc/selinux.sh: Likewise.
* tests/mkdir/restorecon.sh: Likewise.
* cfg.mk (sc_prohibit-skip): A new syntax check to catch the issue.
---
cfg.mk | 5 +++++
tests/cp/cp-a-selinux.sh | 2 +-
tests/du/2g.sh | 2 +-
tests/install/install-Z-selinux.sh | 2 +-
tests/misc/chcon.sh | 2 +-
tests/misc/selinux.sh | 2 +-
tests/mkdir/restorecon.sh | 2 +-
7 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 01a2525..a02ed27 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -250,6 +250,11 @@ sc_prohibit-quotearg:
halt='Unstyled diagnostic quoting detected' \
$(_sc_search_regexp)
+sc_prohibit-skip:
+ @prohibit='\|\| skip ' \
+ halt='Use skip_ not skip' \
+ $(_sc_search_regexp)
+
sc_sun_os_names:
@grep -nEi \
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
diff --git a/tests/cp/cp-a-selinux.sh b/tests/cp/cp-a-selinux.sh
index c48a063..3e83eae 100755
--- a/tests/cp/cp-a-selinux.sh
+++ b/tests/cp/cp-a-selinux.sh
@@ -33,7 +33,7 @@ mls_enabled_ && ctx="$ctx:s0"
# Check basic functionality - before check on fixed context mount
touch c || framework_failure_
-chcon $ctx c || skip "Failed to set context: $ctx"
+chcon $ctx c || skip_ "Failed to set context: $ctx"
cp -a c d 2>err || framework_failure_
cp --preserve=context c e || framework_failure_
cp --preserve=all c f || framework_failure_
diff --git a/tests/du/2g.sh b/tests/du/2g.sh
index 13b4bd0..5c21964 100755
--- a/tests/du/2g.sh
+++ b/tests/du/2g.sh
@@ -45,7 +45,7 @@ big=big
if ! fallocate -l2G $big; then
rm -f $big
{
- is_local_dir_ . || skip 'Not writing 2GB data to remote'
+ is_local_dir_ . || skip_ 'Not writing 2GB data to remote'
for i in $(seq 100); do
# Note: 2147483648 == 2^31. Print floor(2^31/100) per iteration.
printf %21474836s x || fail=1
diff --git a/tests/install/install-Z-selinux.sh
b/tests/install/install-Z-selinux.sh
index d0086f5..8934ecd 100755
--- a/tests/install/install-Z-selinux.sh
+++ b/tests/install/install-Z-selinux.sh
@@ -24,7 +24,7 @@ require_selinux_
mkdir subdir || framework_failure_
ctx='root:object_r:tmp_t'
mls_enabled_ && ctx="$ctx:s0"
-chcon "$ctx" subdir || skip "Failed to set context: $ctx"
+chcon "$ctx" subdir || skip_ "Failed to set context: $ctx"
cd subdir
# Since in a tmp_t dir, dirs can be created as user_tmp_t ...
diff --git a/tests/misc/chcon.sh b/tests/misc/chcon.sh
index dcc31e3..8f8de15 100755
--- a/tests/misc/chcon.sh
+++ b/tests/misc/chcon.sh
@@ -35,7 +35,7 @@ r1=object_r
t1=tmp_t
range=s0
ctx=$u1:$r1:$t1:$range
-chcon $ctx f || skip "Failed to set context: $ctx"
+chcon $ctx f || skip_ "Failed to set context: $ctx"
stat --printf='f|%C\n' f > out || fail=1
# Use --reference.
diff --git a/tests/misc/selinux.sh b/tests/misc/selinux.sh
index de7ff94..44560d9 100755
--- a/tests/misc/selinux.sh
+++ b/tests/misc/selinux.sh
@@ -33,7 +33,7 @@ mkfifo_or_skip_ p
ctx='root:object_r:tmp_t'
mls_enabled_ && ctx="$ctx:s0"
-chcon $ctx f d p || skip "Failed to set context: $ctx"
+chcon $ctx f d p || skip_ "Failed to set context: $ctx"
# inspect that context with both ls -Z and stat.
for i in d f p; do
diff --git a/tests/mkdir/restorecon.sh b/tests/mkdir/restorecon.sh
index 2bdfb5d..defb3f7 100755
--- a/tests/mkdir/restorecon.sh
+++ b/tests/mkdir/restorecon.sh
@@ -23,7 +23,7 @@ require_selinux_
mkdir subdir || framework_failure_
ctx='root:object_r:tmp_t'
mls_enabled_ && ctx="$ctx:s0"
-chcon "$ctx" subdir || skip "Failed to set context: $ctx"
+chcon "$ctx" subdir || skip_ "Failed to set context: $ctx"
cd subdir
# --- mkdir -Z ---
--
2.9.3
- [PATCH] tests: fix skipping in some tests,
Pádraig Brady <=