From 29ee9ad500a1bcdbe60ae16c5405c6315b0c7fa0 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Fri, 26 Jul 2013 16:45:35 +0000 Subject: [PATCH] rename run to runtest so src/common/run make target does not collide --- Makefile | 9 ++++----- README | 2 +- src/common/{run.c => runtest.c} | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) rename src/common/{run.c => runtest.c} (95%) diff --git a/Makefile b/Makefile index a874b5d..d67a36f 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ endef $(foreach n,$(NAMES),$(eval $(call template,$(n)))) BINS:=$(foreach n,$(NAMES),$($(n).BINS)) $(B)/api/main -LIBS:=$(foreach n,$(NAMES),$($(n).LIBS)) $(B)/common/run +LIBS:=$(foreach n,$(NAMES),$($(n).LIBS)) $(B)/common/runtest ERRS:=$(BINS:%=%.err) debug: @@ -53,7 +53,6 @@ debug: define target_template $(1).ERRS:=$$(filter $(B)/$(1)/%,$$(ERRS)) $(B)/$(1)/all: $(B)/$(1)/REPORT -# TODO: $(B)/common/run collides with the run binary target $(B)/$(1)/run: $(B)/$(1)/cleanerr $(B)/$(1)/REPORT $(B)/$(1)/cleanerr: rm -f $$(filter-out $(B)/$(1)/%-static.err,$$($(1).ERRS)) @@ -72,7 +71,7 @@ $(B)/common/libtest.a: $(common.OBJS) $(AR) rc $@ $^ $(RANLIB) $@ -$(ERRS): $(B)/common/run | $(BDIRS) +$(ERRS): $(B)/common/runtest | $(BDIRS) $(BINS) $(LIBS): $(B)/common/libtest.a $(OBJS): src/common/test.h | $(BDIRS) $(BDIRS): @@ -89,7 +88,7 @@ $(api.OBJS):CFLAGS+=-DX_PS -DX_TPS -DX_SS all:$(B)/REPORT run:$(B)/REPORT clean: - rm -f $(OBJS) $(BINS) $(LIBS) $(B)/common/libtest.a $(B)/common/run $(B)/*/*.err + rm -f $(OBJS) $(BINS) $(LIBS) $(B)/common/libtest.a $(B)/common/runtest $(B)/*/*.err cleanall: clean rm -f $(B)/REPORT $(B)/*/REPORT $(B)/REPORT: @@ -117,7 +116,7 @@ $(B)/%: $(B)/%.o %.ld.err: % touch $@ %.err: % - $(B)/common/run ./$< 2>/dev/null >$@ || true + $(B)/common/runtest ./$< >$@ || true .PHONY: all run clean cleanall diff --git a/README b/README index 61b0722..aa50091 100644 --- a/README +++ b/README @@ -49,7 +49,7 @@ may be used to simplify the code like #define T2(f,w) (result=(f), result==(w) || (t_error("%s failed: got %s, want %s\n", #f, result, w),0)) binaries should be possible to run from arbitrary directory. -the build system runs the tests using the src/common/run tool which +the build system runs the tests using the src/common/runtest tool which kills the test process after a timeout and reports the exit status in case of failure diff --git a/src/common/run.c b/src/common/runtest.c similarity index 95% rename from src/common/run.c rename to src/common/runtest.c index 36f3c5e..95e615e 100644 --- a/src/common/run.c +++ b/src/common/runtest.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) int pid; if (argc < 2) { - t_error("usage: ./run cmd [args..]\n"); + t_error("usage: ./runtest cmd [args..]\n"); return -1; } argv++; @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) } if (WIFEXITED(status)) { if (WEXITSTATUS(status) == 0) - return 0; + return t_status; t_printf("FAIL %s [status %d]\n", argv[0], WEXITSTATUS(status)); } else if (timeout) { t_printf("FAIL %s [timed out]\n", argv[0]); -- 2.20.1