Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit check_rdf_scan so that SPDX rdf tests don't automatically pass #3448 #3451

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The following organizations or individuals have contributed to ScanCode:
- Alex Blekhman @a-tinsmith
- Alexander Gschrei @agschrei
- Armijn Hemmel @armijnhemel
- Armin Tänzer @armintaenzertng
- Arnaud Jeansen @ajeans
- Arnav Mandal @arnav-mandal1234
- Aryan Kenchappagol @aryanxk02
Expand Down
24 changes: 22 additions & 2 deletions tests/formattedcode/data/spdx/license_known/expected.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "2b8b815229aa8a61e483fb4ba0588b8b6c491890",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/apache-2.0.LICENSE",
Expand All @@ -80,14 +80,34 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "172444e7c137eb5cd3cae530aca0879c90f7fada",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/cc0-1.0.LICENSE",
"@rdf:about": "http://www.spdx.org/files#SPDXRef-3"
}
}
],
"ns1:relationship": [
{
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-2"
}
},
{
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-3"
}
}
],
"@rdf:about": "http://www.spdx.org/tools#SPDXRef-DOCUMENT",
"ns1:specVersion": "SPDX-2.2"
},
Expand Down
24 changes: 22 additions & 2 deletions tests/formattedcode/data/spdx/license_known/expected_with_text.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "2b8b815229aa8a61e483fb4ba0588b8b6c491890",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/apache-2.0.LICENSE",
Expand All @@ -80,14 +80,34 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "172444e7c137eb5cd3cae530aca0879c90f7fada",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/cc0-1.0.LICENSE",
"@rdf:about": "http://www.spdx.org/files#SPDXRef-3"
}
}
],
"ns1:relationship": [
{
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-2"
}
},
{
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-3"
}
}
],
"@rdf:about": "http://www.spdx.org/tools#SPDXRef-DOCUMENT",
"ns1:specVersion": "SPDX-2.2"
},
Expand Down
13 changes: 11 additions & 2 deletions tests/formattedcode/data/spdx/license_ref/expected.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
],
"ns1:checksum": {
"ns1:Checksum": {
"ns1:algorithm": "SHA1",
"ns1:checksumValue": "f9c28fa2714ad0c2e36d3e5561afb0031fa76831"
"ns1:checksumValue": "f9c28fa2714ad0c2e36d3e5561afb0031fa76831",
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/NOTICE",
Expand Down Expand Up @@ -109,6 +109,15 @@
"ns1:name": "scan"
}
},
"ns1:relationship": {
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-2"
}
},
"ns1:hasExtractedLicensingInfo": [
{
"ns1:ExtractedLicensingInfo": {
Expand Down
13 changes: 11 additions & 2 deletions tests/formattedcode/data/spdx/license_ref/expected_with_text.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
],
"ns1:checksum": {
"ns1:Checksum": {
"ns1:algorithm": "SHA1",
"ns1:checksumValue": "f9c28fa2714ad0c2e36d3e5561afb0031fa76831"
"ns1:checksumValue": "f9c28fa2714ad0c2e36d3e5561afb0031fa76831",
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/NOTICE",
Expand Down Expand Up @@ -109,6 +109,15 @@
"ns1:name": "scan"
}
},
"ns1:relationship": {
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-2"
}
},
"ns1:hasExtractedLicensingInfo": [
{
"ns1:ExtractedLicensingInfo": {
Expand Down
11 changes: 10 additions & 1 deletion tests/formattedcode/data/spdx/or_later/expected.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "0c5bf934430394112921e7a1a8128176606d32ca",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./test.java",
Expand Down Expand Up @@ -51,6 +51,15 @@
"ns1:name": "or_later"
}
},
"ns1:relationship": {
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-1"
}
},
"@rdf:about": "http://www.spdx.org/tools#SPDXRef-DOCUMENT",
"ns1:specVersion": "SPDX-2.2"
},
Expand Down
81 changes: 73 additions & 8 deletions tests/formattedcode/data/spdx/tree/expected.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "3922760d8492eb8f853c10a627f5a73f9eaec6ff",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/copy1.c",
Expand All @@ -83,7 +83,7 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "3922760d8492eb8f853c10a627f5a73f9eaec6ff",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/copy2.c",
Expand All @@ -101,8 +101,8 @@
},
"ns1:checksum": {
"ns1:Checksum": {
"ns1:algorithm": "SHA1",
"ns1:checksumValue": "c91811eb5fdc7ab440355f9f8d1580e1518b0c2f"
"ns1:checksumValue": "c91811eb5fdc7ab440355f9f8d1580e1518b0c2f",
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/copy3.c",
Expand All @@ -121,7 +121,7 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "3922760d8492eb8f853c10a627f5a73f9eaec6ff",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/subdir/copy1.c",
Expand All @@ -140,7 +140,7 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "3922760d8492eb8f853c10a627f5a73f9eaec6ff",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/subdir/copy2.c",
Expand All @@ -159,7 +159,7 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "389af7e629a9853056e42b262d5e30bf4579a74f",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/subdir/copy3.c",
Expand All @@ -178,7 +178,7 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "58748872d25374160692f1ed7075d0fe80a544b1",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:fileName": "./scan/subdir/copy4.c",
Expand All @@ -187,6 +187,71 @@
}
}
],
"ns1:relationship": [
{
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-2"
}
},
{
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-3"
}
},
{
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-4"
}
},
{
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-6"
}
},
{
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-7"
}
},
{
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-8"
}
},
{
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-9"
}
}
],
"@rdf:about": "http://www.spdx.org/tools#SPDXRef-DOCUMENT",
"ns1:specVersion": "SPDX-2.2"
},
Expand Down
11 changes: 10 additions & 1 deletion tests/formattedcode/data/spdx/unicode/expected.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"ns1:checksum": {
"ns1:Checksum": {
"ns1:checksumValue": "3903b654c47ea95203567230d72093ad1c5c4b90",
"ns1:algorithm": "SHA1"
"ns1:algorithm": "http://spdx.org/rdf/terms#checksumAlgorithm_sha1"
}
},
"ns1:licenseInfoInFile": {
Expand Down Expand Up @@ -69,6 +69,15 @@
"ns1:name": "unicode"
}
},
"ns1:relationship": {
"ns1:Relationship": {
"ns1:relationshipType": {
"@rdf:resource": "http://spdx.org/rdf/terms#relationshipType_contains"
},
"ns1:spdxElementId": "SPDXRef-001",
"ns1:relatedSpdxElement": "SPDXRef-1"
}
},
"@rdf:about": "http://www.spdx.org/tools#SPDXRef-DOCUMENT",
"ns1:specVersion": "SPDX-2.2"
},
Expand Down
1 change: 0 additions & 1 deletion tests/formattedcode/test_output_spdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def check_rdf_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES):
else:
with io.open(expected_file, encoding='utf-8') as i:
expected = json.load(i)
AyanSinhaMahapatra marked this conversation as resolved.
Show resolved Hide resolved
expected = load_and_clean_rdf(result_file)

assert json.dumps(result, indent=2) == json.dumps(expected, indent=2)

Expand Down