-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.tools_tests
60 lines (47 loc) · 2.89 KB
/
Makefile.tools_tests
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
59
60
SHELL=/bin/bash
BITREAD = build/tools/bitread
BITS2RBT = build/tools/bits2rbt/bits2rbt
TEST_DATA_PATH = lib/test_data
BITREAD_TESTS = bitread_zero_frames_usp
#FIXME Uncomment bits2rbt_bram_xc7 once https://github.com/SymbiFlow/prjxray/issues/1285 is fixed
BITS2RBT_TESTS = bits2rbt_xc7 bits2rbt_us bits2rbt_usp #bits2rbt_bram_xc7
TESTS = $(BITREAD_TESTS) $(BITS2RBT_TESTS)
bitread_zero_frames_usp_ARGS_COMMON = --part_file build/UltraScalePlus/test.yaml build/UltraScalePlus/test.bit --architecture UltraScalePlus
bitread_zero_frames_usp_ARGS_1 = $(bitread_zero_frames_usp_ARGS_COMMON) -o build/bitread_zero_frames_1.frm
bitread_zero_frames_usp_ARGS_2 = $(bitread_zero_frames_usp_ARGS_COMMON) -o build/bitread_zero_frames_2.frm -z
bitread_zero_frames_usp_TEST = test $$(grep ".frame 0x00000000" build/bitread_zero_frames_*.frm | wc -l) -eq 1
bits2rbt_xc7_ARGS_1 = -part_file build/Series7/part.yaml -architecture Series7 -y -o build/xc7.bits -aux build/xc7.aux build/Series7/design.bit
bits2rbt_xc7_ARGS_2 = -arch Series7 -aux build/xc7.aux -o build/xc7.rbt build/xc7.bits
bits2rbt_xc7_TEST = diff <(tail -n +8 build/Series7/design.rbt) <(tail -n +8 build/xc7.rbt)
bits2rbt_bram_xc7_ARGS_1 = -part_file build/Series7/part.yaml -architecture Series7 -y -o build/bram_xc7.bits -aux build/bram_xc7.aux build/Series7/bram.bit
bits2rbt_bram_xc7_ARGS_2 = -arch Series7 -aux build/bram_xc7.aux -o build/bram_xc7.rbt build/bram_xc7.bits
bits2rbt_bram_xc7_TEST = diff <(tail -n +8 build/Series7/bram.rbt) <(tail -n +8 build/bram_xc7.rbt)
bits2rbt_us_ARGS_1 = -part_file build/UltraScale/part.yaml -architecture UltraScale -y -o build/us.bits -aux build/us.aux build/UltraScale/design.bit
bits2rbt_us_ARGS_2 = -arch UltraScale -aux build/us.aux -o build/us.rbt build/us.bits
bits2rbt_us_TEST = diff <(tail -n +8 build/UltraScale/design.rbt) <(tail -n +8 build/us.rbt)
bits2rbt_usp_ARGS_1 = -part_file build/UltraScalePlus/part.yaml -architecture UltraScalePlus -y -o build/usp.bits -aux build/usp.aux build/UltraScalePlus/design.bit
bits2rbt_usp_ARGS_2 = -arch UltraScalePlus -aux build/usp.aux -o build/usp.rbt build/usp.bits
bits2rbt_usp_TEST = diff <(tail -n +8 build/UltraScalePlus/design.rbt) <(tail -n +8 build/usp.rbt)
all: $(TESTS)
test_data: $(TEST_DATA_PATH)/ToolsTestData.tar.gz
@echo "Unpacking test data"
tar -zxf $< -C build
define bitread_test_tpl =
$(1): $(2) $(3) test_data
@echo "Started test $(1)"
@$(2) $$($(1)_ARGS_1) > /dev/null && $(3) $$($(1)_ARGS_2) > /dev/null && $$($(1)_TEST); \
RETVAL=$$$$? ; \
if [ $$$$RETVAL -eq 0 ]; then \
echo "$(1) PASS"; \
true; \
else \
echo "$(1) FAIL"; \
false; \
fi
$(1)_clean:
rm -rf build/*.frm build/*.aux build/*.bits build/*.rbt
endef
$(foreach test,$(BITREAD_TESTS),$(eval $(call bitread_test_tpl,$(test),$(BITREAD),$(BITREAD))))
$(foreach test,$(BITS2RBT_TESTS),$(eval $(call bitread_test_tpl,$(test),$(BITREAD),$(BITS2RBT))))
clean: $(foreach test,$(TESTS),$(test)_clean)
@true