Skip to content

Commit

Permalink
tests: fix functional 114 to take into account the block of SELinux.
Browse files Browse the repository at this point in the history
If SELinux is not disabled (enforcing or permissive), functional test
No.114 will fail.
This is because, a single block for SELinux's attribute is added to
the '%b * %B' of stat command output, so the output result is different
from the SELinux disabled environment.

This change provides, it will take into account the block of SELinux.

Signed-off-by: Kazuhisa Hara <khara@sios.com>
  • Loading branch information
kazuhisya committed May 21, 2017
1 parent 43f8125 commit 340e421
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/functional/114
Expand Up @@ -14,11 +14,22 @@ fi

function _listFiles
{
# Workaround for SELinux enabled environment.
# If SELinux is not disabled (enforcing or permissive),
# SELinux uses 1 block. see xattr(7) for details.
extra_blocksize=0
if [ -e /etc/redhat-release ] && [ `getenforce` != Disabled ]; then
extra_blocksize=`tune2fs -l ${1}.img |grep "Block size" | tr -s " "| cut -d " " -f 3`
fi

for i in "$@" ; do
# Remove extra block size amount from calculation. If SELinux
# is disabled (or not installed) , it is 0, if enabled, it is
# remove for one block size.
stat -c "%n %b %B %s" "$i"/* |\
awk '{print $1,$2*$3,$4;}' |\
sort |\
_filter_store
awk '{print $1,$2*$3-'${extra_blocksize}',$4;}' |\
sort |\
_filter_store
done
}

Expand Down

0 comments on commit 340e421

Please sign in to comment.