From f53848b85f385b9a9f2ed154e91860b458edfda3 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sat, 11 Jan 2025 17:06:11 +0100 Subject: [PATCH] Make extraction tests work without `${USER}` (fixes #378) (#383) * extract.sh: Use "grep -F" where possible * extract.sh: Set ${USER} when not set or empty in environment Signed-off-by: Sebastian Pipping --- tests/lcov/extract/extract.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/lcov/extract/extract.sh b/tests/lcov/extract/extract.sh index 575351d..ae31d7d 100755 --- a/tests/lcov/extract/extract.sh +++ b/tests/lcov/extract/extract.sh @@ -1,6 +1,8 @@ #!/bin/bash set +x +: ${USER:="$(id -u -n)"} + source ../../common.tst rm -rf *.gcda *.gcno a.out *.info* *.txt* *.json dumper* testRC *.gcov *.gcov.* *.log *.o errs *.msg *.dat @@ -217,7 +219,7 @@ if [ 0 != $? ] ; then fi fi -grep -E "\"user\":\"$USER\"" context.info.json +grep -F "\"user\":\"$USER\"" context.info.json if [ 0 != $? ] ; then echo "Error: did not find expected context field" if [ $KEEP_GOING == 0 ] ; then @@ -241,7 +243,7 @@ if [ 0 != $? ] ; then fi fi -grep -E "\"user\":\"$USER\"" context.info.json +grep -F "\"user\":\"$USER\"" context.info.json if [ 0 != $? ] ; then echo "Error: did not find expected context field" if [ $KEEP_GOING == 0 ] ; then