Skip to content

Commit 9a380b4

Browse files
committed
Improve SDS detect version test to cover future releases.
1 parent 4593a00 commit 9a380b4

File tree

4 files changed

+15
-58
lines changed

4 files changed

+15
-58
lines changed

tests/DS/sds_detect_version/Makefile.am

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ TESTS_ENVIRONMENT= \
99
TESTS = test_detect_version.sh
1010

1111
EXTRA_DIST = test_detect_version.sh \
12-
scap-1.2-ds.xml \
13-
scap-1.3-ds.xml
12+
scap-ds.xml

tests/DS/sds_detect_version/scap-1.2-ds.xml

Lines changed: 0 additions & 51 deletions
This file was deleted.

tests/DS/sds_detect_version/scap-1.3-ds.xml renamed to tests/DS/sds_detect_version/scap-ds.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
2-
<ns0:data-stream-collection xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:ns0="http://scap.nist.gov/schema/scap/source/1.2" xmlns:ns1="http://www.w3.org/1999/xlink" xmlns:ns10="http://checklists.nist.gov/xccdf/1.2" xmlns:ns13="http://cpe.mitre.org/dictionary/2.0" xmlns:ns2="urn:oasis:names:tc:entity:xmlns:xml:catalog" xmlns:ns3="http://scap.nist.gov/schema/ocil/2.0" xmlns:ns4="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:ns6="http://oval.mitre.org/XMLSchema/oval-common-5" xmlns:ns7="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" xmlns:ns8="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix" xmlns:ns9="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="scap_org.open-scap_collection_from_xccdf_ssg-rhel8-xccdf-1.2.xml" schematron-version="1.3">
3-
<ns0:data-stream id="scap_org.open-scap_datastream_from_xccdf_ssg-rhel8-xccdf-1.2.xml" scap-version="1.3" use-case="OTHER">
2+
<ns0:data-stream-collection xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:ns0="http://scap.nist.gov/schema/scap/source/1.2" xmlns:ns1="http://www.w3.org/1999/xlink" xmlns:ns10="http://checklists.nist.gov/xccdf/1.2" xmlns:ns13="http://cpe.mitre.org/dictionary/2.0" xmlns:ns2="urn:oasis:names:tc:entity:xmlns:xml:catalog" xmlns:ns3="http://scap.nist.gov/schema/ocil/2.0" xmlns:ns4="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:ns6="http://oval.mitre.org/XMLSchema/oval-common-5" xmlns:ns7="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" xmlns:ns8="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix" xmlns:ns9="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="scap_org.open-scap_collection_from_xccdf_ssg-rhel8-xccdf-1.2.xml" schematron-version="X.X">
3+
<ns0:data-stream id="scap_org.open-scap_datastream_from_xccdf_ssg-rhel8-xccdf-1.2.xml" scap-version="X.X" use-case="OTHER">
44
<ns0:checks>
55
<ns0:component-ref id="scap_org.open-scap_cref_ssg-rhel8-oval.xml" ns1:href="#scap_org.open-scap_comp_ssg-rhel8-oval.xml"/>
66
</ns0:checks>

tests/DS/sds_detect_version/test_detect_version.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,21 @@ function test_oscap_info {
1616
version="$1"
1717
stdout="$(mktemp)"
1818
stderr="$(mktemp)"
19-
$OSCAP info $srcdir/scap-$version-ds.xml > $stdout 2> $stderr
19+
ds="$(mktemp)"
20+
cp scap-ds.xml $ds
21+
sed -i "s/X.X/${version}/g" $ds
22+
23+
$OSCAP info $ds > $stdout 2> $stderr
2024
[ ! -s $stderr ]
2125
grep -q "Version: $version" $stdout
2226
rm $stdout
2327
rm $stderr
28+
rm $ds
2429
}
2530

26-
test_oscap_info "1.2"
27-
test_oscap_info "1.3"
31+
SDS=$(find $builddir/schemas/sds -maxdepth 1 -mindepth 1 -type d -printf '%f\n')
32+
33+
for sds_version in $SDS
34+
do
35+
test_oscap_info $sds_version
36+
done

0 commit comments

Comments
 (0)