Debian Codegraph @

tests/API/XCCDF/unittests/test_remediation_blueprint.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 . $builddir/tests/test_common.sh
3
4 set -e
5 set -o pipefail
6
7 name=$(basenamescip-shell system . . basename. $0 .sh)
8 result=$(make_temp_file /tmpscip-shell filesystem . . `/tmp`. ${name}.out)
9 stderr=$(make_temp_file /tmpscip-shell filesystem . . `/tmp`. ${name}.out)
10
11 ret=0
12
13 input_xml="$srcdir/${name}.xccdf.xml"
14 valid_toml="$srcdir/${name}.toml"
15
16 expected_result=$(mktempscip-shell system . . mktemp.)
17 sedscip-shell system . . sed. "s;TEST_XCCDF_FILE_NAME;$input_xml;" "$valid_toml" > "$expected_result"
18
19 echoscip-shell system . . echo. "Stderr file = $stderr"
20 echoscip-shell system . . echo. "Result file = $result"
21 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; :> $stderr
22
23 # The expected file was generated without ' # This file was generated by OpenSCAP 1.3.5 using:' line
24 # to make the test independent from the scanner version. We have to filter this line from the output as well.
25
26 $OSCAP xccdf generate fix --fix-type blueprint --profile 'common' "$input_xml" | grepscip-shell system . . grep. -v "OpenSCAP" > "$result"
27
28 diffscip-shell system . . diff. "$expected_result" "$result"
29
30 rmscip-shell system . . rm. "$result"
31 rmscip-shell system . . rm. "$expected_result"