Debian Codegraph @

tests/DS/test_sds_fix_from_results.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/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_resultsscip-shell shell shell-project 0.0.0 test_generate_fix_results(). {
13 local fixfile=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX)
14 local results=$(mktempscip-shell system . . 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 grepscip-shell system . . grep. -q remediation_rule_applicable_pass $fixfile
20 grepscip-shell system . . grep. -q remediation_rule_applicable_fail $fixfile
21 grepscip-shell system . . grep. -q remediation_rule_notapplicable $fixfile
22 rmscip-shell system . . 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 grepscip-shell system . . grep. -qv remediation_rule_applicable_pass $fixfile
27 grepscip-shell system . . grep. -q remediation_rule_applicable_fail $fixfile
28 grepscip-shell system . . grep. -qv remediation_rule_notapplicable $fixfile
29 rmscip-shell system . . 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