Debian Codegraph @

tests/API/OVAL/unittests/test_filecontent_line.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2 . $builddir/tests/test_common.sh
3
4 set -e -o pipefail
5
6 name=$(basename $0 .sh)
7 result=$(mktemp ${name}.out.XXXXXX)
8 echo "result file: $result"
9 stderr=$(mktemp ${name}.err.XXXXXX)
10 echo "stderr file: $stderr"
11
12 echo "Analysing syschar content."
13 $OSCAP oval analyse --results $result $srcdir/$name.oval.xml $srcdir/$name.syschar.xml 2> $stderr
14 [ -f $stderr ]; [ ! -s $stderr ]; rm $stderr
15 [ -f $result ]
16
17 assert_exists 1 '/oval_results'
18 assert_exists 1 '/oval_results/generator'
19 assert_exists 1 '/oval_results/generator/oval:product_name'
20 assert_exists 1 '/oval_results/generator/oval:product_name[text()="cpe:/a:open-scap:oscap"]'
21 assert_exists 1 '/oval_results/generator/oval:schema_version'
22 assert_exists 1 '/oval_results/generator/oval:schema_version[text()="5.8"]'
23 assert_exists 1 '/oval_results/generator/oval:timestamp'
24 assert_exists 1 '/oval_results/directives'
25 assert_exists 1 '/oval_results/oval_definitions'
26 assert_exists 1 '/oval_results/results'
27 assert_exists 1 '/oval_results/results/system'
28 assert_exists 1 '/oval_results/results/system/definitions'
29 assert_exists 2 '/oval_results/results/system/definitions/definition'
30 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1"]'
31 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1"][@result="false"]'
32 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1"]/criteria'
33 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1"]/criteria/criterion'
34 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:1"]/criteria/criterion[@result="false"]'
35 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2"]'
36 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2"][@result="true"]'
37 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2"]/criteria'
38 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2"]/criteria/criterion'
39 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:2"]/criteria/criterion[@result="true"]'
40 assert_exists 1 '/oval_results/results/system/tests'
41 assert_exists 2 '/oval_results/results/system/tests/test'
42 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]'
43 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"][@result="false"]'
44 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"][@check="none satisfy"]'
45 assert_exists 3 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/*'
46 assert_exists 3 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_item'
47 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_item[@result="true"]'
48 assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:1"]/tested_item[@result="false"]'
49 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]'
50 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"][@result="true"]'
51 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"][@check="only one"]'
52 assert_exists 3 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/*'
53 assert_exists 3 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_item'
54 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_item[@result="true"]'
55 assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:x:tst:2"]/tested_item[@result="false"]'
56
57 rm $result