Whamcloud - gitweb
LU-8524 tests: Awk command re-structured to pass correct value 70/22070/3
authorSaurabh Tandan <saurabh.tandan@intel.com>
Tue, 23 Aug 2016 01:12:21 +0000 (18:12 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 10 Sep 2016 03:23:48 +0000 (03:23 +0000)
Variable "selinux_policy" was having incorrect value passed to
it due to inappropriate structuring of couple of commands.
Both those commands have been restructured in order to have the
correct value passed to the variable "selinux_policy".
Test was run with this modified piece of code successfully,
and the result for it can be found in comments section of the
ticket.

Test-Parameters: trivial testlist=sanity-selinux,sanity-selinux,sanity-selinux
Signed-off-by: Saurabh Tandan <saurabh.tandan@intel.com>
Change-Id: I3c6c86d607edeadd03ab694435fb201c08c23654
Reviewed-on: http://review.whamcloud.com/22070
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Wei Liu <wei3.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity-selinux.sh [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index d86c11c..b1fb79b
@@ -29,7 +29,7 @@ require_dsh_mds || exit 0
        error "RUNAS_ID set to 0, but UID is also 0!"
 
 #
        error "RUNAS_ID set to 0, but UID is also 0!"
 
 #
-# global variables of this sanity
+# global variables of this  sanity
 #
 
 check_selinux() {
 #
 
 check_selinux() {
@@ -40,13 +40,10 @@ check_selinux() {
                 "but it must be enforced to run sanity-selinux" && exit 0
        fi
        local selinux_policy=$(sestatus |
                 "but it must be enforced to run sanity-selinux" && exit 0
        fi
        local selinux_policy=$(sestatus |
-                              awk -F':' '$1 == "Loaded policy name" {print $2}' |
-                              xargs)
+               awk -F':' '$1 == "Loaded policy name" {print $2}' | xargs)
        if [ -z "$selinux_policy" ]; then
            selinux_policy=$(sestatus |
        if [ -z "$selinux_policy" ]; then
            selinux_policy=$(sestatus |
-                            awk -F':' '$1 == "Policy from config file"
-                                    {print $2}' |
-                            xargs)
+               awk -F':' '$1 == "Policy from config file" {print $2}' | xargs)
        fi
        [ "$selinux_policy" == "targeted" ] ||
                error "Accepting only targeted policy"
        fi
        [ "$selinux_policy" == "targeted" ] ||
                error "Accepting only targeted policy"