forked from microsoft/winget-cli
-
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.
Revert "Delete unneeded test code from libraries pulled as subtrees (m…
…icrosoft#2232)" This reverts commit 8b07a0e.
- Loading branch information
1 parent
0c8ec54
commit 5387c89
Showing
252 changed files
with
24,981 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
src/Valijson/valijson/tests/data/documents/array_doubles_10_20_30_40.json
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 @@ | ||
[10.0, 20.0, 30.0, 40.0] |
1 change: 1 addition & 0 deletions
1
src/Valijson/valijson/tests/data/documents/array_doubles_1_2_3.json
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 @@ | ||
[1.0, 2.0, 3.0] |
1 change: 1 addition & 0 deletions
1
src/Valijson/valijson/tests/data/documents/array_doubles_1_2_3_4.json
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 @@ | ||
[1.0, 2.0, 3.0, 4.0] |
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 @@ | ||
[] |
1 change: 1 addition & 0 deletions
1
src/Valijson/valijson/tests/data/documents/array_integers_10_20_30_40.json
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 @@ | ||
[10, 20, 30, 40] |
1 change: 1 addition & 0 deletions
1
src/Valijson/valijson/tests/data/documents/array_integers_1_2_3.json
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 @@ | ||
[1, 2, 3] |
1 change: 1 addition & 0 deletions
1
src/Valijson/valijson/tests/data/documents/array_integers_1_2_3_4.json
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 @@ | ||
[1, 2, 3, 4] |
1 change: 1 addition & 0 deletions
1
src/Valijson/valijson/tests/data/documents/array_strings_10_20_30_40.json
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 @@ | ||
["10", "20", "30", "40"] |
1 change: 1 addition & 0 deletions
1
src/Valijson/valijson/tests/data/documents/array_strings_1_2_3.json
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 @@ | ||
["1", "2", "3"] |
1 change: 1 addition & 0 deletions
1
src/Valijson/valijson/tests/data/documents/array_strings_1_2_3_4.json
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 @@ | ||
["1", "2", "3", "4"] |
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 @@ | ||
{} |
20 changes: 20 additions & 0 deletions
20
src/Valijson/valijson/tests/data/schemas/allof_integers_and_numbers.schema.json
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,20 @@ | ||
{ | ||
"comment": "Document must contain an array of integers, all unique.", | ||
"allOf": [ | ||
{ | ||
"items": { | ||
"type": "integer" | ||
}, | ||
"additionalItems": false, | ||
"type": "array" | ||
}, | ||
{ | ||
"items": { | ||
"type": "number" | ||
}, | ||
"additionalItems": false, | ||
"type": "array", | ||
"uniqueItems": true | ||
} | ||
] | ||
} |
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,43 @@ | ||
#include <stdexcept> | ||
#include <unistd.h> | ||
|
||
#include <document.h> | ||
#include <valijson/adapters/rapidjson_adapter.hpp> | ||
#include <valijson/utils/rapidjson_utils.hpp> | ||
#include <valijson/schema.hpp> | ||
#include <valijson/schema_parser.hpp> | ||
|
||
using valijson::Schema; | ||
using valijson::SchemaParser; | ||
using valijson::adapters::RapidJsonAdapter; | ||
|
||
extern "C" int | ||
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) | ||
{ | ||
if(size<3) return 0; | ||
char input_file[256]; | ||
sprintf(input_file, "/tmp/libfuzzer.json"); | ||
FILE *fp = fopen(input_file, "wb"); | ||
if (!fp) | ||
return 0; | ||
fwrite(data, size, 1, fp); | ||
fclose(fp); | ||
|
||
rapidjson::Document schemaDocument; | ||
if (!valijson::utils::loadDocument(input_file, schemaDocument)) { | ||
return 1; | ||
} | ||
|
||
Schema schema; | ||
SchemaParser parser; | ||
RapidJsonAdapter schemaDocumentAdapter(schemaDocument); | ||
try { | ||
parser.populateSchema(schemaDocumentAdapter, schema); | ||
} catch (std::exception &e) { | ||
unlink(input_file); | ||
return 1; | ||
} | ||
|
||
unlink(input_file); | ||
return 1; | ||
} |
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,32 @@ | ||
#!/bin/bash -eu | ||
|
||
# This line causes an abort which breaks fuzzing: | ||
sed -i '27d' include/valijson/utils/rapidjson_utils.hpp | ||
|
||
mkdir build | ||
cd build | ||
cmake -Dvalijson_BUILD_EXAMPLES=FALSE \ | ||
-Dvalijson_EXCLUDE_BOOST=TRUE \ | ||
.. | ||
|
||
make -j$(nproc) | ||
|
||
cd ../tests/fuzzing | ||
|
||
find ../.. -name "*.o" -exec ar rcs fuzz_lib.a {} \; | ||
|
||
$CXX $CXXFLAGS -DVALIJSON_USE_EXCEPTIONS=1 \ | ||
-I/src/valijson/thirdparty/rapidjson-48fbd8c/include \ | ||
-I/src/valijson/thirdparty/rapidjson-48fbd8c/include/rapidjson \ | ||
-I/src/valijson/include \ | ||
-I/src/valijson/include/valijson \ | ||
-I/src/valijson/include/valijson/adapters \ | ||
-c fuzzer.cpp -o fuzzer.o | ||
|
||
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE \ | ||
-DVALIJSON_USE_EXCEPTIONS=1 \ | ||
-rdynamic fuzzer.o \ | ||
-o $OUT/fuzzer fuzz_lib.a | ||
|
||
zip $OUT/fuzzer_seed_corpus.zip \ | ||
$SRC/valijson/doc/schema/draft-03.json |
Oops, something went wrong.