[glib: 1/3] fuzzing: Add unit tests to check fuzzers




commit fa5947d3e7e2c6f5010e39265d22c44b8e4b6793
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu May 5 14:06:08 2022 +0100

    fuzzing: Add unit tests to check fuzzers
    
    Test the fuzzers with one arbitrary input each, to ensure that they work
    at a very basic level.
    
    This should catch regressions in each of the fuzzers without having to
    wait for them to be picked up by oss-fuzz.
    
    These tests can be run using `meson test --suite fuzzing`.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 fuzzing/meson.build | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/fuzzing/meson.build b/fuzzing/meson.build
index 259c6d91d0..d69381c631 100644
--- a/fuzzing/meson.build
+++ b/fuzzing/meson.build
@@ -38,4 +38,14 @@ foreach target_name : fuzz_targets
     c_args : extra_c_args,
     dependencies : deps,
   )
+
+  # If the FuzzingEngine isn’t available, build some unit tests to check that
+  # the fuzzing files do basically work. This doesn’t do any actual fuzzing though.
+  # Pass in the README as an arbitrary fuzzing input, just so we have something.
+  if not fuzzing_engine.found()
+    test(target_name, exe,
+      args : files('README.md'),
+      suite : 'fuzzing',
+    )
+  endif
 endforeach


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]