test-framework-sh: Fix typo in function invocation (regression 2024-06-11).
I noticed that tests/init.sh is copied to many GNU projects for their own test suite (manually I assume). This means that on BSD the use of '-t' spams the -p directories in /tmp. I noticed this when looking at something unrelated in diffutils earlier. While copying the file over I noticed a call to 'fail_' had a typo. I've committed this patch fixing it. If someone wants to update these packages that would be nice. :) $ find . -name 'init.sh' | xargs grep -l 'mktemp -d -t -p' ./cppi/tests/init.sh ./diffutils/tests/init.sh ./grep/tests/init.sh ./parted/tests/init.sh ./sed/testsuite/init.sh ./vc-dwim/tests/init.sh ./gzip/tests/init.sh ./findutils/tests/init.sh Collin >From 9055dbb4a0585eaf7d8e98d1ddb0f47e4ffe22fa Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sun, 23 Jun 2024 18:28:26 -0700 Subject: [PATCH] test-framework-sh: Fix typo in function invocation (regression 2024-06-11). * tests/init.sh (mktempd_): Invoke fail_ properly. --- ChangeLog | 5 + tests/init.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bf82a188fc..5972064bdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-06-23 Collin Funk + + test-framework-sh: Fix typo in function invocation (regression 2024-06-11). + * tests/init.sh (mktempd_): Invoke fail_ properly. + 2024-06-22 Bruno Haible obstack-zprintf: Add more tests. diff --git a/tests/init.sh b/tests/init.sh index c374e5f014..d33ef61788 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -338,7 +338,7 @@ mktempd_ () esac case $template_ in - -*) fail _ \ + -*) fail_ \ "invalid template: $template_ (must not begin with '-')";; *) ;; *) fail_ \ -- 2.45.2
Re: tests/init.sh
Collin Funk wrote: > If someone wants to update these packages that would be nice. :) > > $ find . -name 'init.sh' | xargs grep -l 'mktemp -d -t -p' > ./cppi/tests/init.sh > ./diffutils/tests/init.sh > ./grep/tests/init.sh > ./parted/tests/init.sh > ./sed/testsuite/init.sh > ./vc-dwim/tests/init.sh > ./gzip/tests/init.sh > ./findutils/tests/init.sh Rather than having to sync this file from gnulib manually, it would be better if the 'bootstrap.conf' file of each of the packages would contain an invocation of gnulib-tool --copy-file tests/init.sh This would make this sync automatic. Bruno
Re: tests/init.sh
Hi Bruno, Bruno Haible writes: > Rather than having to sync this file from gnulib manually, it would > be better if the 'bootstrap.conf' file of each of the packages > would contain an invocation of > gnulib-tool --copy-file tests/init.sh > This would make this sync automatic. Agreed. I don't see that option used much. So I think it is worth mentioning that projects like sed will need to use the --tests-base option. > ./sed/testsuite/init.sh $ gnulib-tool --tests-base testsuite --copy-file tests/init.sh Will work correctly. Maybe in bootstrap_post_import_hook or bootstrap_epilogue. Collin
Re: tests/init.sh
Collin Funk wrote: > I don't see that option used much. GNU poke uses it in bootstrap.conf. > So I think it is worth mentioning > that projects like sed will need to use the --tests-base option. No, that would add constraints between things that better stay independent: - the import of Gnulib tests into the package (if desired), - the use of init.sh for the package's own tests. > Maybe in bootstrap_post_import_hook or bootstrap_epilogue. bootstrap_post_import_hook is the right place, according to the documentation in top/bootstrap-funclib.sh. Bruno
Re: tests/init.sh
Bruno Haible writes: >> So I think it is worth mentioning >> that projects like sed will need to use the --tests-base option. > > No, that would add constraints between things that better stay > independent: > - the import of Gnulib tests into the package (if desired), > - the use of init.sh for the package's own tests. I think my short explanation may have caused a misunderstanding. I was trying to point out that 'gnulib-tool --copy-file tests/init.sh' relies on a project using the 'tests' subdirectory for their own test suite. This is not the case for GNU sed. Here is my clean checkout: $ find . -name 'init.sh' ./testsuite/init.sh Then after running ./bootstrap to import Gnulib: $ find . -name 'init.sh' ./gnulib-tests/init.sh ./testsuite/init.sh Here is why 'gnulib-tool --copy-file tests/init.sh' is not correct: $ stat tests stat: cannot statx 'tests': No such file or directory $ gnulib-tool --copy-file tests/init.sh Copying file tests/init.sh $ ls tests init.sh So the file is placed in the wrong directory. The 'tests' sudirectory is created silently. My solution was to use --tests-base to adjust the location of the file. In a clean checkout: $ gnulib-tool --tests-base testsuite --copy-file tests/init.sh $ git status --short M testsuite/init.sh Though this would work too and is probably more clear: $ gnulib-tool --copy-file tests/init.sh testsuite/init.sh I assume the use of --tests-base caused some confusion here since that is used for importing the Gnulib test suite. It felt a bit strange to me atleast, but it worked. Collin