Debian Codegraph @

tests/DS/test_sds_fix_from_results.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 # Author:
4 # Martin Preisler <[email protected]>
5
6 set -e -o pipefail
7
8 . $builddir/tests/test_common.sh
9
10 # Test Cases.
11
12 function test_generate_fix_results {
13 local fixfile=$(mktemp -t ${name}.out.XXXXXX)
14 local results=$(mktemp -t ${name}.out.XXXXXX)
15
16 # generate all from results
17 $OSCAP xccdf eval --results $results "${srcdir}/$1" || ret=$?
18 $OSCAP xccdf generate fix --output $fixfile $results
19 grep -q remediation_rule_applicable_pass $fixfile
20 grep -q remediation_rule_applicable_fail $fixfile
21 grep -q remediation_rule_notapplicable $fixfile
22 rm $fixfile
23
24 # generate based on TestResult
25 $OSCAP xccdf generate fix --output $fixfile --result-id xccdf_org.open-scap_testresult_default-profile $results
26 grep -qv remediation_rule_applicable_pass $fixfile
27 grep -q remediation_rule_applicable_fail $fixfile
28 grep -qv remediation_rule_notapplicable $fixfile
29 rm $fixfile $results
30 }
31
32 # Testing.
33 test_init
34
35 test_run "generate_fix_cpe_results" test_generate_fix_results eval_cpe/sds.xml
36
37 test_exit