SRCDIR = ../../src
-SINGLETONS = create-normal create-empty create-null create-invalid create-long
-
-define SINGLETON_PROG
+# Main test programs.
+TESTS = \
+ $(addprefix args-, argc argv0 argvn single multiple dbl-space) \
+ $(addprefix sc-, bad-sp bad-arg boundary) \
+ halt exit \
+ $(addprefix create-, normal empty null bad-ptr long exists bound) \
+ $(addprefix open-, normal missing boundary empty null bad-ptr twice) \
+ $(addprefix close-, normal twice stdin stdout bad-fd) \
+ $(addprefix read-, normal bad-ptr boundary zero stdout bad-fd) \
+ $(addprefix write-, normal bad-ptr boundary zero stdin bad-fd) \
+ $(addprefix exec-, once arg multiple missing bad-ptr) \
+ $(addprefix join-, simple twice killed bad-pid) \
+ $(addprefix multi-, recurse oom)
+
+define TEST_PROG
PROGS += $(1)
-$(1)_SRC = $(1).c
+$(subst -,_,$(1))_SRC = $(1).c
endef
-$(foreach prog,$(SINGLETONS),$(eval $(call SINGLETON_PROG,$(prog))))
+$(foreach prog,$(TESTS),$(eval $(call TEST_PROG,$(prog))))
DISKS = $(patsubst %,%.dsk,$(PROGS))
disks: $(DISKS)
-PINTOS = ../../src/utils/pintos
-%.dsk: % os.dsk
- rm -f $@ fs.dsk
- $(PINTOS) make-disk fs.dsk 2
- $(PINTOS) -v run -f -q
- $(PINTOS) -v put $<
- mv fs.dsk $@
+# Other programs needed by some of the main test programs.
+PROGS += child-simple child-arg child-bad
+child_simple_SRC = child-simple.c
+child_arg_SRC = child-arg.c
+child_bad_SRC = child-bad.c
+exec-once.dsk exec-multiple.dsk join-simple.dsk join-twice.dsk: child-simple
+exec-arg.dsk: child-arg
+join-killed.dsk: child-bad
-os.dsk: ../../src/userprog/build/os.dsk
- ln -sf $< $@
+%.dsk: %
+ ./prep-disk $<
clean::
rm -f $(DISKS)
include $(SRCDIR)/Makefile.userprog
+
+CFLAGS += -Werror