Fix parallelized test runs

Do not share a common temporary directory between different test cases.

Reported-by: Tomasz Kłoczko <kloczko.tomasz@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lukas Fleischer 2020-10-13 20:43:37 -04:00
parent d960391bd5
commit 1e243dba90
14 changed files with 83 additions and 84 deletions

View File

@ -3,12 +3,12 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
"$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-001.ical" "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-001.ical"
"$CALCURSE" -D "$PWD/.calcurse" -s01/01/1980 -r2 "$CALCURSE" -D "$tmpdir" -s01/01/1980 -r2
"$CALCURSE" -D "$PWD/.calcurse" -t "$CALCURSE" -D "$tmpdir" -t
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
Import process report: 0012 lines read Import process report: 0012 lines read

View File

@ -3,11 +3,11 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
"$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-002.ical" "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-002.ical"
"$CALCURSE" -D "$PWD/.calcurse" -s01/01/2000 -r2 "$CALCURSE" -D "$tmpdir" -s01/01/2000 -r2
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
Import process report: 0028 lines read Import process report: 0028 lines read

View File

@ -4,13 +4,13 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
"$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-003.ical" "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-003.ical"
"$CALCURSE" -D "$PWD/.calcurse" -s01/01/2000 -r365 "$CALCURSE" -D "$tmpdir" -s01/01/2000 -r365
"$CALCURSE" -D "$PWD/.calcurse" -s05/01/2020 --to 01/01/2023 "$CALCURSE" -D "$tmpdir" -s05/01/2020 --to 01/01/2023
cat "$PWD/.calcurse/notes"/* cat "$tmpdir/notes"/*
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
Import process report: 0070 lines read Import process report: 0070 lines read

View File

@ -3,12 +3,12 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
"$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-004.ical" "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-004.ical"
"$CALCURSE" -D "$PWD/.calcurse" -s01/01/1980 -r2 "$CALCURSE" -D "$tmpdir" -s01/01/1980 -r2
"$CALCURSE" -D "$PWD/.calcurse" -t "$CALCURSE" -D "$tmpdir" -t
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
Import process report: 0012 lines read Import process report: 0012 lines read

View File

@ -3,12 +3,12 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
"$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-005.ical" "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-005.ical"
"$CALCURSE" -D "$PWD/.calcurse" -s10/03/2013 -r3 "$CALCURSE" -D "$tmpdir" -s10/03/2013 -r3
cat "$PWD/.calcurse/notes"/* cat "$tmpdir/notes"/*
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
Import process report: 0023 lines read Import process report: 0023 lines read

View File

@ -3,11 +3,11 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
"$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-006.ical" "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-006.ical"
"$CALCURSE" -D "$PWD/.calcurse" -s06/01/2012 -r2 "$CALCURSE" -D "$tmpdir" -s06/01/2012 -r2
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
Import process report: 0063 lines read Import process report: 0063 lines read

View File

@ -3,13 +3,13 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
TZ="America/New_York" "$CALCURSE" -D "$PWD/.calcurse" \ TZ="America/New_York" "$CALCURSE" -D "$tmpdir" \
-i "$DATA_DIR/ical-007.ical" -i "$DATA_DIR/ical-007.ical"
"$CALCURSE" -D "$PWD/.calcurse" -s02/23/2015 "$CALCURSE" -D "$tmpdir" -s02/23/2015
cat "$PWD/.calcurse/notes/"* cat "$tmpdir/notes/"*
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
Import process report: 0018 lines read Import process report: 0018 lines read

View File

@ -3,12 +3,12 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
"$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-008.ical" "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-008.ical"
"$CALCURSE" -D "$PWD/.calcurse" -s01/01/1980 -r2 "$CALCURSE" -D "$tmpdir" -s01/01/1980 -r2
"$CALCURSE" -D "$PWD/.calcurse" -t "$CALCURSE" -D "$tmpdir" -t
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
Import process report: 0012 lines read Import process report: 0012 lines read

View File

@ -4,17 +4,17 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
out=$("$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-009.ical" 2>&1) out=$("$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-009.ical" 2>&1)
# Print the import report (stdout). # Print the import report (stdout).
echo "$out" | awk '$1 == "Import"; $2 == "apps"' echo "$out" | awk '$1 == "Import"; $2 == "apps"'
# Find the log file and print the log messages (stderr). # Find the log file and print the log messages (stderr).
logfile=$(echo "$out" | awk '$1 == "See" { print $2 }') logfile=$(echo "$out" | awk '$1 == "See" { print $2 }')
sed '1,18d' "$logfile" sed '1,18d' "$logfile"
# One empty note file. # One empty note file.
cat "$PWD/.calcurse/notes"/* | wc | awk '{ print $1 $2 $3 }' cat "$tmpdir/notes"/* | wc | awk '{ print $1 $2 $3 }'
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
Import process report: 0121 lines read Import process report: 0121 lines read

View File

@ -4,12 +4,12 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
cp "$DATA_DIR/apts-export" .calcurse/apts || exit 1 cp "$DATA_DIR/apts-export" "$tmpdir"/apts || exit 1
cp "$DATA_DIR/todo-export" .calcurse/todo || exit 1 cp "$DATA_DIR/todo-export" "$tmpdir"/todo || exit 1
"$CALCURSE" -D "$PWD/.calcurse" --export=ical | sed '/^PRODID/d' "$CALCURSE" -D "$tmpdir" --export=ical | sed '/^PRODID/d'
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
BEGIN:VCALENDAR BEGIN:VCALENDAR

View File

@ -3,18 +3,17 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
cp "$DATA_DIR/apts-export" .calcurse/apts || exit 1 cp "$DATA_DIR/apts-export" "$tmpdir"/apts || exit 1
cp "$DATA_DIR/todo-export" .calcurse/todo || exit 1 cp "$DATA_DIR/todo-export" "$tmpdir"/todo || exit 1
"$CALCURSE" -D "$PWD/.calcurse" --export=ical > "$PWD"/.calcurse/export.ical && "$CALCURSE" -D "$tmpdir" --export=ical >"$tmpdir"/export.ical &&
(cd .calcurse; mv apts apts-export; mv todo todo-export) && (cd "$tmpdir"; mv apts apts-export; mv todo todo-export) &&
"$CALCURSE" -D "$PWD/.calcurse" --quiet --import \ "$CALCURSE" -D "$tmpdir" --quiet --import "$tmpdir"/export.ical &&
"$PWD"/.calcurse/export.ical && (cd "$tmpdir"; cmp -s apts-export apts) &&
(cd .calcurse; cmp -s apts-export apts) && (cd "$tmpdir"; cmp -s todo-export todo) &&
(cd .calcurse; cmp -s todo-export todo) &&
status=0 || status=1 status=0 || status=1
rm -rf .calcurse rm -rf "$tmpdir" || exit 1
exit $status exit $status

View File

@ -7,11 +7,11 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse && tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
"$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/ical-012.ical" "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/ical-012.ical"
(cd "$PWD/.calcurse/notes/"; cat $(ls -S1)) (cd "$tmpdir/notes/"; cat $(ls -S1))
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
Import process report: 0089 lines read Import process report: 0089 lines read

View File

@ -4,11 +4,11 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
TZ=America/New_York "$CALCURSE" -D "$PWD/.calcurse" -i "$DATA_DIR/rfc5545.ical" TZ=America/New_York "$CALCURSE" -D "$tmpdir" -i "$DATA_DIR/rfc5545.ical"
"$CALCURSE" -D "$PWD/.calcurse" -s09/01/1997 -r365 "$CALCURSE" -D "$tmpdir" -s09/01/1997 -r365
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat <<EOD cat <<EOD
Import process report: 0238 lines read Import process report: 0238 lines read

View File

@ -4,17 +4,17 @@
. "${TEST_INIT:-./test-init.sh}" . "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then if [ "$1" = 'actual' ]; then
mkdir .calcurse || exit 1 tmpdir=$(mktemp -d)
cp "$DATA_DIR/conf" .calcurse || exit 1 cp "$DATA_DIR/conf" "$tmpdir" || exit 1
"$CALCURSE" -q -D "$PWD/.calcurse" -i "$DATA_DIR/ical-014.ical" "$CALCURSE" -q -D "$tmpdir" -i "$DATA_DIR/ical-014.ical"
"$CALCURSE" -D "$PWD/.calcurse" -x | "$CALCURSE" -D "$tmpdir" -x |
sed -n ' sed -n '
/DESCRIPTION/p /DESCRIPTION/p
/LOCATION/p /LOCATION/p
/COMMENT/p /COMMENT/p
' | ' |
sort sort
rm -rf .calcurse || exit 1 rm -rf "$tmpdir" || exit 1
elif [ "$1" = 'expected' ]; then elif [ "$1" = 'expected' ]; then
cat "$DATA_DIR/ical-014.ical" | cat "$DATA_DIR/ical-014.ical" |
sed -n ' sed -n '