tests: use a portable 'truncate' implementation

Suggested by Paul Eggert.
https://lists.gnu.org/archive/html/bison-patches/2019-10/msg00044.html

* tests/local.at (AT_DATA_NO_FINAL_EOL): Use dd instead of perl.
This commit is contained in:
Akim Demaille
2019-10-14 07:58:36 +02:00
parent 8631f35bf9
commit ab3621678a

View File

@@ -57,7 +57,11 @@ m4_define([AT_SETUP_STRIP],
m4_define([AT_DATA_NO_FINAL_EOL],
[AT_DATA([$1], [$2
])
AT_PERL_REQUIRE([[-pi -e 'chomp if eof' $1]])
AT_REQUIRE([
set x $(LC_ALL=C ls -l '$1') &&
size=$][6 &&
{ test $size -eq 0 || dd obs=1 seek=`expr $size - 1` if=/dev/null of='$1'; }],
[], [ignore], [ignore])
])