forked from oasis-tcs/csaf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- addresses parts of oasis-tcs#693 - add new local test cases - adopt test script
- Loading branch information
1 parent
61e78c8
commit 1cfd26f
Showing
6 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PREFIXcpe:/o:redhat:rhel_aus:7.6::server | ||
cpe:/o:redhat:rhel_aus:7.6::server::SUFFIX | ||
PREFIXcpe:2.3:a:admin_management_xtended_project:admin_management_xtended:0.8:*:*:*:*:wordpress:*:* | ||
cpe:2.3:a:admin_management_xtended_project:admin_management_xtended:0.8:*:*:*:*:wordpress:*:*" | ||
cpe:2.3:a:admin_management_xtended_project:admin_management_xtended:0.8:*:*:*:*:wordpress:*:** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cpe:2.3:a:admin_management_xtended_project:admin_management_xtended:0.8:*:*:*:*:wordpress:*:*other* | ||
cpe:2.3:a:admin_management_xtended_project:admin_management_xtended:0.8:*:*:*:*:wordpress:*:*other???? | ||
cpe:/o:redhat:rhel_aus:7.6::server |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
SCHEMA=csaf_2.1/json_schema/csaf_json_schema.json | ||
VALIDATOR=csaf_2.1/test/cpe/test-regex.js | ||
DATA_VALID=csaf_2.1/test/cpe/data/valid/cpe.txt | ||
DATA_INVALID=csaf_2.1/test/cpe/data/invalid/cpe.txt | ||
|
||
FAIL=0 | ||
|
||
# go to root of git repository | ||
cd "$(dirname "$0")"/../../.. || exit | ||
|
||
|
||
validate() { | ||
printf "Testing file %s against cpe regex from %s ... \n" "$1" "$SCHEMA" | ||
if node "$VALIDATOR" "$SCHEMA" "$1" "$2"; then | ||
printf "SUCCESS\n" | ||
else | ||
printf "FAILED\n" | ||
FAIL=1 | ||
fi | ||
|
||
} | ||
|
||
echo -n "Test conforming (not necessary existing) CPEs... " | ||
DATA=$DATA_VALID | ||
validate $DATA true | ||
printf "done\n" | ||
|
||
echo -n "Test non-conforming CPEs... " | ||
DATA=$DATA_INVALID | ||
validate $DATA false | ||
printf "done\n" | ||
|
||
|
||
exit $FAIL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters