platform_build/core/fuzz_test.mk
Dan Austin 5567e5072e Update fuzz_test makefile.
Update the fuzz_test makefile to link against the new libFuzzer
library and update the coverage flags to the new version.

Test: built a fuzzer and verified correct linking.
Change-Id: Ie6e6da9a202a258abf805dbdc8cdd3490fcb2406
2017-04-19 10:58:58 -07:00

35 lines
1.1 KiB
Makefile

###########################################
## A thin wrapper around BUILD_EXECUTABLE
## Common flags for fuzz tests are added.
###########################################
$(call record-module-type,FUZZ_TEST)
ifdef LOCAL_SDK_VERSION
$(error $(LOCAL_PATH): $(LOCAL_MODULE): NDK fuzz tests are not supported.)
endif
LOCAL_CFLAGS += -fsanitize-coverage=trace-pc-guard
LOCAL_STATIC_LIBRARIES += libFuzzer
ifdef LOCAL_MODULE_PATH
$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH when building test $(LOCAL_MODULE))
endif
ifdef LOCAL_MODULE_PATH_32
$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_32 when building test $(LOCAL_MODULE))
endif
ifdef LOCAL_MODULE_PATH_64
$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_64 when building test $(LOCAL_MODULE))
endif
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_NATIVE_TESTS)/fuzzers/$(LOCAL_MODULE)
LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/fuzzers/$(LOCAL_MODULE)
ifndef LOCAL_MULTILIB
ifndef LOCAL_32_BIT_ONLY
LOCAL_MULTILIB := both
endif
endif
include $(BUILD_EXECUTABLE)