Skip to content

Commit a033aef

Browse files
committed
Extend test_skip_paths
Extend test_skip_paths to test the "skip selected paths" feature also in the filehash58 probe.
1 parent 129a118 commit a033aef

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

tests/API/OVAL/skip_paths/test_skip_paths.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,12 @@ assert_exists 1 '/oval_results/results/system/definitions/definition[@definition
3030
assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:4" and @flag="does not exist"]'
3131
assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:textfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/b/y"]'
3232
assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:textfilecontent_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/c/z"]'
33+
assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:5" and @result="true"]'
34+
assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:5" and @flag="complete"]'
35+
assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:filehash58_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/a/x"]'
36+
assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:x:def:6" and @result="true"]'
37+
assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:6" and @flag="does not exist"]'
38+
assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:filehash58_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/b/y"]'
39+
assert_exists 0 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:filehash58_item/ind-sys:filepath[text()="/tmp/oscap_test_skip_paths/c/z"]'
3340
rm -f $result
3441
rm -rf "$root"

tests/API/OVAL/skip_paths/test_skip_paths.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@
2929
<criterion test_ref="oval:x:tst:4"/>
3030
</criteria>
3131
</definition>
32+
<definition class="compliance" version="1" id="oval:x:def:5">
33+
<metadata><title/><description/></metadata>
34+
<criteria operator="AND">
35+
<criterion test_ref="oval:x:tst:5"/>
36+
</criteria>
37+
</definition>
38+
<definition class="compliance" version="1" id="oval:x:def:6">
39+
<metadata><title/><description/></metadata>
40+
<criteria operator="AND">
41+
<criterion test_ref="oval:x:tst:6"/>
42+
</criteria>
43+
</definition>
3244
</definitions>
3345
<tests>
3446
<file_test xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix" check_existence="at_least_one_exists" version="1" id="oval:x:tst:1" check="all" comment="read file from directory 'a' - should be read">
@@ -43,6 +55,12 @@
4355
<textfilecontent54_test xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" check_existence="none_exist" version="1" id="oval:x:tst:4" check="all" comment="read file from directory 'b' - should be skip">
4456
<object object_ref="oval:x:obj:4"/>
4557
</textfilecontent54_test>
58+
<filehash58_test xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" check_existence="at_least_one_exists" version="1" id="oval:x:tst:5" check="all" comment="read file from directory 'a' - should be read">
59+
<object object_ref="oval:x:obj:5"/>
60+
</filehash58_test>
61+
<filehash58_test xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" check_existence="none_exist" version="1" id="oval:x:tst:6" check="all" comment="read file from directory 'b' - should be skip">
62+
<object object_ref="oval:x:obj:6"/>
63+
</filehash58_test>
4664
</tests>
4765
<objects>
4866
<file_object xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix" version="1" id="oval:x:obj:1">
@@ -61,5 +79,13 @@
6179
<pattern>^.*$</pattern>
6280
<instance datatype="int" operation="greater than or equal">1</instance>
6381
</textfilecontent54_object>
82+
<filehash58_object xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" version="1" id="oval:x:obj:5">
83+
<filepath>/tmp/oscap_test_skip_paths/a/x</filepath>
84+
<hash_type>SHA-512</hash_type>
85+
</filehash58_object>
86+
<filehash58_object xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" version="1" id="oval:x:obj:6">
87+
<filepath>/tmp/oscap_test_skip_paths/b/y</filepath>
88+
<hash_type>SHA-512</hash_type>
89+
</filehash58_object>
6490
</objects>
6591
</oval_definitions>

0 commit comments

Comments
 (0)