Dan Albert | 36b6f04 | 2015-07-30 16:56:30 -0700 | [diff] [blame] | 1 | ########################################### |
| 2 | ## A thin wrapper around BUILD_EXECUTABLE |
| 3 | ## Common flags for fuzz tests are added. |
| 4 | ########################################### |
Dan Willemsen | 3bf15e7 | 2016-07-25 16:03:53 -0700 | [diff] [blame] | 5 | $(call record-module-type,FUZZ_TEST) |
Dan Albert | 36b6f04 | 2015-07-30 16:56:30 -0700 | [diff] [blame] | 6 | |
| 7 | ifdef LOCAL_SDK_VERSION |
| 8 | $(error $(LOCAL_PATH): $(LOCAL_MODULE): NDK fuzz tests are not supported.) |
| 9 | endif |
| 10 | |
Zach Riggle | 6319dee | 2017-12-21 16:04:03 -0600 | [diff] [blame] | 11 | my_fuzzer:=libFuzzer |
| 12 | ifdef LOCAL_FUZZ_ENGINE |
| 13 | my_fuzzer:=$(LOCAL_FUZZ_ENGINE) |
| 14 | else ifdef TARGET_FUZZ_ENGINE |
| 15 | my_fuzzer:=$(TARGET_FUZZ_ENGINE) |
| 16 | endif |
| 17 | |
Mitch Phillips | ee8f4a0 | 2019-05-01 14:37:33 -0700 | [diff] [blame] | 18 | LOCAL_SANITIZE += fuzzer |
Zach Riggle | 6319dee | 2017-12-21 16:04:03 -0600 | [diff] [blame] | 19 | |
| 20 | ifeq ($(my_fuzzer),libFuzzer) |
Dan Austin | 5567e50 | 2017-04-19 10:56:45 -0700 | [diff] [blame] | 21 | LOCAL_STATIC_LIBRARIES += libFuzzer |
Zach Riggle | 6319dee | 2017-12-21 16:04:03 -0600 | [diff] [blame] | 22 | else |
| 23 | $(call pretty-error, Unknown fuzz engine $(my_fuzzer)) |
| 24 | endif |
Dan Albert | 36b6f04 | 2015-07-30 16:56:30 -0700 | [diff] [blame] | 25 | |
| 26 | ifdef LOCAL_MODULE_PATH |
| 27 | $(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH when building test $(LOCAL_MODULE)) |
| 28 | endif |
| 29 | |
| 30 | ifdef LOCAL_MODULE_PATH_32 |
| 31 | $(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_32 when building test $(LOCAL_MODULE)) |
| 32 | endif |
| 33 | |
| 34 | ifdef LOCAL_MODULE_PATH_64 |
| 35 | $(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_64 when building test $(LOCAL_MODULE)) |
| 36 | endif |
| 37 | |
Zach Riggle | 70299e9 | 2018-03-26 14:47:31 -0500 | [diff] [blame] | 38 | LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_NATIVE_TESTS)/fuzzers/$(my_fuzzer)/$(LOCAL_MODULE) |
| 39 | LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/fuzzers/$(my_fuzzer)/$(LOCAL_MODULE) |
Dan Albert | 36b6f04 | 2015-07-30 16:56:30 -0700 | [diff] [blame] | 40 | |
Zach Riggle | bcfa37e | 2018-01-03 13:32:14 -0600 | [diff] [blame] | 41 | ifndef LOCAL_STRIP_MODULE |
| 42 | LOCAL_STRIP_MODULE := keep_symbols |
| 43 | endif |
| 44 | |
Dan Albert | 36b6f04 | 2015-07-30 16:56:30 -0700 | [diff] [blame] | 45 | include $(BUILD_EXECUTABLE) |