Commit Graph

4 Commits

Author SHA1 Message Date
Roland Levillain f596dec176 Rename native code coverage paths env. variable in libsnapshot's fuzz test.
Rename `COVERAGE_PATHS` as `NATIVE_COVERAGE_PATHS`.

Test: n/a
Bug: 158212027
Change-Id: Ifea90488c1350a5f46d3065f2ec786ee93c3aae7
2020-06-10 13:04:53 +01:00
Yifan Hong b2e939599a libsnapshot_fuzzer: add initial corpus
Transform some of the tests in vts_libsnapshot_test
to corpus and use them as initial corpus to
libsnapshot_fuzzer.

The corpus alone gives us 50% of line coverage in snapshot.cpp.

Test: run it
Bug: 154633114
Change-Id: I8f3bf1d76ef64d710224e24c913990692481b65e
2020-05-06 17:10:34 -07:00
Yifan Hong 90a9393ea0 libsnapshot_fuzzer: use protobuf
Use protobuf because it already has all the fuzzing implemenetations.
Delete fuzz_utils.

Pros:
- Fuzzing protobuf is faster; it is easy to achieve 4K exec/s
- It is more guided; protobufs are fuzzed using mutators, and mutators
  should have better knowledge of the structure of the fuzz data
- No more hand-written parsing code of the fuzz data. That code in
  fuzz_utils.h is deleted.
- Corpus data can be reused even after adding new fields in the protobuf
- Corpus data is human-readable and easily manually written (it is
  the text format of the protobuf)

Cons:
- The "actions" are "declared" in protobuf definition and "defined" in
  C++, so there's more boilerplate to write. Adding a new "Action"
  requires changes in both.

Test: run libsnapshot_fuzzer
Bug: 154633114
Change-Id: Idc2a6b2c087e370e4cfef53142a244b9b275389e
2020-04-30 23:05:36 -07:00
Yifan Hong 1b0893ea5e Add fuzz test for libsnapshot
Bug: 154633114
Test: source fuzz.sh && run_snapshot_fuzz_all -runs=100000

Change-Id: I5cd9e3f088ca283d3a49959c38aa74a483931f2c
2020-04-27 12:37:40 -07:00