forked from woqidaideshi/openruyi-autotest
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2250c56a4 |
@@ -1,14 +1,12 @@
|
||||
summary: Functional test - LTP - kernel_misc - zram01
|
||||
framework: beakerlib
|
||||
test: ./test.sh
|
||||
tag:
|
||||
- functional
|
||||
- ltp
|
||||
- kernel_misc
|
||||
duration: 60m
|
||||
duration: 30m
|
||||
tier: 1
|
||||
path: /tests/functional/ltp/kernel_misc/test_ltp_kernel_misc_zram01
|
||||
require:
|
||||
- ltp
|
||||
- beakerlib
|
||||
- ntfs-3g
|
||||
|
||||
@@ -11,13 +11,6 @@ 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"
|
||||
@@ -27,7 +20,6 @@ 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,10 +1,11 @@
|
||||
summary: Security test - OpenSCAP CIS - andreport
|
||||
framework: beakerlib
|
||||
test: ./test.sh
|
||||
tag:
|
||||
- security
|
||||
- openscap
|
||||
- cis
|
||||
duration: 10m
|
||||
duration: 30m
|
||||
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
|
||||
local out=/tmp/cis_eval_$$
|
||||
local xml=/tmp/cis_result_$$.xml
|
||||
local html=/tmp/cis_report_$$.html
|
||||
out=/tmp/cis_eval_$$
|
||||
xml=/tmp/cis_result_$$.xml
|
||||
html=/tmp/cis_report_$$.html
|
||||
oscap xccdf eval --profile "$CIS_PROFILE" --results-arf "$xml" --report "$html" "$CIS_DS" 2>&1 | tee $out
|
||||
local rc=${PIPESTATUS[0]}
|
||||
if [ $rc -ne 0 ]; then
|
||||
rc=${PIPESTATUS[0]}
|
||||
if [ $rc -ne 0 ] && [ $rc -ne 2 ]; 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
|
||||
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)
|
||||
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)
|
||||
rlPass "CIS eval complete: pass=$pass fail=$fail notapplicable=$na"
|
||||
fi
|
||||
rm -f $out $xml $html
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
summary: Security test - OpenSCAP CIS - scriptGenerate
|
||||
framework: beakerlib
|
||||
test: ./test.sh
|
||||
tag:
|
||||
- security
|
||||
- openscap
|
||||
- cis
|
||||
duration: 10m
|
||||
duration: 30m
|
||||
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
|
||||
local out=/tmp/cis_fix_$$
|
||||
local xml=/tmp/cis_fix_xml_$$.xml
|
||||
local fix=/tmp/cis_fix_$$.sh
|
||||
out=/tmp/cis_fix_$$
|
||||
xml=/tmp/cis_fix_xml_$$.xml
|
||||
fix=/tmp/cis_fix_$$.sh
|
||||
oscap xccdf eval --profile "$CIS_PROFILE" --results "$xml" "$CIS_DS" 2>&1 | tee $out
|
||||
local rc=${PIPESTATUS[0]}
|
||||
if [ $rc -ne 0 ] || [ ! -f "$xml" ]; then
|
||||
rc=${PIPESTATUS[0]}
|
||||
if { [ $rc -ne 0 ] && [ $rc -ne 2 ]; } || [ ! -f "$xml" ]; then
|
||||
rlFail "oscap eval failed (exit=$rc)"
|
||||
else
|
||||
local rid=$(grep -oP 'id="\K[^"]+' "$xml" | head -1)
|
||||
rid=$(grep -oP '<TestResult[^>]*\bid="\K[^"]+' "$xml" | head -1)
|
||||
if [ -z "$rid" ]; then
|
||||
rlFail "Cannot extract TestResult id"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user