esp-idf/components/mdns/test_afl_fuzz_host/Makefile

46 lines
1003 B
Makefile
Raw Normal View History

2017-04-03 09:50:12 -04:00
TEST_NAME=test
FUZZ=afl-fuzz
COMPONENTS_DIR=../..
CFLAGS=-g -DHOOK_MALLOC_FAILED -DESP_EVENT_H_ -D__ESP_LOG_H__ -DMDNS_TEST_MODE \
-I. -I.. -I../include -I../private_include -include esp32_compat.h \
-I$(COMPONENTS_DIR)/tcpip_adapter/include -I$(COMPONENTS_DIR)/esp_event/include -I$(COMPONENTS_DIR)/log/include
MDNS_C_DEPENDENCY_INJECTION=-include mdns_di.h
ifeq ($(INSTR),off)
CC=gcc
CFLAGS+=-DINSTR_IS_OFF
TEST_NAME=test_sim
else
CC=afl-clang-fast
endif
2017-04-03 09:50:12 -04:00
CPP=$(CC)
LD=$(CC)
OBJECTS=mdns.o esp32_mock.o test.o
2017-04-03 09:50:12 -04:00
OS := $(shell uname)
ifeq ($(OS),Darwin)
LDLIBS=
else
LDLIBS=-lbsd
CFLAGS+=-DUSE_BSD_STRING
2017-04-03 09:50:12 -04:00
endif
all: $(TEST_NAME)
%.o: %.c
@echo "[CC] $<"
@$(CC) $(CFLAGS) -c $< -o $@
mdns.o: ../mdns.c
@echo "[CC] $<"
@$(CC) $(CFLAGS) $(MDNS_C_DEPENDENCY_INJECTION) -c $< -o $@
2017-04-03 09:50:12 -04:00
$(TEST_NAME): $(OBJECTS)
@echo "[LD] $@"
@$(LD) $(OBJECTS) -o $@ $(LDLIBS)
2017-04-03 09:50:12 -04:00
fuzz: $(TEST_NAME)
@$(FUZZ) -i "in" -o "out" -- ./$(TEST_NAME)
clean:
@rm -rf *.o *.SYM $(TEST_NAME) out