Skip to content

Commit

Permalink
Add tailoring profile test which checks fix generating
Browse files Browse the repository at this point in the history
  • Loading branch information
mildas committed Jan 23, 2019
1 parent 3f76d08 commit 0ded033
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/API/XCCDF/tailoring/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,23 @@ function test_api_xccdf_tailoring_profile_include_in_arf {
rm -f $result
}

function test_api_xccdf_tailoring_profile_generate_fix {
local INPUT=$srcdir/$1
local TAILORING=$srcdir/$2

tailoring_result='tailoring_res'
fix_result='fix_res'
# tailoring profile only with "always fail" rule and generate bash fix
$OSCAP xccdf eval --tailoring-file $TAILORING --profile "xccdf_com.example.www_profile_customized" --results-arf $tailoring_result $INPUT || [ "$?" == "2" ]
$OSCAP xccdf generate fix --tailoring-id "scap_org.open-scap_cref_tests--API--XCCDF--tailoring--baseline.tailoring.xml_tailoring" --result-id xccdf_org.open-scap_test-result_xccdf-com.example.www_profile_customized --results $fix_result $tailoring_result

if ! grep -q "echo \"Fix the first rule\"" $fix_result; then
return 1
fi

rm -f $tailoring_result $fix_result
}

# Testing.

test_init "test_api_xccdf_tailoring.log"
Expand Down

0 comments on commit 0ded033

Please sign in to comment.