3 include $(patsubst %,$(SRCDIR)/%/Make.tests,$(TEST_SUBDIRS))
5 PROGS = $(foreach subdir,$(TEST_SUBDIRS),$($(subdir)_PROGS))
6 TESTS = $(foreach subdir,$(TEST_SUBDIRS),$($(subdir)_TESTS))
7 EXTRA_GRADES = $(foreach subdir,$(TEST_SUBDIRS),$($(subdir)_EXTRA_GRADES))
9 OUTPUTS = $(addsuffix .output,$(TESTS) $(EXTRA_GRADES))
10 ERRORS = $(addsuffix .errors,$(TESTS) $(EXTRA_GRADES))
11 RESULTS = $(addsuffix .result,$(TESTS) $(EXTRA_GRADES))
14 include ../../Makefile.userprog
20 rm -f $(OUTPUTS) $(ERRORS) $(RESULTS)
23 $(SRCDIR)/tests/make-grade $(SRCDIR) $< $(GRADING_FILE) | tee $@
27 @COUNT="`egrep '^(pass|FAIL) ' $< | wc -l | sed 's/[ ]//g;'`"; \
28 FAILURES="`egrep '^FAIL ' $< | wc -l | sed 's/[ ]//g;'`"; \
29 if [ $$FAILURES = 0 ]; then \
30 echo "All $$COUNT tests passed."; \
32 echo "$$FAILURES of $$COUNT tests failed."; \
37 @for d in $(TESTS) $(EXTRA_GRADES); do \
38 if echo PASS | cmp -s $$d.result -; then \
47 $(foreach prog,$(PROGS),$(eval $(prog).output: $(prog)))
48 $(foreach test,$(TESTS),$(eval $(test).output: $($(test)_PUTFILES)))
49 $(foreach test,$(TESTS),$(eval $(test).output: TEST = $(test)))
51 # Prevent an environment variable VERBOSE from surprising us.
54 TESTCMD = pintos -v -k -T $(TIMEOUT)
55 TESTCMD += $(SIMULATOR)
56 TESTCMD += $(PINTOSOPTS)
57 ifeq ($(filter userprog, $(KERNEL_SUBDIRS)), userprog)
58 TESTCMD += --fs-disk=$(FSDISK)
59 TESTCMD += $(foreach file,$(PUTFILES),-p $(file) -a $(notdir $(file)))
61 ifeq ($(filter vm, $(KERNEL_SUBDIRS)), vm)
62 TESTCMD += --swap-disk=4
65 TESTCMD += $(KERNELFLAGS)
66 ifeq ($(filter userprog, $(KERNEL_SUBDIRS)), userprog)
69 TESTCMD += $(if $($(TEST)_ARGS),run '$(*F) $($(TEST)_ARGS)',run $(*F))
70 TESTCMD += < /dev/null
71 TESTCMD += 2> $(TEST).errors $(if $(VERBOSE),|tee,>) $(TEST).output
75 %.result: %.ck %.output
76 perl -I$(SRCDIR) $< $* $@