blob: 06e85dabb14d7a2531892331287f2f5fdfab90fd (
plain) (
blame)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
.PHONY: all
all: check
ARCH ?= riscv64
CROSS_COMPILE ?= $(ARCH)-unknown-elf-
LLVM ?= 0
COMPILER != [ "$(LLVM)" != "0" ] \
&& echo clang --target="$(CROSS_COMPILE)" \
|| echo $(CROSS_COMPILE)gcc
include common/arch/$(ARCH)/source.mk
OBFLAGS := -ffreestanding -nostdlib -std=c17 -g -O2
INCLUDEFLAGS := -I ../include -I.
WARNFLAGS := -Wall -Wextra
DEPFLAGS = -MT $@ -MMD -MP -MF $@.d
COMPILE_TEST = $(COMPILER) $(WARNFLAGS) $(INCLUDEFLAGS) \
$(DEPFLAGS) $(OBFLAGS) $(ARCH_FLAGS)
GEN_INITRD := cpio -H newc -o >
QEMU := qemu-system-$(ARCH) -machine virt -kernel ../kmi.bin \
-serial stdio \
-monitor none \
-nographic \
-no-reboot \
-m 128M \
-initrd
KMI := ../kmi.bin
# common tools available for tests, printf/fdt/initrd handling and common memory
# ops like memset and memcpy. Note that printf uses in-kernel printing at least
# for now, so testsuite must be run on kernels compiled with -DDEBUG=1
COMMON := build/printf.o \
build/string.o \
build/fdt.o \
build/fdt_ro.o \
build/fdt_rw.o \
build/fdt_wip.o \
build/fdt_addresses.o \
build/bits.o
# reuse some common parts from source tree. Could maybe split these into a
# common directory to make it a bit easier to work with, but this is not too bad
# for now
build/bits.o: ../src/bits.c $(KMI)
$(COMPILE_TEST) -c ../src/bits.c -o build/bits.o
build/fdt.o: ../lib/fdt.c $(KMI)
$(COMPILE_TEST) -c ../lib/fdt.c -o build/fdt.o
build/fdt_ro.o: ../lib/fdt_ro.c $(KMI)
$(COMPILE_TEST) -c ../lib/fdt_ro.c -o build/fdt_ro.o
build/fdt_rw.o: ../lib/fdt_rw.c $(KMI)
$(COMPILE_TEST) -c ../lib/fdt_rw.c -o build/fdt_rw.o
build/fdt_wip.o: ../lib/fdt_wip.c $(KMI)
$(COMPILE_TEST) -c ../lib/fdt_wip.c -o build/fdt_wip.o
build/fdt_addresses.o: ../lib/fdt_addresses.c $(KMI)
$(COMPILE_TEST) -c ../lib/fdt_addresses.c -o build/fdt_addresses.o
build/printf.o: common/printf.c $(KMI)
$(COMPILE_TEST) -c common/printf.c -o build/printf.o
build/string.o: common/string.c $(KMI)
$(COMPILE_TEST) -c common/string.c -o build/string.o
include tests.mk
.PHONY: check
check: $(TESTS)
@cd reports; for d in * ; do \
if [ ! -f "$$d/log" ]; then \
echo "BROKEN: $$d" ; \
elif grep 'BUG|ERR' $$d/log \
|| [ "$$(tail -n1 $$d/log | tr -d '\r')" != "OK" ]; then \
echo "FAIL: $$d" ; \
fi \
done
@echo "Done."
|