29ee9a
rename run to runtest so src/common/run make target does not collide
@@ -40,7 +40,7 @@ endef
|
|
40
40
|
$(foreach n,$(NAMES),$(eval $(call template,$(n))))
|
41
41
|
|
42
42
|
BINS:=$(foreach n,$(NAMES),$($(n).BINS)) $(B)/api/main
|
43
|
-
LIBS:=$(foreach n,$(NAMES),$($(n).LIBS)) $(B)/common/
|
43
|
+
LIBS:=$(foreach n,$(NAMES),$($(n).LIBS)) $(B)/common/runtest
|
44
44
|
ERRS:=$(BINS:%=%.err)
|
45
45
|
|
46
46
|
debug:
|
@@ -53,7 +53,6 @@ debug:
|
|
53
53
|
define target_template
|
54
54
|
$(1).ERRS:=$$(filter $(B)/$(1)/%,$$(ERRS))
|
55
55
|
$(B)/$(1)/all: $(B)/$(1)/REPORT
|
56
|
-
# TODO: $(B)/common/run collides with the run binary target
|
57
56
|
$(B)/$(1)/run: $(B)/$(1)/cleanerr $(B)/$(1)/REPORT
|
58
57
|
(B)/$(1)/cleanerr:
|
59
58
|
rm -f $$(filter-out $(B)/$(1)/%-static.err,$$($(1).ERRS))
|
@@ -72,7 +71,7 @@ $(B)/common/libtest.a: $(common.OBJS)
|
|
72
71
|
$(AR) rc $@ $^
|
73
72
|
$(RANLIB) $@
|
74
73
|
|
75
|
-
$(ERRS): $(B)/common/
|
74
|
+
$(ERRS): $(B)/common/runtest | $(BDIRS)
|
76
75
|
$(BINS) $(LIBS): $(B)/common/libtest.a
|
77
76
|
(OBJS): src/common/test.h | $(BDIRS)
|
78
77
|
(BDIRS):
|
@@ -89,7 +88,7 @@ $(api.OBJS):CFLAGS+=-DX_PS -DX_TPS -DX_SS
|
|
89
88
|
all:$(B)/REPORT
|
90
89
|
run:$(B)/REPORT
|
91
90
|
clean:
|
92
|
-
rm -f $(OBJS) $(BINS) $(LIBS) $(B)/common/libtest.a $(B)/common/
|
91
|
+
rm -f $(OBJS) $(BINS) $(LIBS) $(B)/common/libtest.a $(B)/common/runtest $(B)/*/*.err
|
93
92
|
cleanall: clean
|
94
93
|
rm -f $(B)/REPORT $(B)/*/REPORT
|
95
94
|
(B)/REPORT:
|
@@ -117,7 +116,7 @@ $(B)/%: $(B)/%.o
|
|
117
116
|
%.ld.err: %
|
118
117
|
touch $@
|
119
118
|
.err: %
|
120
|
-
$(B)/common/
|
119
|
+
$(B)/common/runtest ./$< >$@ || true
|
121
120
|
|
122
121
|
.PHONY: all run clean cleanall
|
123
122
|
|
@@ -49,7 +49,7 @@ may be used to simplify the code like
|
|
49
49
|
define T2(f,w) (result=(f), result==(w) || (t_error("%s failed: got %s, want %s\n", #f, result, w),0))
|
50
50
|
|
51
51
|
binaries should be possible to run from arbitrary directory.
|
52
|
-
the build system runs the tests using the src/common/
|
52
|
+
the build system runs the tests using the src/common/runtest tool which
|
53
53
|
kills the test process after a timeout and reports the exit status
|
54
54
|
in case of failure
|
55
55
|
|
@@ -42,7 +42,7 @@ int main(int argc, char *argv[])
|
|
42
42
|
int pid;
|
43
43
|
|
44
44
|
if (argc < 2) {
|
45
|
-
t_error("usage: ./
|
45
|
+
t_error("usage: ./runtest cmd [args..]\n");
|
46
46
|
return -1;
|
47
47
|
}
|
48
48
|
argv++;
|
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
|
|
63
63
|
}
|
64
64
|
if (WIFEXITED(status)) {
|
65
65
|
if (WEXITSTATUS(status) == 0)
|
66
|
-
return
|
66
|
+
return t_status;
|
67
67
|
t_printf("FAIL %s [status %d]\n", argv[0], WEXITSTATUS(status));
|
68
68
|
} else if (timeout) {
|
69
69
|
t_printf("FAIL %s [timed out]\n", argv[0]);
|