This is an archive of the discontinued LLVM Phabricator instance.

[libFuzzer] Fix lit files to make running tests more straightforward on Mac OS.
ClosedPublic

Authored by Dor1s on Sep 11 2017, 4:25 PM.

Details

Summary

Current implementation does not work if CMAKE_OSX_SYSROOT is not specified.

It silently generates invalid command with the following flags:

-std=c++11 -lc++ -gline-tables-only -isysroot -fsanitize=address,fuzzer

and then fails with the following error:

warning: no such sysroot directory: '-fsanitize=address,fuzzer' [-Wmissing-sysroot]"
<...>/RepeatedBytesTest.cpp:5:10: fatal error: 'assert.h' file not found
#include <assert.h>
         ^~~~~~~~~~
1 error generated.

However, if you have Command Line Tools installed, you have '/usr/include' dir.
In that case, it is not necessary to specify isysroot path.

Also, with the patch, in case of '/usr/include' does not exist, the '-sysroot'
path would be resolved automatically in compiler-rt/cmake/base-config-ix.cmake.

For more context, see the comment at compiler-rt/cmake/base-config-ix.cmake#L76

Event Timeline

Dor1s created this revision.Sep 11 2017, 4:25 PM
george.karpenkov accepted this revision.Sep 11 2017, 4:29 PM

LGTM assuming tests pass on OS X and Linux.
You're right, I did hit an error with an empty -isysroot on our buildbot before as well.

This revision is now accepted and ready to land.Sep 11 2017, 4:29 PM

@Dor1s btw for full context instead of linking to the file you can just do git diff -U999.

kcc accepted this revision.Sep 11 2017, 6:06 PM

LGTM

@Dor1s btw for full context instead of linking to the file you can just do git diff -U999.

Better just use 'arc'

Dor1s added a comment.Sep 11 2017, 6:14 PM

Thanks for the review. I'll verify that tests on Linux are not broken and commit it tomorrow. On Mac OS tests are passing fine.

I'm using arc. Regarding the context, I meant "context" as an additional information about handling of existing and non-existing /usr/include. I understood that the link is confusing, will replace with compiler-rt/cmake/base-config-ix.cmake#L76.

Dor1s edited the summary of this revision. (Show Details)Sep 11 2017, 6:14 PM
Dor1s added a comment.Sep 12 2017, 7:58 AM

Tests pass on Linux as well.

Dor1s closed this revision.Sep 12 2017, 8:03 AM