Replace .runtest with .test, I get it wrong each time I try to use it manually

This commit is contained in:
Christophe de Dinechin 2017-06-15 15:36:59 +02:00
parent faeb41efd2
commit 2b627dd62b
3 changed files with 17 additions and 18 deletions

View File

@ -1,5 +1,5 @@
#******************************************************************************
# Makefile<build> 'build' project
# Makefile<build> 'build' project
#******************************************************************************
#
# File Description:
@ -49,6 +49,5 @@ BENCHMARKS=product
# Include the makefile rules
include $(BUILD)rules.mk
count-characters.runtest:
count-characters.test:
@echo Output has `$(OBJPRODUCTS) | wc -c` characters, should be 35

View File

@ -69,7 +69,7 @@ you should see if you do that in the `build` directory itself:
real 0m3.263s
user 0m0.456s
sys 0m0.133s
The output of the build will be located by default in `build/objects`.
There are subdirectories corresponding to the build environment and
the build target, so the final product could be for instance under
@ -107,8 +107,8 @@ building it if necessary:
Output has 35 characters, should be 35
As you can see in the sample `Makefile`, it is easy to add tests,
simply by adding a rule that ends in `.runtest`. In the sample file,
it is called `count-characters.runtest`.
simply by adding a rule that ends in `.test`. In the sample file,
it is called `count-characters.test`.
## Building for debugging, release or profiling
@ -132,7 +132,7 @@ This list is likely to evolve over time, most notably with support for
Valgrind and other debug / analysis tools.
## Installing the product
## Installing the product
To install the product, use `make install`. This often requires
super-user privileges.
@ -189,7 +189,7 @@ Some of the most useful include:
* `PREFIX` specifies the installation location. You can also specify
the installation location for executables (`PREFIX_BIN`), libraries
(`PREFIX_LIB`) or shared libraries (`PREFIX_DLL`).
## Hierarchical projects
@ -198,10 +198,10 @@ Often, a project is made of several directories or libraries. In
* `SUBDIRS` lists subdirectories of the top-level directory that
must be built every time.
* `LIBRARIES` lists libraries, which can be subdirectories or not,
which the products depends on.
Subdirectories are re-built everytime a top-level build is started,
whereas libraries are re-built only if they are missing. It is
possible to force a re-build of libraries using the `d-` or `deep-`

View File

@ -1,5 +1,5 @@
#******************************************************************************
# rules.mk Recorder project
# rules.mk Recorder project
#******************************************************************************
#
# File Description:
@ -104,7 +104,7 @@ debug opt release profile: logs.mkdir
# Testing
test tests check: $(TARGET)
$(PRINT_COMMAND) $(MAKE) RECURSE=test $(TESTS:%=%.runtest) LOG_COMMANDS= TIME=
$(PRINT_COMMAND) $(MAKE) RECURSE=test $(TESTS:%=%.test) LOG_COMMANDS= TIME=
# Clean builds
startup restart rebuild: clean all
@ -172,14 +172,14 @@ prebuild:
postbuild:
# Run the test (in the object directory)
product.runtest: product .ALWAYS
product.test: product .ALWAYS
$(PRINT_TEST) $(OBJROOT_EXE) $(PRODUCTS_OPTS)
# Run a test from a C or C++ file to link against current library
%.c.runtest: $(OBJROOT_LIB) .ALWAYS
%.c.test: $(OBJROOT_LIB) .ALWAYS
$(PRINT_BUILD) $(MAKE) SOURCES=$*.c LINK_LIBS=$(OBJROOT_LIB) PRODUCTS=$*.exe $(TARGET)
$(PRINT_TEST) $(TEST_CMD_$*) $(OBJROOT)/$*$(EXE_EXT) $(TEST_ARGS_$*)
%.cpp.runtest: $(OBJROOT_LIB) .ALWAYS
%.cpp.test: $(OBJROOT_LIB) .ALWAYS
$(PRINT_BUILD) $(MAKE) SOURCES=$*.cpp LINK_LIBS=$(OBJROOT_LIB) PRODUCTS=$*.exe $(TARGET)
$(PRINT_TEST) $(TEST_CMD_$*) $(OBJROOT)/$*$(EXE_EXT) $(TEST_ARGS_$*)
@ -194,7 +194,7 @@ product.runtest: product .ALWAYS
# Benchmarking (always done with profile target)
benchmark: $(BENCHMARK:%=%.benchmark) $(BENCHMARKS:%=%.benchmark)
product.benchmark: product .ALWAYS
$(PRINT_TEST) gprof
$(PRINT_TEST) gprof
.PHONY: hello hello.install hello.clean goodbye
.PHONY: build libraries product objects prebuild postbuild test
@ -260,7 +260,7 @@ endif
# If LIBRARIES=foo/bar, go to directory foo/bar, which should build bar.a
$(OBJROOT)/%$(LIB_EXT): $(DEEP_BUILD)
+$(PRINT_COMMAND) cd $(filter %$*, $(LIBRARIES) $(SUBDIRS)) && $(RECURSE_CMD)
%/.runtest:
%/.test:
+$(PRINT_TEST) cd $* && $(MAKE) TARGET=$(TARGET) test
deep_build:
@ -286,7 +286,7 @@ PRINT_GENERATE= $(PRINT_COMMAND) $(INFO) "[GENERATE]" "$(shell basename "$@")";
PRINT_INSTALL= $(PRINT_COMMAND) $(INFO) "[INSTALL] " $(*F) in $(<D);
PRINT_COPY= $(PRINT_COMMAND) $(INFO) "[COPY]" $< '=>' $@ ;
PRINT_DEPEND= $(PRINT_COMMAND) $(INFO) "[DEPEND] " $< ;
PRINT_TEST= $(PRINT_COMMAND) $(INFO) "[TEST]" $(@:.runtest=) ;
PRINT_TEST= $(PRINT_COMMAND) $(INFO) "[TEST]" $(@:.test=) ;
PRINT_CONFIG= $(PRINT_COMMAND) $(INFO) "[CONFIG]" "$*" ;
PRINT_LIBCONFIG=$(PRINT_COMMAND) $(INFO) "[CONFIG]" "lib$*" ;