/
all.mk
58 lines (49 loc) · 1.7 KB
/
all.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# Unit tests for individual pieces of functionality.
#
#
# Test name
#
TEST := test.unit
#
# The files are put here in order. Later tests need
# functionality from earlier test.
#
FILES := $(subst $(DIR)/,,$(call FIND_FILES_SUFFIX,$(DIR),*.txt))
# dict.txt - removed because the unit tests don't allow for protocol namespaces
# command.txt - removed because commands like ":sql" are not parsed properly any more
$(eval $(call TEST_BOOTSTRAP))
#
# We use GMT for the tests, so that local time zones don't affect
# the test outputs.
#
$(FILES.$(TEST)): export TZ = GMT
#export ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer)
#export ASAN_OPTIONS=malloc_context_size=50 detect_leaks=1 symbolize=1
#export LSAN_OPTIONS=print_suppressions=0 fast_unwind_on_malloc=0
#
# Look in each file for `proto foo`, and then make that file depend in `libfreeradius-foo.a`
#
DEPENDS_MK := $(OUTPUT)/depends.mk
$(OUTPUT)/depends.mk: $(addprefix $(DIR)/,$(FILES)) | $(OUTPUT)
${Q}rm -f $@
${Q}touch $@
${Q}for x in $^; do \
y=`grep '^proto ' $$x | sed 's/^proto //'`; \
if [ "$$y" != "" ]; then \
z=`echo $$x | sed 's,src/,$(BUILD_DIR)/',`; \
echo "$$z: $(BUILD_DIR)/lib/libfreeradius-$$y.la" >> $@; \
echo "" >> $@; \
fi \
done
#
# And the actual script to run each test.
#
$(OUTPUT)/%: $(DIR)/% $(TESTBINDIR)/unit_test_attribute
$(eval DIR:=${top_srcdir}/src/tests/unit)
@echo "UNIT-TEST $(lastword $(subst /, ,$(dir $@))) $(basename $(notdir $@))"
${Q}if ! $(TESTBIN)/unit_test_attribute -D $(top_srcdir)/share/dictionary -d $(DIR) -r "$@" $<; then \
echo "$(TESTBIN)/unit_test_attribute -D $(top_srcdir)/share/dictionary -d $(DIR) -r \"$@\" $<"; \
rm -f $(BUILD_DIR)/tests/test.unit; \
exit 1; \
fi