build: report an error message when missing test name
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
Commit Message
Running "make test" without a test name fails with a surprising
unhelpful error message:
$ make test
make -r PARALLELMFLAGS="" -C .. objdir=`pwd` test
make[1]: Entering directory '.../glibc'
make subdir= -C ..=../ .../glibc/build/.out
make[2]: Entering directory '.../glibc'
make[2]: *** ..=../: No such file or directory. Stop.
make[2]: Leaving directory '.../glibc'
make[1]: *** [Makefile:743: test] Error 2
make[1]: Leaving directory '.../glibc'
make: *** [Makefile:9: test] Error 2
It's better to report a useful error message:
$ make test
make -r PARALLELMFLAGS="" -C .. objdir=`pwd` test
make[1]: Entering directory '/home/ydroneaud/src/UPSTREAM/glibc'
Makefile:742: *** Missing test name: usage make test t=<test name>. Stop.
make[1]: Leaving directory '/home/ydroneaud/src/UPSTREAM/glibc'
make: *** [Makefile:9: test] Error 2
---
Makefile | 1 +
1 file changed, 1 insertion(+)
Comments
Le 27/06/2022 à 11:33, Yann Droneaud a écrit :
> Running "make test" without a test name fails with a surprising
> unhelpful error message:
>
> $ make test
> make -r PARALLELMFLAGS="" -C .. objdir=`pwd` test
> make[1]: Entering directory '.../glibc'
> make subdir= -C ..=../ .../glibc/build/.out
> make[2]: Entering directory '.../glibc'
> make[2]: *** ..=../: No such file or directory. Stop.
> make[2]: Leaving directory '.../glibc'
> make[1]: *** [Makefile:743: test] Error 2
> make[1]: Leaving directory '.../glibc'
> make: *** [Makefile:9: test] Error 2
>
> It's better to report a useful error message:
>
> $ make test
> make -r PARALLELMFLAGS="" -C .. objdir=`pwd` test
> make[1]: Entering directory '/home/ydroneaud/src/UPSTREAM/glibc'
> Makefile:742: *** Missing test name: usage make test t=<test name>. Stop.
> make[1]: Leaving directory '/home/ydroneaud/src/UPSTREAM/glibc'
> make: *** [Makefile:9: test] Error 2
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
> ---
> Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Makefile b/Makefile
> index 179dd478ffa8..a4a7b3aae1b8 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -739,6 +739,7 @@ iconvdata/% localedata/% po/%: FORCE
> # Example: make test t=wcsmbs/test-wcsnlen
> .PHONY: test
> test :
> + @$(if $t,:,$(error Missing test name: usage make test t=<test name>))
> @-rm -f $(objpfx)$t.out
> $(MAKE) subdir=$(patsubst %/,%,$(dir $t)) -C $(dir $t) ..=../ $(objpfx)$t.out
> @cat $(objpfx)$t.test-result
@@ -739,6 +739,7 @@ iconvdata/% localedata/% po/%: FORCE
# Example: make test t=wcsmbs/test-wcsnlen
.PHONY: test
test :
+ @$(if $t,:,$(error Missing test name: usage make test t=<test name>))
@-rm -f $(objpfx)$t.out
$(MAKE) subdir=$(patsubst %/,%,$(dir $t)) -C $(dir $t) ..=../ $(objpfx)$t.out
@cat $(objpfx)$t.test-result