From 37cf21cfd0754b6fd196098968df3bdc1c2473a9 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 28 Aug 2021 10:50:32 +0200 Subject: [PATCH] TeX tests: Use the shell instead of wc to test for maximum line length. When testing for maximum line length use the shell rather than relying on wc -L : The -L flag is not present on some systems. tests/tex.at: Remove dependence on wc configure.ac: Remove test for wc -L Fixes bug #59859 --- configure.ac | 2 -- tests/output/tex.at | 15 +++++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index dfc4baf60c..3aa807cee9 100644 --- a/configure.ac +++ b/configure.ac @@ -68,8 +68,6 @@ PSPP_PERL PSPP_PYTHON AC_CHECK_PROGS([TEX], [tex], [no]) AC_SUBST([TEX]) -AC_CHECK_PROGS([GWC], [gwc wc], [no]) -AC_SUBST([GWC]) # This suppresses an error in gl/careadlinkat.c that otherwise can't be # avoided in GCC 10.x: diff --git a/tests/output/tex.at b/tests/output/tex.at index f4708def02..1ee1681a35 100644 --- a/tests/output/tex.at +++ b/tests/output/tex.at @@ -163,7 +163,9 @@ test -z "$at_arg_xdvi" || AT_CHECK([$at_arg_xdvi -s 3 pspp.dvi], [0], [ignore]) AT_CLEANUP - +dnl Check that no line exceeds 79 characters +m4_define([CHECK_MAX_LINE_LENGTH], +[[(while IFS= read -r line; do max=$(( max > ${#line} ? max : ${#line} )); done; test $max -le 80)]][ < $1]) AT_SETUP([tex simple example]) @@ -181,7 +183,7 @@ descriptives /score. AT_CHECK([pspp -O format=tex simple.sps], [0], []) -AT_CHECK([test $($GWC -L pspp.tex | awk '{print $1}') -le 80], [0], [ignore]) +AT_CHECK([CHECK_MAX_LINE_LENGTH([pspp.tex])],[0],[ignore]) AT_SKIP_IF([test "$TEX" = no]) AT_CHECK([$TEX --halt-on-error pspp.tex], [0], [ignore]) @@ -200,7 +202,8 @@ AT_CLEANUP AT_SETUP([tex another example]) AT_CHECK([pspp -O format=tex "$abs_top_srcdir/examples/regress.sps"], [0], []) -AT_CHECK([test $($GWC -L pspp.tex | awk '{print $1}') -le 80], [0], [ignore]) +AT_CHECK([CHECK_MAX_LINE_LENGTH([pspp.tex])],[0],[ignore]) + AT_SKIP_IF([test "$TEX" = no]) AT_CHECK([$TEX --halt-on-error pspp.tex], [0], [ignore]) @@ -234,7 +237,7 @@ correlations ]) AT_CHECK([pspp -O format=tex footnote.sps], [0], []) -AT_CHECK([test $($GWC -L pspp.tex | awk '{print $1}') -le 80], [0], [ignore]) +AT_CHECK([CHECK_MAX_LINE_LENGTH([pspp.tex])],[0],[ignore]) AT_SKIP_IF([test "$TEX" = no]) AT_CHECK([$TEX --halt-on-error pspp.tex], [0], [ignore]) @@ -275,7 +278,7 @@ frequencies items. ]) AT_CHECK([LC_ALL=C.UTF-8 pspp -O format=tex utf8.sps], [0], []) -AT_CHECK([test $($GWC -L pspp.tex | awk '{print $1}') -le 80], [0], [ignore]) +AT_CHECK([CHECK_MAX_LINE_LENGTH([pspp.tex])],[0],[ignore]) dnl The string "??" should not be present in pspp.tex AT_CHECK([grep -F '??' pspp.tex], [1]) @@ -315,7 +318,7 @@ t-test /variables=score /group=group("this", "that"). ]) AT_CHECK([pspp -O format=tex t-test.sps], [0], []) -AT_CHECK([test $($GWC -L pspp.tex | awk '{print $1}') -le 80], [0], [ignore]) +AT_CHECK([CHECK_MAX_LINE_LENGTH([pspp.tex])],[0],[ignore]) AT_SKIP_IF([test "$TEX" = no]) AT_CHECK([$TEX --halt-on-error pspp.tex], [0], [ignore]) -- 2.30.2