From 5f92fa16c6189102dc3e3711e2a41d44da2ba1d6 Mon Sep 17 00:00:00 2001 From: Bjarni Ingi Gislason Date: Tue, 17 May 2022 21:21:59 +0000 Subject: [PATCH] .../tests/: use one directory name instead of "./ ../ ../.." in a for-loop contrib/mm/tests/remove-stale-bib-entry-data.sh src/preproc/refer/tests/report-correct-line-numbers.sh src/roff/groff/tests/fp_should_not_traverse_directories.sh tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh tmac/tests/pdfpic_falls-back-to-PSPIC.sh Use the make-variable "abs_top_builddir" or "abs_top_srcdir" instead of "rootbuild" in a loop. When running the test files _outside_ of make, these variables must be defined with the "export" shell command. Partial fix of bug # 62478. Signed-off-by: Bjarni Ingi Gislason --- .../mm/tests/remove-stale-bib-entry-data.sh | 15 ++++++--------- .../refer/tests/report-correct-line-numbers.sh | 15 ++++++--------- .../fp_should_not_traverse_directories.sh | 15 ++++++--------- ...pic_does-not-choke-on-bad-pdfinfo-output.sh | 18 ++++++++---------- tmac/tests/pdfpic_falls-back-to-PSPIC.sh | 15 ++++++--------- 5 files changed, 32 insertions(+), 46 deletions(-) diff --git a/contrib/mm/tests/remove-stale-bib-entry-data.sh b/contrib/mm/tests/remove-stale-bib-entry-data.sh index 5fb68e6bb..29ee67ef4 100755 --- a/contrib/mm/tests/remove-stale-bib-entry-data.sh +++ b/contrib/mm/tests/remove-stale-bib-entry-data.sh @@ -32,16 +32,13 @@ wail () { # Locate directory containing our test artifacts. artifact_dir= +buildroot=$abs_top_srcdir -for buildroot in . .. ../.. -do - d=$buildroot/contrib/mm/tests/artifacts - if [ -d "$d" ] - then - artifact_dir=$d - break - fi -done +d=$buildroot/contrib/mm/tests/artifacts +if [ -d "$d" ] +then + artifact_dir=$d +fi # If we can't find it, we can't test. test -z "$artifact_dir" && exit 77 # skip diff --git a/src/preproc/refer/tests/report-correct-line-numbers.sh b/src/preproc/refer/tests/report-correct-line-numbers.sh index 19cae53ab..54768424e 100755 --- a/src/preproc/refer/tests/report-correct-line-numbers.sh +++ b/src/preproc/refer/tests/report-correct-line-numbers.sh @@ -33,15 +33,12 @@ wail () { # Locate directory containing our test artifacts. artifact_dir= -for buildroot in . .. ../.. -do - d=$buildroot/src/preproc/refer/tests/artifacts - if [ -d "$d" ] - then - artifact_dir=$d - break - fi -done +buildroot=$abs_top_srcdir +d=$buildroot/src/preproc/refer/tests/artifacts +if [ -d "$d" ] +then + artifact_dir=$d +fi # If we can't find it, we can't test. test -z "$artifact_dir" && exit 77 # skip diff --git a/src/roff/groff/tests/fp_should_not_traverse_directories.sh b/src/roff/groff/tests/fp_should_not_traverse_directories.sh index f60f42fc2..64da9b18b 100755 --- a/src/roff/groff/tests/fp_should_not_traverse_directories.sh +++ b/src/roff/groff/tests/fp_should_not_traverse_directories.sh @@ -34,15 +34,12 @@ artifact_dir= base=src/roff/groff/tests device=artifacts -for buildroot in . .. ../.. -do - d=$buildroot/$base/$device - if [ -d "$d" ] - then - artifact_dir=$d - break - fi -done +buildroot=$abs_top_srcdir +d=$buildroot/$base/$device +if [ -d "$d" ] +then + artifact_dir=$d +fi # If we can't find it, we can't test. test -z "$artifact_dir" && exit 77 # skip diff --git a/tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh b/tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh index dc1a6059f..c90f1600b 100755 --- a/tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh +++ b/tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh @@ -33,16 +33,14 @@ fi # Locate directory containing our test artifacts. artifact_dir= -for buildroot in . .. ../.. -do - d=$buildroot/doc - if [ -f $d/gnu.eps ] - then - artifact_dir=$d - gnu_eps=$artifact_dir/gnu.eps - break - fi -done +buildroot=$abs_top_builddir +d=$buildroot/doc + +if [ -f $d/gnu.eps ] +then + artifact_dir=$d + gnu_eps=$artifact_dir/gnu.eps +fi # If we can't find it, we can't test. test -z "$artifact_dir" && exit 77 # skip diff --git a/tmac/tests/pdfpic_falls-back-to-PSPIC.sh b/tmac/tests/pdfpic_falls-back-to-PSPIC.sh index a77f4311e..5c23d73d8 100755 --- a/tmac/tests/pdfpic_falls-back-to-PSPIC.sh +++ b/tmac/tests/pdfpic_falls-back-to-PSPIC.sh @@ -33,16 +33,13 @@ fi # Locate directory containing our test artifacts. artifact_dir= -for buildroot in . .. ../.. -do - d=$buildroot/doc - if [ -f $d/gnu.eps ] - then - artifact_dir=$d - gnu_eps=$artifact_dir/gnu.eps - break +buildroot=$abs_top_builddir +d=$buildroot/doc +if [ -f $d/gnu.eps ] +then + artifact_dir=$d + gnu_eps=$artifact_dir/gnu.eps fi -done # If we can't find it, we can't test. test -z "$artifact_dir" && exit 77 # skip -- 2.35.1