run one test

Message ID xna7askt1n.fsf@greed.delorie.com
State Superseded
Headers

Commit Message

DJ Delorie Sept. 25, 2019, 8:41 p.m. UTC
  One of the small items that was mentioned at Cauldron was "how do to
re-run just one test?"

While it can be done with a suitable command line make invocation,
this is a lot easier...

I'll turn it into a real patch once we bikeshed the target name ;-)
  

Comments

Carlos O'Donell Sept. 25, 2019, 9:11 p.m. UTC | #1
On 9/25/19 4:41 PM, DJ Delorie wrote:
> One of the small items that was mentioned at Cauldron was "how do to
> re-run just one test?"
> 
> While it can be done with a suitable command line make invocation,
> this is a lot easier...
> 
> I'll turn it into a real patch once we bikeshed the target name ;-)
> 
> diff --git a/Makefile b/Makefile
> index 67ddd01bfe..c424d9ee02 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -499,3 +499,11 @@ FORCE:
>  
>  iconvdata/% localedata/% po/%: FORCE
>  	$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
> +
> +# Convenience target to rerun one test, from the top of the build tree
> +# Example: make onetest t=wcsmbs/test-wcsnlen
> +onetest :
> +	@-rm -f $(objpfx)$t.out
> +	$(MAKE) subdir=$(dir $t) -C $(dir $t) ..=../ $(objpfx)$t.out
> +	@cat $(objpfx)$t.test-result
> +	@cat $(objpfx)$t.out
> 

Does this avoid rebuilding *anything* else?

One of the problems with the suggested fix on the wiki is that it can
put your tree into a bad state because of missing dependencies you
might rebuild only part of glibc and fail.

For example if $t.out depends on libpthread.so, then what happens
if you've touched a file under nptl/? Likewise for libdl.so?

I'm not saying we shouldn't do this, but that we should document the
limitations of this command.

And I suggest 'make onecheck' to match 'make xcheck' and 'make check' :-)
  
Szabolcs Nagy Sept. 26, 2019, 9:10 a.m. UTC | #2
On 25/09/2019 21:41, DJ Delorie wrote:
> 

> One of the small items that was mentioned at Cauldron was "how do to

> re-run just one test?"

> 

> While it can be done with a suitable command line make invocation,

> this is a lot easier...


looks useful to me.

unfortunately there is currently no easy way to
discover such make targets. (maybe there could be a
make target that prints out usage information for
the most commonly used make targets)

it can be convenient to rerun a set of tests too, e.g.
by providing a list or pattern like 'math/test-double-*',
which can be implemented in a similar way.

same for benchmarks.

for now the proposed patch looks good enough though.

> 

> I'll turn it into a real patch once we bikeshed the target name ;-)

> 

> diff --git a/Makefile b/Makefile

> index 67ddd01bfe..c424d9ee02 100644

> --- a/Makefile

> +++ b/Makefile

> @@ -499,3 +499,11 @@ FORCE:

>  

>  iconvdata/% localedata/% po/%: FORCE

>  	$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)

> +

> +# Convenience target to rerun one test, from the top of the build tree

> +# Example: make onetest t=wcsmbs/test-wcsnlen

> +onetest :

> +	@-rm -f $(objpfx)$t.out

> +	$(MAKE) subdir=$(dir $t) -C $(dir $t) ..=../ $(objpfx)$t.out

> +	@cat $(objpfx)$t.test-result

> +	@cat $(objpfx)$t.out

>
  

Patch

diff --git a/Makefile b/Makefile
index 67ddd01bfe..c424d9ee02 100644
--- a/Makefile
+++ b/Makefile
@@ -499,3 +499,11 @@  FORCE:
 
 iconvdata/% localedata/% po/%: FORCE
 	$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
+
+# Convenience target to rerun one test, from the top of the build tree
+# Example: make onetest t=wcsmbs/test-wcsnlen
+onetest :
+	@-rm -f $(objpfx)$t.out
+	$(MAKE) subdir=$(dir $t) -C $(dir $t) ..=../ $(objpfx)$t.out
+	@cat $(objpfx)$t.test-result
+	@cat $(objpfx)$t.out