From 1e243dba907f05f46bc2e528aad7408d8009eff7 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 13 Oct 2020 20:43:37 -0400 Subject: Fix parallelized test runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not share a common temporary directory between different test cases. Reported-by: Tomasz Kłoczko Signed-off-by: Lukas Fleischer --- test/ical-001.sh | 12 ++++++------ test/ical-002.sh | 10 +++++----- test/ical-003.sh | 14 +++++++------- test/ical-004.sh | 12 ++++++------ test/ical-005.sh | 12 ++++++------ test/ical-006.sh | 10 +++++----- test/ical-007.sh | 12 ++++++------ test/ical-008.sh | 12 ++++++------ test/ical-009.sh | 10 +++++----- test/ical-010.sh | 12 ++++++------ test/ical-011.sh | 21 ++++++++++----------- test/ical-012.sh | 10 +++++----- test/ical-013.sh | 10 +++++----- test/ical-014.sh | 10 +++++----- 14 files changed, 83 insertions(+), 84 deletions(-) (limited to 'test') diff --git a/test/ical-001.sh b/test/ical-001.sh index 4ff1bfe..c8005a7 100755 --- a/test/ical-001.sh +++ b/test/ical-001.sh @@ -3,12 +3,12 @@ . "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then - mkdir .calcurse || exit 1 - cp "$DATA_DIR/conf" .calcurse || exit 1 - "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-001.ical" - "$CALCURSE" -D "$PWD/.calcurse" -s01/01/1980 -r2 - "$CALCURSE" -D "$PWD/.calcurse" -t - rm -rf .calcurse || exit 1 + tmpdir=$(mktemp -d) + cp "$DATA_DIR/conf" "$tmpdir" || exit 1 + "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-001.ical" + "$CALCURSE" -D "$tmpdir" -s01/01/1980 -r2 + "$CALCURSE" -D "$tmpdir" -t + rm -rf "$tmpdir" || exit 1 elif [ "$1" = 'expected' ]; then cat <&1) + tmpdir=$(mktemp -d) + cp "$DATA_DIR/conf" "$tmpdir" || exit 1 + out=$("$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-009.ical" 2>&1) # Print the import report (stdout). echo "$out" | awk '$1 == "Import"; $2 == "apps"' # Find the log file and print the log messages (stderr). logfile=$(echo "$out" | awk '$1 == "See" { print $2 }') sed '1,18d' "$logfile" # One empty note file. - cat "$PWD/.calcurse/notes"/* | wc | awk '{ print $1 $2 $3 }' - rm -rf .calcurse || exit 1 + cat "$tmpdir/notes"/* | wc | awk '{ print $1 $2 $3 }' + rm -rf "$tmpdir" || exit 1 elif [ "$1" = 'expected' ]; then cat < "$PWD"/.calcurse/export.ical && -(cd .calcurse; mv apts apts-export; mv todo todo-export) && -"$CALCURSE" -D "$PWD/.calcurse" --quiet --import \ - "$PWD"/.calcurse/export.ical && -(cd .calcurse; cmp -s apts-export apts) && -(cd .calcurse; cmp -s todo-export todo) && +"$CALCURSE" -D "$tmpdir" --export=ical >"$tmpdir"/export.ical && +(cd "$tmpdir"; mv apts apts-export; mv todo todo-export) && +"$CALCURSE" -D "$tmpdir" --quiet --import "$tmpdir"/export.ical && +(cd "$tmpdir"; cmp -s apts-export apts) && +(cd "$tmpdir"; cmp -s todo-export todo) && status=0 || status=1 -rm -rf .calcurse +rm -rf "$tmpdir" || exit 1 exit $status diff --git a/test/ical-012.sh b/test/ical-012.sh index f4b27df..38ae673 100755 --- a/test/ical-012.sh +++ b/test/ical-012.sh @@ -7,11 +7,11 @@ . "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then - mkdir .calcurse && - cp "$DATA_DIR/conf" .calcurse || exit 1 - "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-012.ical" - (cd "$PWD/.calcurse/notes/"; cat $(ls -S1)) - rm -rf .calcurse || exit 1 + tmpdir=$(mktemp -d) + cp "$DATA_DIR/conf" "$tmpdir" || exit 1 + "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-012.ical" + (cd "$tmpdir/notes/"; cat $(ls -S1)) + rm -rf "$tmpdir" || exit 1 elif [ "$1" = 'expected' ]; then cat <