Newer
Older
CFLAGS = -O1 -g -Wall -Werror
GIT_HOOKS := .git/hooks/applied
all: $(GIT_HOOKS) qtest
# Control the build verbosity
ifeq ("$(VERBOSE)","1")
Q :=
VECHO = @true
else
Q := @
VECHO = @printf
endif
# Enable sanitizer(s) or not
ifeq ("$(SANITIER)","1")
# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fno-common
LDFLAGS += -fsanitize=address
endif
$(GIT_HOOKS):
@scripts/install-git-hooks
@echo
OBJS := qtest.o report.o console.o harness.o queue.o
deps := $(OBJS:%.o=.%.o.d)
qtest: $(OBJS)
$(VECHO) " LD\t$@\n"
$(Q)$(CC) $(LDFLAGS) -o $@ $^
%.o: %.c
$(VECHO) " CC\t$@\n"
$(Q)$(CC) -o $@ $(CFLAGS) -c -MMD -MF .$@.d $<
test: qtest scripts/driver.py
scripts/driver.py
@which valgrind 2>&1 > /dev/null || (echo "FATAL: valgrind not found"; exit 1)
# Explicitly disable sanitizer(s)
$(MAKE) clean SANITIER=0 qtest
$(eval patched_file := $(shell mktemp /tmp/qtest.XXXXXX))
cp qtest $(patched_file)
chmod u+x $(patched_file)
sed -i "s/alarm/isnan/g" $(patched_file)
scripts/driver.py -p $(patched_file) --valgrind
@echo
@echo "Test with specific case by running command:"
@echo "scripts/driver.py -p $(patched_file) --valgrind -t <tid>"