From ded917711e6b657444b98d93c7927991bd15e5d9 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 5 Feb 2024 22:23:38 +0900 Subject: [PATCH] fixed err.sh to produce the expected line upon failure. updated t/Makefile.am to use $(SHELL) intead of sh --- t/Makefile.am | 4 ++-- t/Makefile.in | 4 ++-- t/err.sh | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/t/Makefile.am b/t/Makefile.am index 602f20c..2485e79 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -31,8 +31,8 @@ TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(check_ERRORS) TEST_EXTENSIONS = .hcl .err -HCL_LOG_COMPILER = sh $(abs_srcdir)/run.sh ../bin/hcl --modlibdirs="@abs_top_builddir@/mod:@abs_top_builddir@/mod/.libs" --heapsize=0 -b -n +HCL_LOG_COMPILER = $(SHELL) $(abs_srcdir)/run.sh ../bin/hcl --modlibdirs="@abs_top_builddir@/mod:@abs_top_builddir@/mod/.libs" --heapsize=0 -b -n AM_HCL_LOG_FLAGS = -ERR_LOG_COMPILER = sh $(abs_srcdir)/err.sh ../bin/hcl --modlibdirs="@abs_top_builddir@/mod:@abs_top_builddir@/mod/.libs" --heapsize=0 -b -n +ERR_LOG_COMPILER = $(SHELL) $(abs_srcdir)/err.sh ../bin/hcl --modlibdirs="@abs_top_builddir@/mod:@abs_top_builddir@/mod/.libs" --heapsize=0 -b -n AM_ERR_LOG_FLAGS = diff --git a/t/Makefile.in b/t/Makefile.in index a1e844f..f8aadb6 100644 --- a/t/Makefile.in +++ b/t/Makefile.in @@ -495,9 +495,9 @@ check_ERRORS = \ EXTRA_DIST = $(check_SCRIPTS) $(check_ERRORS) TEST_EXTENSIONS = .hcl .err -HCL_LOG_COMPILER = sh $(abs_srcdir)/run.sh ../bin/hcl --modlibdirs="@abs_top_builddir@/mod:@abs_top_builddir@/mod/.libs" --heapsize=0 -b -n +HCL_LOG_COMPILER = $(SHELL) $(abs_srcdir)/run.sh ../bin/hcl --modlibdirs="@abs_top_builddir@/mod:@abs_top_builddir@/mod/.libs" --heapsize=0 -b -n AM_HCL_LOG_FLAGS = -ERR_LOG_COMPILER = sh $(abs_srcdir)/err.sh ../bin/hcl --modlibdirs="@abs_top_builddir@/mod:@abs_top_builddir@/mod/.libs" --heapsize=0 -b -n +ERR_LOG_COMPILER = $(SHELL) $(abs_srcdir)/err.sh ../bin/hcl --modlibdirs="@abs_top_builddir@/mod:@abs_top_builddir@/mod/.libs" --heapsize=0 -b -n AM_ERR_LOG_FLAGS = all: all-am diff --git a/t/err.sh b/t/err.sh index 951d51c..4cfbc70 100644 --- a/t/err.sh +++ b/t/err.sh @@ -35,7 +35,7 @@ run_partfile() { ## the regular expression is not escaped properly. the error information must not ## include specifial regex characters to avoid problems. echo "$l_output" | grep -E "ERROR:.+${l_partfile}\[${l_expected_errline},[[:digit:]]+\] ${l_expected_errmsg}" >/dev/null 2>&1 || { - echo "ERROR: error not raised - $l_script($l_partno) - $l_output" + echo "ERROR: error not raised at line $l_expected_errline - $l_script($l_partno) - $l_output" return 1 } @@ -50,7 +50,8 @@ partno=0 partlines=0 > "$partfile" -## TODO: don't use while read line.. +## dash behaves differently for read -r. +## while \n is read in literally by bash or other shells, dash converts it to a new-line while IFS= read -r line do if [ "$line" = "---" ] @@ -73,3 +74,4 @@ done < "$script" rm -f "$partfile" exit $ever_failed +