Skip to content

Commit 3d98544

Browse files
committed
Move list_rules/list_vars tests to tests/oscap_info_profiles
These tests are for oscap info --list-rules and --list-vars options, not XCCDF unit tests, so they belong in their own test directory. Data files used only by these tests are moved; test_reference_ds.xml is copied since it is also used by test_reference.sh in unittests.
1 parent 5d70f88 commit 3d98544

9 files changed

Lines changed: 122 additions & 2 deletions

tests/API/XCCDF/unittests/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,5 @@ add_oscap_test("test_skip_rule.sh")
113113
add_oscap_test("test_no_newline_between_select_elements.sh")
114114
add_oscap_test("test_single_line_tailoring.sh")
115115
add_oscap_test("test_reference.sh")
116-
add_oscap_test("test_list_rules.sh")
117-
add_oscap_test("test_list_vars.sh")
118116
add_oscap_test("test_remediation_bootc.sh")
119117
add_oscap_test("openscap_2289_regression.sh")

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ add_subdirectory("CPE")
3131
add_subdirectory("DS")
3232
add_subdirectory("mitre")
3333
add_subdirectory("nist")
34+
add_subdirectory("oscap_info_profiles")
3435
add_subdirectory("oscap_string")
3536
add_subdirectory("oval_details")
3637
add_subdirectory("probe_behavior")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_oscap_test("test_list_rules.sh")
2+
add_oscap_test("test_list_vars.sh")
File renamed without changes.
File renamed without changes.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ds:data-stream-collection xmlns:ds="http://scap.nist.gov/schema/scap/source/1.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cat="urn:oasis:names:tc:entity:xmlns:xml:catalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="scap_org.open-scap_collection_from_xccdf_test_single_rule.xccdf.xml" schematron-version="1.3" xsi:schemaLocation="http://scap.nist.gov/schema/scap/source/1.2 https://scap.nist.gov/schema/scap/1.3/scap-source-data-stream_1.3.xsd">
3+
<ds:data-stream id="scap_org.open-scap_datastream_simple" scap-version="1.3" use-case="OTHER">
4+
<ds:checklists>
5+
<ds:component-ref id="scap_org.open-scap_cref_test_single_rule.xccdf.xml" xlink:href="#scap_org.open-scap_comp_test_single_rule.xccdf.xml">
6+
<cat:catalog>
7+
<cat:uri name="test_single_rule.oval.xml" uri="#scap_org.open-scap_cref_test_single_rule.oval.xml"/>
8+
</cat:catalog>
9+
</ds:component-ref>
10+
</ds:checklists>
11+
<ds:checks>
12+
<ds:component-ref id="scap_org.open-scap_cref_test_single_rule.oval.xml" xlink:href="#scap_org.open-scap_comp_test_single_rule.oval.xml"/>
13+
</ds:checks>
14+
</ds:data-stream>
15+
<ds:component id="scap_org.open-scap_comp_test_single_rule.oval.xml" timestamp="2021-02-01T08:07:06+01:00">
16+
<oval_definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:ind-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" xmlns:oval-def="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:oval="http://oval.mitre.org/XMLSchema/oval-common-5" xmlns:win-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#windows" xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval-definitions-5 oval-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#independent independent-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#windows windows-definitions-schema.xsd">
17+
<generator>
18+
<oval:schema_version>5.11.2</oval:schema_version>
19+
<oval:timestamp>2021-02-01T08:07:06+01:00</oval:timestamp>
20+
</generator>
21+
<definitions>
22+
<definition class="compliance" id="oval:x:def:1" version="1">
23+
<metadata>
24+
<title>PASS</title>
25+
<description>pass</description>
26+
</metadata>
27+
<criteria>
28+
<criterion comment="PASS test" test_ref="oval:x:tst:1"/>
29+
</criteria>
30+
</definition>
31+
</definitions>
32+
<tests>
33+
<variable_test xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" id="oval:x:tst:1" check="all" comment="always pass" version="1">
34+
<object object_ref="oval:x:obj:1"/>
35+
</variable_test>
36+
</tests>
37+
<objects>
38+
<variable_object xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" id="oval:x:obj:1" version="1" comment="x">
39+
<var_ref>oval:x:var:1</var_ref>
40+
</variable_object>
41+
</objects>
42+
<variables>
43+
<constant_variable id="oval:x:var:1" version="1" comment="x" datatype="int">
44+
<value>100</value>
45+
</constant_variable>
46+
</variables>
47+
</oval_definitions>
48+
</ds:component>
49+
<ds:component id="scap_org.open-scap_comp_test_single_rule.xccdf.xml" timestamp="2021-02-01T08:07:06+01:00">
50+
<Benchmark xmlns="http://checklists.nist.gov/xccdf/1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="xccdf_com.example.www_benchmark_dummy" xsi:schemaLocation="http://checklists.nist.gov/xccdf/1.1 xccdf-1.1.4.xsd" resolved="false" xml:lang="en-US">
51+
<status date="2021-01-21">accepted</status>
52+
<title>Test Benchmark</title>
53+
<description>Description</description>
54+
<reference href="https://www.animals.com">animals</reference>
55+
<reference href="https://www.fruit.com">fruit</reference>
56+
<version>1.0</version>
57+
<metadata>
58+
<dc:contributor xmlns:dc="http://purl.org/dc/elements/1.1/">OpenSCAP</dc:contributor>
59+
<dc:publisher xmlns:dc="http://purl.org/dc/elements/1.1/">OpenSCAP</dc:publisher>
60+
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">OpenSCAP</dc:creator>
61+
<dc:source xmlns:dc="http://purl.org/dc/elements/1.1/">http://scap.nist.gov</dc:source>
62+
</metadata>
63+
<Profile id="xccdf_com.example.www_profile_P1">
64+
<title>xccdf_test_profile</title>
65+
<description>This profile is for testing.</description>
66+
<select idref="xccdf_com.example.www_rule_R1" selected="true"/>
67+
<select idref="xccdf_com.example.www_rule_R2" selected="true"/>
68+
<select idref="xccdf_com.example.www_rule_R3" selected="true"/>
69+
<select idref="xccdf_com.example.www_rule_R4" selected="true"/>
70+
<set-value idref="xccdf_com.example.www_value_V1">42</set-value>
71+
<refine-value idref="xccdf_com.example.www_value_V2" selector="custom"/>
72+
</Profile>
73+
<Value id="xccdf_com.example.www_value_V1" type="number">
74+
<title>Value V1</title>
75+
<value>10</value>
76+
<value selector="twenty">20</value>
77+
</Value>
78+
<Value id="xccdf_com.example.www_value_V2" type="string">
79+
<title>Value V2</title>
80+
<value>default_val</value>
81+
<value selector="custom">custom_val</value>
82+
</Value>
83+
<Rule selected="true" id="xccdf_com.example.www_rule_R1">
84+
<title>Rule R1</title>
85+
<description>Description</description>
86+
<reference href="https://www.animals.com">3.14</reference>
87+
<reference href="https://www.fruit.com">42.42</reference>
88+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5">
89+
<check-content-ref href="test_single_rule.oval.xml" name="oval:x:def:1"/>
90+
</check>
91+
</Rule>
92+
<Rule selected="true" id="xccdf_com.example.www_rule_R2">
93+
<title>Rule R2</title>
94+
<description>Description</description>
95+
<reference href="https://www.animals.com">17.71.777</reference>
96+
<reference href="https://www.fruit.com">88888888</reference>
97+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5">
98+
<check-content-ref href="test_single_rule.oval.xml" name="oval:x:def:1"/>
99+
</check>
100+
</Rule>
101+
<Rule selected="true" id="xccdf_com.example.www_rule_R3">
102+
<title>Rule R3</title>
103+
<description>Description</description>
104+
<reference href="https://www.animals.com">17.71.777</reference>
105+
<reference href="https://www.fruit.com">666</reference>
106+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5">
107+
<check-content-ref href="test_single_rule.oval.xml" name="oval:x:def:1"/>
108+
</check>
109+
</Rule>
110+
<Rule selected="true" id="xccdf_com.example.www_rule_R4">
111+
<title>Rule R4</title>
112+
<description>Description</description>
113+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5">
114+
<check-content-ref href="test_single_rule.oval.xml" name="oval:x:def:1"/>
115+
</check>
116+
</Rule>
117+
</Benchmark>
118+
</ds:component>
119+
</ds:data-stream-collection>

tests/API/XCCDF/unittests/test_reference_ds_with_tailoring.xml renamed to tests/oscap_info_profiles/test_reference_ds_with_tailoring.xml

File renamed without changes.

tests/API/XCCDF/unittests/test_tailoring_benchmark.xml renamed to tests/oscap_info_profiles/test_tailoring_benchmark.xml

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)