Debian Codegraph @

tests/probes/textfilecontent54/test_behavior_multiline.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 . $builddir/tests/test_common.sh
3
4 set -e -o pipefail
5
6 name=$(basenamescip-shell system . . basename. $0 .sh)
7 tmpdir=$(make_temp_dir /tmpscip-shell filesystem . . `/tmp`. ${name})
8 tpl=${srcdir}/${name}.xml.tpl
9 input=${tmpdir}/${name}.xml
10 result=${tmpdir}/${name}.results.xml
11 echoscip-shell system . . echo. "Temp dir: $tmpdir"
12
13 # prepare the environment
14 sedscip-shell system . . sed. "s@%PATH%@${tmpdir}@" $tpl > $input
15 echoscip-shell system . . echo. "line1" > "${tmpdir}/textfile"
16 echoscip-shell system . . echo. "line2" >> "${tmpdir}/textfile"
17 echoscip-shell system . . echo. "line3" >> "${tmpdir}/textfile"
18
19 echoscip-shell system . . echo. "Evaluating content."
20 $OSCAP oval eval --results $result $input || [scip-shell system . . `[`. $? == 2 ]
21 echoscip-shell system . . echo. "Validating results."
22 $OSCAP oval validate --results $result
23 echoscip-shell system . . echo. "Testing syschar values."
24 # filename
25 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:filename:tst:1"]/@result)')" == "true" ]
26 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:filename:tst:2"]/@result)')" == "true" ]
27 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:filename:tst:3"]/@result)')" == "true" ]
28 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:filename:tst:4"]/@result)')" == "false" ]
29 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:filename:tst:5"]/@result)')" == "true" ]
30 # filepath
31 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:filepath:tst:1"]/@result)')" == "true" ]
32 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:filepath:tst:2"]/@result)')" == "true" ]
33 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:filepath:tst:3"]/@result)')" == "true" ]
34 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:filepath:tst:4"]/@result)')" == "false" ]
35 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/tests/test[@test_id="oval:filepath:tst:5"]/@result)')" == "true" ]
36 echoscip-shell system . . echo. "Testing syschar values."
37 # filename
38 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:filename:obj:1"]/@flag)')" == "complete" ]
39 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:filename:obj:2"]/@flag)')" == "complete" ]
40 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:filename:obj:3"]/@flag)')" == "complete" ]
41 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:filename:obj:4"]/@flag)')" == "does not exist" ]
42 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:filename:obj:5"]/@flag)')" == "complete" ]
43 #filepath
44 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:filepath:obj:1"]/@flag)')" == "complete" ]
45 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:filepath:obj:2"]/@flag)')" == "complete" ]
46 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:filepath:obj:3"]/@flag)')" == "complete" ]
47 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:filepath:obj:4"]/@flag)')" == "does not exist" ]
48 [scip-shell system . . `[`. "$($XPATH $result 'string(/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:filepath:obj:5"]/@flag)')" == "complete" ]
49
50 rmscip-shell system . . rm. -rf $tmpdir