Make it possible to check that an implementation is supported at runtime (#1197)

* Make it possible to check that an implementation is supported at runtime.

* add CI fuzzing on arm 64 bit

This adds fuzzing on drone.io arm64

For some reason, leak detection had to be disabled. If it is enabled, the fuzzer falsely reports a crash at the end of fuzzing.

Closes: #1188

* Guarding the implementation accesses.

* Better doc.

* Updating cxxopts.

* Make it possible to check that an implementation is supported at runtime.

* Guarding the implementation accesses.

* Better doc.

* Updating cxxopts.

* We need to accomodate cxxopts

Co-authored-by: Paul Dreik <github@pauldreik.se>
This commit is contained in:
Daniel Lemire
2020-10-02 11:04:51 -04:00
committed by GitHub
parent e06ddea784
commit 9865bb6904
19 changed files with 159 additions and 25 deletions
+10 -2
View File
@@ -67,7 +67,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
// make this dynamic, so it works regardless of how it was compiled
// or what hardware it runs on
constexpr std::size_t Nimplementations_max=3;
const std::size_t Nimplementations=simdjson::available_implementations.size();
std::size_t Nimplementations = 0;
for(auto impl : simdjson::available_implementations) {
if(impl->supported_by_runtime_system()) {
Nimplementations++;
}
}
if(Nimplementations>Nimplementations_max) {
//there is another backend added, please bump Nimplementations_max!
std::abort();
@@ -78,7 +84,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
{
std::size_t i=0;
for(auto& e: simdjson::available_implementations) {
implementations[i++].impl=e;
if(e->supported_by_runtime_system()) {
implementations[i++].impl=e;
}
}
}