This is an archive of the discontinued Mercurial Phabricator instance.

tests: sniff for libfuzzer actually being available in test-fuzz-targets.t
ClosedPublic

Authored by durin42 on Nov 14 2018, 10:13 AM.

Details

Summary

When I upgraded the FreeBSD buildbot to 11.2 it seems we picked up
clang6, but the default clang on FreeBSD doesn't include libfuzzer. I
can't find a way to sniff for libfuzzer without running a compile, so
here we are.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durin42 created this revision.Nov 14 2018, 10:13 AM
yuja added a subscriber: yuja.Nov 17 2018, 9:30 PM

+ $ havefuzz() {
+ > cat > dummy.cc <<EOF

Missing includes of stdint.h and stddef.h (or stdlib.h).

+ > int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; }
+ > int main(int argc, char **argv) {
+ > const char data[] = "asdf";
+ > return LLVMFuzzerTestOneInput((const uint8_t *)data, 4);
+ > }
+ > EOF
+ > cat dummy.cc
+ > $CXX dummy.cc -fsanitize=fuzzer-no-link,address || return 1
+ > }
+
#if clang-libfuzzer
+ $ CXX=clang++ havefuzz || exit 80

This leaves dummy.cc in the fuzz directory. Perhaps, we should compile it
before cd.

durin42 updated this revision to Diff 12613.Nov 27 2018, 11:13 AM
yuja added a comment.Nov 28 2018, 6:30 AM

+ $ havefuzz() {
+ > cat > $TESTTMP/dummy.cc <<EOF
+ > #include <stdlib.h>
+ > int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; }

Still stdint.h is missing.

durin42 updated this revision to Diff 12616.Nov 28 2018, 12:54 PM
durin42 updated this revision to Diff 12658.Nov 29 2018, 4:39 PM
This revision was automatically updated to reflect the committed changes.