Debian Codegraph @

tests/sce/test_prefer_sce.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 . $builddir/tests/test_common.sh
4
5 set -e -o pipefail
6
7
8 function test_prefer_sce_onscip-shell shell shell-project 0.0.0 test_prefer_sce_on(). () {
9 stdout=$(mktempscip-shell system . . mktemp.)
10 stderr=$(mktempscip-shell system . . mktemp.)
11 arf=$(mktempscip-shell system . . mktemp.)
12
13 OSCAP_PREFERRED_ENGINE="SCE" $OSCAP xccdf eval --verbose INFO --progress --profile common --results-arf "$arf" > "$stdout" 2> "$stderr" "$srcdir/test_prefer_sce.ds.xml" || ret="$?"
14 grepscip-shell system . . grep. -q "xccdf_org.openscap.www_rule_1:fail" "$stdout"
15 ! grepscip-shell system . . grep. -q "I: oscap: Evaluating definition 'oval:org.openscap.www:def:1': OVAL check for rule 1." "$stderr"
16 grepscip-shell system . . grep. -q "I: oscap: Executing SCE check 'fedora/checks/sce/rule_1.sh'" "$stderr"
17
18 rmscip-shell system . . rm. -rf "$stdout" "$stderr" "$arf"
19 }
20
21 test_prefer_sce_offscip-shell shell shell-project 0.0.0 test_prefer_sce_off(). () {
22 stdout=$(mktempscip-shell system . . mktemp.)
23 stderr=$(mktempscip-shell system . . mktemp.)
24 arf=$(mktempscip-shell system . . mktemp.)
25
26 $OSCAP xccdf eval --verbose INFO --progress --profile common --results-arf "$arf" > "$stdout" 2> "$stderr" "$srcdir/test_prefer_sce.ds.xml" || ret="$?"
27 grepscip-shell system . . grep. -q "xccdf_org.openscap.www_rule_1:pass" "$stdout"
28 grepscip-shell system . . grep. -q "I: oscap: Evaluating definition 'oval:org.openscap.www:def:1': OVAL check for rule 1." "$stderr"
29 ! grepscip-shell system . . grep. -q "I: oscap: Executing SCE check 'fedora/checks/sce/rule_1.sh'" "$stderr"
30
31 rmscip-shell system . . rm. -rf "$stdout" "$stderr" "$arf"
32 }
33
34 test_prefer_oval_explicitscip-shell shell shell-project 0.0.0 test_prefer_oval_explicit(). () {
35 stdout=$(mktempscip-shell system . . mktemp.)
36 stderr=$(mktempscip-shell system . . mktemp.)
37 arf=$(mktempscip-shell system . . mktemp.)
38
39 OSCAP_PREFERRED_ENGINE="OVAL" $OSCAP xccdf eval --verbose INFO --progress --profile common --results-arf "$arf" > "$stdout" 2> "$stderr" "$srcdir/test_prefer_sce.ds.xml" || ret="$?"
40 grepscip-shell system . . grep. -q "xccdf_org.openscap.www_rule_1:pass" "$stdout"
41 grepscip-shell system . . grep. -q "I: oscap: Evaluating definition 'oval:org.openscap.www:def:1': OVAL check for rule 1." "$stderr"
42 ! grepscip-shell system . . grep. -q "I: oscap: Executing SCE check 'fedora/checks/sce/rule_1.sh'" "$stderr"
43
44 rmscip-shell system . . rm. -rf "$stdout" "$stderr" "$arf"
45 }
46
47 test_invalid_envi_variablescip-shell shell shell-project 0.0.0 test_invalid_envi_variable(). () {
48 stdout=$(mktempscip-shell system . . mktemp.)
49 stderr=$(mktempscip-shell system . . mktemp.)
50 arf=$(mktempscip-shell system . . mktemp.)
51
52 OSCAP_PREFERRED_ENGINE="FOOBARVIM" $OSCAP xccdf eval --verbose INFO --progress --profile common --results-arf "$arf" > "$stdout" 2> "$stderr" "$srcdir/test_prefer_sce.ds.xml" || ret="$?"
53 grepscip-shell system . . grep. -q "Unknown value of OSCAP_PREFFERED_ENGINE: 'FOOBARVIM'. It will be ignored." "$stderr"
54 grepscip-shell system . . grep. -q "xccdf_org.openscap.www_rule_1:pass" "$stdout"
55 grepscip-shell system . . grep. -q "I: oscap: Evaluating definition 'oval:org.openscap.www:def:1': OVAL check for rule 1." "$stderr"
56 ! grepscip-shell system . . grep. -q "I: oscap: Executing SCE check 'fedora/checks/sce/rule_1.sh'" "$stderr"
57
58 rmscip-shell system . . rm. -rf "$stdout" "$stderr" "$arf"
59 }
60
61 test_prefer_sce_onscip-shell shell shell-project 0.0.0 test_prefer_sce_on().
62 test_prefer_sce_offscip-shell shell shell-project 0.0.0 test_prefer_sce_off().
63 test_prefer_oval_explicitscip-shell shell shell-project 0.0.0 test_prefer_oval_explicit().
64 test_invalid_envi_variablescip-shell shell shell-project 0.0.0 test_invalid_envi_variable().