This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Run libm tests separately for each function


Hi Joseph.

(I have no knowledge on glibc build stuff, so be warned).

> This patch arranges for tests of each function to be run separately
...
Previously you wrote that things took 30 minutes / 80 minutes.
But the resulting build-time / run-time after this patch is applied
is not included. So the effect is not known.
It would be good to know the benefit (and eventual build time cost).

> 
> diff --git a/math/Makefile b/math/Makefile
> index 2735212..fabd0e9 100644
> --- a/math/Makefile
> +++ b/math/Makefile
> @@ -192,13 +192,6 @@ endif
>  
>  ifneq (no,$(PERL))
>  libm-vec-tests = $(addprefix test-,$(libmvec-tests))
> -
> -libm-tests = $(foreach t,$(types),test-$(t) test-$(t)-finite test-i$(t)) \
> -	     $(libm-vec-tests)


> @@ -232,15 +225,42 @@ libm-test-funcs-noauto = cacos cacosh canonicalize casin casinh catan catanh \
>  libm-test-funcs-all = $(libm-test-funcs-auto) $(libm-test-funcs-noauto)
>  libm-test-c-auto = $(foreach f,$(libm-test-funcs-auto),libm-test-$(f).c)
>  libm-test-c-noauto = $(foreach f,$(libm-test-funcs-noauto),libm-test-$(f).c)
> -libm-tests-generated = libm-test-ulps.h libm-have-vector-test.h libm-test.c \
> -		       $(libm-test-c-auto) $(libm-test-c-noauto)
> -generated += $(libm-tests-generated)
> +generated += libm-test-ulps.h $(libm-test-c-auto) $(libm-test-c-noauto)
> +
> +libm-tests-base-normal = $(foreach t,$(types),test-$(t))
> +libm-tests-base-finite = $(foreach t,$(types),test-$(t)-finite)
> +libm-tests-base-inline = $(foreach t,$(types),test-i$(t))

"-i$(t))" looks like a typing error in vi - (I know this was the original syntax).
So when this is anyway changed a consistent naming style could be introduced.
Something like:
+libm-tests-base-inline = $(foreach t,$(types),test-$(t)-inline)


> +libm-tests-base = $(libm-tests-base-normal) $(libm-tests-base-finite) \
> +		  $(libm-tests-base-inline) $(libm-vec-tests)
> +libm-tests-normal = $(foreach t,$(libm-tests-base-normal),\
> +				$(foreach f,$(libm-test-funcs-all),\
> +					    $(t)-$(f)))
> +libm-tests-finite = $(foreach t,$(libm-tests-base-finite),\
> +				$(foreach f,$(libm-test-funcs-all),\
> +					    $(t)-$(f)))
> +libm-tests-inline = $(foreach t,$(libm-tests-base-inline),\
> +				$(foreach f,$(libm-test-funcs-all),\
> +					    $(t)-$(f)))
> +libm-tests-vector = $(foreach t,$(libmvec-tests),\
> +				$(foreach f,$($(t)-funcs),test-$(t)-$(f)))
> +libm-tests = $(libm-tests-normal) $(libm-tests-finite) $(libm-tests-inline) \
> +	     $(libm-tests-vector)
> +libm-tests-for-type = $(foreach f,$(libm-test-funcs-all),\
> +				  test-$(1)-$(f) test-$(1)-finite-$(f) \
> +				  test-i$(1)-$(f)) \
> +		      $(filter test-$(1)-%,$(libm-tests-vector))

> @@ -370,20 +367,111 @@ $(foreach t, $(call type-foreach, $(gen-all-calls)), \
>  
>  ifneq (no,$(PERL))
>  # This must come after the inclusion of sysdeps Makefiles via Rules.
> -$(addprefix $(objpfx), $(libm-tests.o)): $(addprefix $(objpfx),\
> -						     $(libm-tests-generated))
>  
> -$(addprefix $(objpfx),\
> -	    $(filter test-float% test-ifloat%,\
> -		     $(libm-tests))): $(objpfx)libm-test-support-float.o
> +$(foreach t,$(libm-tests-normal),$(objpfx)$(t).c): $(objpfx)test-%.c:
> +	type_func=$*; \
> +	type=$${type_func%%-*}; \
> +	func=$${type_func#*-}; \

For people that do not speak bash fluently it would be nice with a few comments here.
As inline code often grows larger over time it can be simpler to move it all to a shell
script and then handling comments and dealing with escapes are much simpler.

"%%" will delete the longest match from the back.
"#" will delete the shortest match from the front.
I wonder if you wanted to use the longest match in both cases.

> +The test drivers "test-double-<func>.c", "test-float-<func>.c", and
> +"test-ldouble-<func>.c", generated by the Makefile, test the normal
> +double, float and long double implementation of libm.  The test
> +drivers with an 'i' in their name ("test-idouble-<func>.c",
If the naming is changed to $(...)-inline this comments needs to be adjusted.

	Sam


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]