Compare commits

..
6 changed files with 27 additions and 19 deletions
@@ -1,12 +1,14 @@
summary: Functional test - LTP - kernel_misc - zram01
framework: beakerlib
test: ./test.sh
tag:
- functional
- ltp
- kernel_misc
duration: 30m
duration: 60m
tier: 1
path: /tests/functional/ltp/kernel_misc/test_ltp_kernel_misc_zram01
require:
- ltp
- beakerlib
- ntfs-3g
@@ -11,6 +11,13 @@ rlJournalStart
ltpSetup
TmpDir=$(mktemp -d)
rlRun "cd $TmpDir" 0 "Enter temporary test directory"
# LTP zram01 maps ntfs3 to mkfs.ntfs but formats with mkfs.ntfs3
if ! command -v mkfs.ntfs3 >/dev/null 2>&1 && command -v mkfs.ntfs >/dev/null 2>&1; then
ShimDir=$(mktemp -d)
ln -s "$(command -v mkfs.ntfs)" "$ShimDir/mkfs.ntfs3"
PATH="$ShimDir:$PATH"
export PATH
fi
rlPhaseEnd
rlPhaseStartTest "LTP kernel_misc - zram01"
@@ -20,6 +27,7 @@ rlJournalStart
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
[ -n "$TmpDir" ] && [ -d "$TmpDir" ] && rlRun "rm -rf $TmpDir" 0 "Cleanup"
[ -n "$ShimDir" ] && [ -d "$ShimDir" ] && rlRun "rm -rf $ShimDir" 0 "Remove mkfs shim"
# LTP Package managed by lib.sh 's reference counting auto-uninstall
rlPhaseEnd
@@ -1,11 +1,10 @@
summary: Security test - OpenSCAP CIS - andreport
framework: beakerlib
test: ./test.sh
tag:
- security
- openscap
- cis
duration: 30m
duration: 10m
tier: 2
path: /tests/security/openscap/cis/test_openscap_cis_eval_report
require:
@@ -16,21 +16,21 @@ rlJournalStart
if [ ! -f "$CIS_DS" ]; then
rlFail "Data stream not found"
else
out=/tmp/cis_eval_$$
xml=/tmp/cis_result_$$.xml
html=/tmp/cis_report_$$.html
local out=/tmp/cis_eval_$$
local xml=/tmp/cis_result_$$.xml
local html=/tmp/cis_report_$$.html
oscap xccdf eval --profile "$CIS_PROFILE" --results-arf "$xml" --report "$html" "$CIS_DS" 2>&1 | tee $out
rc=${PIPESTATUS[0]}
if [ $rc -ne 0 ] && [ $rc -ne 2 ]; then
local rc=${PIPESTATUS[0]}
if [ $rc -ne 0 ]; then
rlFail "oscap eval failed (exit=$rc)"
elif [ ! -f "$xml" ]; then
rlFail "ARF result file not generated"
elif [ ! -f "$html" ]; then
rlFail "HTML report not generated"
else
pass=$(grep -c '<result>pass</result>' "$xml" 2>/dev/null || echo 0)
fail=$(grep -c '<result>fail</result>' "$xml" 2>/dev/null || echo 0)
na=$(grep -c '<result>notapplicable</result>' "$xml" 2>/dev/null || echo 0)
local pass=$(grep -c '<result>pass</result>' "$xml" 2>/dev/null || echo 0)
local fail=$(grep -c '<result>fail</result>' "$xml" 2>/dev/null || echo 0)
local na=$(grep -c '<result>notapplicable</result>' "$xml" 2>/dev/null || echo 0)
rlPass "CIS eval complete: pass=$pass fail=$fail notapplicable=$na"
fi
rm -f $out $xml $html
@@ -1,11 +1,10 @@
summary: Security test - OpenSCAP CIS - scriptGenerate
framework: beakerlib
test: ./test.sh
tag:
- security
- openscap
- cis
duration: 30m
duration: 10m
tier: 2
path: /tests/security/openscap/cis/test_openscap_cis_fix
require:
@@ -16,15 +16,15 @@ rlJournalStart
if [ ! -f "$CIS_DS" ]; then
rlFail "Data stream not found"
else
out=/tmp/cis_fix_$$
xml=/tmp/cis_fix_xml_$$.xml
fix=/tmp/cis_fix_$$.sh
local out=/tmp/cis_fix_$$
local xml=/tmp/cis_fix_xml_$$.xml
local fix=/tmp/cis_fix_$$.sh
oscap xccdf eval --profile "$CIS_PROFILE" --results "$xml" "$CIS_DS" 2>&1 | tee $out
rc=${PIPESTATUS[0]}
if { [ $rc -ne 0 ] && [ $rc -ne 2 ]; } || [ ! -f "$xml" ]; then
local rc=${PIPESTATUS[0]}
if [ $rc -ne 0 ] || [ ! -f "$xml" ]; then
rlFail "oscap eval failed (exit=$rc)"
else
rid=$(grep -oP '<TestResult[^>]*\bid="\K[^"]+' "$xml" | head -1)
local rid=$(grep -oP 'id="\K[^"]+' "$xml" | head -1)
if [ -z "$rid" ]; then
rlFail "Cannot extract TestResult id"
else