From d74f03af843c71872e60af4a59204a6cab4cd934 Mon Sep 17 00:00:00 2001 From: Eric Garver Date: Mon, 22 Jul 2019 14:48:19 -0400 Subject: [PATCH 13/20] test: functions: add CHOMP macro for shell output chomps all trailing newlines by exploiting posix shell behavior for variable expansion. (cherry picked from commit a8b90c38c19732f3dc9ca5cfedc10bb54c0d84bf) --- src/tests/functions.at | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/functions.at b/src/tests/functions.at index 28af5a7fc532..8aeaf158a066 100644 --- a/src/tests/functions.at +++ b/src/tests/functions.at @@ -226,7 +226,8 @@ m4_define([FWD_GREP_LOG], [ m4_define([TRIM], [[sed -e 's/^[ \t]*//' -e 's/[ \t]*$//']]) m4_define([TRIMV], [[sed -e '/^[ \t]*$/d']]) m4_define([TRIM_INTERNAL], [[sed -e 's/[ \t]\+/ /g']]) -m4_define([TRIM_WHITESPACE], [TRIM | TRIMV | TRIM_INTERNAL]) +m4_define([CHOMP], [printf "%s" "$(cat /dev/stdin)"]) +m4_define([TRIM_WHITESPACE], [TRIM | TRIMV | TRIM_INTERNAL | { CHOMP; echo; }]) dnl m4sugar's m4_strip has a bug that causes it to print a space after dnl newlines. So implement our own suck-less version. -- 2.20.1