[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests: initial SMACK tests
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] tests: initial SMACK tests |
Date: |
Fri, 02 May 2014 20:31:51 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 04/30/2014 04:02 PM, Bernhard Voelker wrote:
> On 04/30/2014 01:23 PM, Pádraig Brady wrote:
>> +# Check the string "context=" presence without specified user.
>> +id | grep context= >/dev/null || fail=1
>
> there's no need to suppress the output.
> It may even better to redirect id's output to a file
> and 'cat' its content if fail=1.
While outputting the command output in all those places
would be reundant, you're right with most points.
I've ameneded as follows and will push later.
thanks,
Pádraig.
diff --git a/tests/id/smack.sh b/tests/id/smack.sh
index 5b60e7e..227db3e 100755
--- a/tests/id/smack.sh
+++ b/tests/id/smack.sh
@@ -22,15 +22,16 @@ print_ver_ id
require_smack_
# Check the string "context=" presence without specified user.
-id | grep context= >/dev/null || fail=1
+id > out || fail=1
+grep 'context=' out || { cat out; fail=1; }
# Check context=" is absent without specified user in conforming mode.
POSIXLY_CORRECT=1 id > out || fail=1
-grep context= out && fail=1
+grep 'context=' out && fail=1
# Check the string "context=" absence with specified user.
# But if the current user is nameless, skip this part.
-id -nu > /dev/null \
- && id $(id -nu) | grep context= >/dev/null && fail=1
+id -nu > /dev/null && id $(id -nu) > out
+grep 'context=' out && fail=1
Exit $fail
diff --git a/tests/mkdir/smack-no-root.sh b/tests/mkdir/smack-no-root.sh
index 09157a8..527940b 100755
--- a/tests/mkdir/smack-no-root.sh
+++ b/tests/mkdir/smack-no-root.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# SMACK test for the mkdir,mknod, mkfifo commands.
# Derived from tests/mkdir/selinux.sh.
-# Ensure that an invalid SMACK label doesn't cause a segfault.
+# Ensure that an unsettable SMACK label doesn't cause a segfault.
# Copyright (C) 2014 Free Software Foundation, Inc.
diff --git a/tests/mkdir/smack-root.sh b/tests/mkdir/smack-root.sh
index 96b75ea..8d7ec9b 100755
--- a/tests/mkdir/smack-root.sh
+++ b/tests/mkdir/smack-root.sh
@@ -27,9 +27,10 @@ require_root_
c=arbitrary-smack-label
for cmd in 'mkdir dir' 'mknod b p' 'mkfifo f'; do
- $cmd --context="$c" || fail=1
+ $cmd --context="$c" || { fail=1; continue; }
set $cmd
- test "$(ls -dZ $2 | cut -f1 -d' ')" = "$c" || fail=1
+ ls -dZ $2 > out || fail=1
+ test "$(cut -f1 -d' ' out)" = "$c" || { cat out; fail=1; }
done
Exit $fail
- Re: [PATCH] tests: initial SMACK tests,
Pádraig Brady <=