Remove -Wdeclaration-after-statement because it's not supported by GCC
[pintos.git] / tests / Makefile
blob3adf8e38ac9f72a9ea6ed4d52a37d2b5180d8153
1 TESTS = threads p1 userprog p2 vm p3 filesys p4
3 PATH := $(shell pwd)/../src/utils:$(PATH)
5 all:
6 @echo "This Makefile has only \`check' targets."
8 check:
9 $(MAKE) -C .. distclean
10 for d in $(TESTS); do $(MAKE) $$d || exit 1; done
11 @echo All tests passed.
13 clean:
14 rm -rf $(TESTS)
16 SUBMAKEFLAGS = -s
18 define mk-sandbox
19 rm -rf $@ && mkdir $@ && cp -R ../src $@/src
20 cd $@/src && $(MAKE) clean $(SUBMAKEFLAGS)
21 endef
23 define run-tests
24 cd $@/src/$(PROJECT) && $(MAKE) check
25 endef
27 define run-tests-grade
28 cd $@/src/$(PROJECT) && $(MAKE) check
29 cd $@/src/$(PROJECT) && $(MAKE) grade
30 cd $@/src/$(PROJECT) && grep -q PERFECT build/grade
31 cd $@/src/$(PROJECT) && grep -qv warning build/grade
32 endef
34 define compile
35 cd $@/src/$(PROJECT) && $(MAKE)
36 endef
38 define clean
39 rm -rf $@
40 endef
42 define apply-patch
43 (cd $@ && patch -p0)
44 endef
46 PROJECT = $@
48 threads::
49 $(mk-sandbox)
50 $(compile)
51 $(run-tests) TESTS=tests/threads/alarm-single
52 $(clean)
54 userprog vm filesys::
55 $(mk-sandbox)
56 $(compile)
57 $(clean)
59 FAST_SIM := $(if $(shell which qemu),--qemu)
60 export PINTOSOPTS
62 p1: PROJECT = threads
63 p1::
64 $(mk-sandbox)
65 $(apply-patch) < ../solutions/p1.patch
66 $(run-tests-grade)
67 $(clean)
69 p2: PROJECT = userprog
70 p2: PINTOSOPTS = $(FAST_SIM)
71 p2::
72 $(mk-sandbox)
73 $(apply-patch) < ../solutions/p2.patch
74 $(run-tests-grade)
75 $(clean)
77 p3: PROJECT = vm
78 p3: PINTOSOPTS = $(FAST_SIM)
79 p3::
80 $(mk-sandbox)
81 $(apply-patch) < ../solutions/p3.patch
82 $(run-tests-grade)
83 $(clean)
85 p4: PROJECT = filesys
86 p4: PINTOSOPTS = $(FAST_SIM)
87 p4::
88 $(mk-sandbox)
89 $(apply-patch) < ../solutions/p4.patch
90 $(run-tests-grade)
91 $(clean)