diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2014-07-08 14:56:51 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2014-07-08 15:12:37 +0200 |
commit | 7904af5d9d798d230573a6a86abd7d3f5b3b51f1 (patch) | |
tree | 22dca45049f026092fb0f31ef84886756a968083 | |
parent | 8aaaf182684d46865bc22bba0e99cb250245c33c (diff) | |
download | calcurse-7904af5d9d798d230573a6a86abd7d3f5b3b51f1.tar.gz calcurse-7904af5d9d798d230573a6a86abd7d3f5b3b51f1.zip |
Implement test initialization properly
Make test-init.sh work even if tests are executed from another
directory.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
49 files changed, 52 insertions, 49 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index d88463b..44f20cc 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -51,18 +51,21 @@ TESTS = \ recur-005.sh TESTS_ENVIRONMENT = \ + TEST_INIT='$(top_srcdir)/test/test-init.sh' \ CALCURSE='$(top_builddir)/src/calcurse' \ DATA_DIR='$(top_srcdir)/test/data/' AM_CFLAGS = -std=c99 -pedantic -D_POSIX_C_SOURCE=200809L check_PROGRAMS = run-test -check_SCRIPTS = $(TESTS) +check_SCRIPTS = test-init.sh +noinst_SCRIPTS = $(check_SCRIPTS) run_test_SOURCES = run-test.c EXTRA_DIST = \ $(TESTS) \ + test-init.sh \ data/apts \ data/apts-bug-002 \ data/apts-recur \ diff --git a/test/appointment-001.sh b/test/appointment-001.sh index 6b70ff6..a1b290b 100755 --- a/test/appointment-001.sh +++ b/test/appointment-001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ ! -x "$(command -v faketime)" ]; then echo "libfaketime not found - skipping $0..." diff --git a/test/appointment-002.sh b/test/appointment-002.sh index 316373a..52bd481 100755 --- a/test/appointment-002.sh +++ b/test/appointment-002.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-002" \ diff --git a/test/appointment-003.sh b/test/appointment-003.sh index 840823f..e1ab3b6 100755 --- a/test/appointment-003.sh +++ b/test/appointment-003.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-003" \ diff --git a/test/appointment-004.sh b/test/appointment-004.sh index a24b2a8..26f1109 100755 --- a/test/appointment-004.sh +++ b/test/appointment-004.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-004" \ diff --git a/test/appointment-005.sh b/test/appointment-005.sh index 6ebdc5e..253563d 100755 --- a/test/appointment-005.sh +++ b/test/appointment-005.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-005" \ diff --git a/test/appointment-006.sh b/test/appointment-006.sh index 3e5d1a4..b66df5a 100755 --- a/test/appointment-006.sh +++ b/test/appointment-006.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-006" \ diff --git a/test/appointment-007.sh b/test/appointment-007.sh index fdad766..4351bc8 100755 --- a/test/appointment-007.sh +++ b/test/appointment-007.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-007" \ diff --git a/test/appointment-008.sh b/test/appointment-008.sh index 9f1fcff..43e7d5b 100755 --- a/test/appointment-008.sh +++ b/test/appointment-008.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-008" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-009.sh b/test/appointment-009.sh index 42caf0e..3151af2 100755 --- a/test/appointment-009.sh +++ b/test/appointment-009.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-009" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-010.sh b/test/appointment-010.sh index a3bd080..9d0e3d3 100755 --- a/test/appointment-010.sh +++ b/test/appointment-010.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-010" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-011.sh b/test/appointment-011.sh index 120388e..3e3cda3 100755 --- a/test/appointment-011.sh +++ b/test/appointment-011.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-011" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-012.sh b/test/appointment-012.sh index 5b635ef..d581c18 100755 --- a/test/appointment-012.sh +++ b/test/appointment-012.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-012" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-013.sh b/test/appointment-013.sh index b820a31..670f57d 100755 --- a/test/appointment-013.sh +++ b/test/appointment-013.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-013" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-014.sh b/test/appointment-014.sh index ef25059..6365933 100755 --- a/test/appointment-014.sh +++ b/test/appointment-014.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-014" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-015.sh b/test/appointment-015.sh index 5b18044..632db25 100755 --- a/test/appointment-015.sh +++ b/test/appointment-015.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-015" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-016.sh b/test/appointment-016.sh index 791ba86..5a2e3e5 100755 --- a/test/appointment-016.sh +++ b/test/appointment-016.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-016" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-017.sh b/test/appointment-017.sh index 58355b8..cf751dc 100755 --- a/test/appointment-017.sh +++ b/test/appointment-017.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-017" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-018.sh b/test/appointment-018.sh index 814b410..0cfe387 100755 --- a/test/appointment-018.sh +++ b/test/appointment-018.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-018" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-019.sh b/test/appointment-019.sh index d946e88..92b715a 100755 --- a/test/appointment-019.sh +++ b/test/appointment-019.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-019" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-020.sh b/test/appointment-020.sh index abb2c76..1d99950 100755 --- a/test/appointment-020.sh +++ b/test/appointment-020.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-020" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-021.sh b/test/appointment-021.sh index 214d3ec..67c7ae0 100755 --- a/test/appointment-021.sh +++ b/test/appointment-021.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-021" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/appointment-022.sh b/test/appointment-022.sh index 8ff0f81..1b48a1e 100755 --- a/test/appointment-022.sh +++ b/test/appointment-022.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-appointment-022" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/bug-002.sh b/test/bug-002.sh index c52f744..bf8ef85 100755 --- a/test/bug-002.sh +++ b/test/bug-002.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-bug-002" \ diff --git a/test/day-001.sh b/test/day-001.sh index da8a192..94b415e 100755 --- a/test/day-001.sh +++ b/test/day-001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -d02/25/2011 diff --git a/test/day-002.sh b/test/day-002.sh index c46da32..155536f 100755 --- a/test/day-002.sh +++ b/test/day-002.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ ! -x "$(command -v faketime)" ]; then echo "libfaketime not found - skipping $0..." diff --git a/test/day-003.sh b/test/day-003.sh index 619c8e6..ea72797 100755 --- a/test/day-003.sh +++ b/test/day-003.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ ! -x "$(command -v faketime)" ]; then echo "libfaketime not found - skipping $0..." diff --git a/test/event-001.sh b/test/event-001.sh index aa5e50d..f731f9b 100755 --- a/test/event-001.sh +++ b/test/event-001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-event-001" \ diff --git a/test/event-002.sh b/test/event-002.sh index 730f432..728544c 100755 --- a/test/event-002.sh +++ b/test/event-002.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-event-002" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/event-003.sh b/test/event-003.sh index f4cfafe..46f1215 100755 --- a/test/event-003.sh +++ b/test/event-003.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-event-003" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/event-004.sh b/test/event-004.sh index c38374b..f3180c2 100755 --- a/test/event-004.sh +++ b/test/event-004.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-event-004" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/event-005.sh b/test/event-005.sh index 38d4108..7320736 100755 --- a/test/event-005.sh +++ b/test/event-005.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-event-005" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/event-006.sh b/test/event-006.sh index a0ca115..0968915 100755 --- a/test/event-006.sh +++ b/test/event-006.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-event-006" \ -d02/23/2013 2>errors && exit 1 diff --git a/test/next-001.sh b/test/next-001.sh index 4c9ab95..f64afda 100755 --- a/test/next-001.sh +++ b/test/next-001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ ! -x "$(command -v faketime)" ]; then echo "libfaketime not found - skipping $0..." diff --git a/test/range-001.sh b/test/range-001.sh index 91f3c0f..f3646b5 100755 --- a/test/range-001.sh +++ b/test/range-001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ ! -x "$(command -v faketime)" ]; then echo "libfaketime not found - skipping $0..." diff --git a/test/range-002.sh b/test/range-002.sh index 8703f3a..e04ef35 100755 --- a/test/range-002.sh +++ b/test/range-002.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ ! -x "$(command -v faketime)" ]; then echo "libfaketime not found - skipping $0..." diff --git a/test/range-003.sh b/test/range-003.sh index 4716d00..4573787 100755 --- a/test/range-003.sh +++ b/test/range-003.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ ! -x "$(command -v faketime)" ]; then echo "libfaketime not found - skipping $0..." diff --git a/test/recur-001.sh b/test/recur-001.sh index ae4e025..59dd9bc 100755 --- a/test/recur-001.sh +++ b/test/recur-001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \ diff --git a/test/recur-002.sh b/test/recur-002.sh index f22bd5e..e385c1a 100755 --- a/test/recur-002.sh +++ b/test/recur-002.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \ diff --git a/test/recur-003.sh b/test/recur-003.sh index 7e91cd6..feb00ba 100755 --- a/test/recur-003.sh +++ b/test/recur-003.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \ diff --git a/test/recur-004.sh b/test/recur-004.sh index d218b21..4e7ecee 100755 --- a/test/recur-004.sh +++ b/test/recur-004.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \ diff --git a/test/recur-005.sh b/test/recur-005.sh index 25b8ce5..8ab1bf9 100755 --- a/test/recur-005.sh +++ b/test/recur-005.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \ diff --git a/test/run-test-001.sh b/test/run-test-001.sh index 580e64c..0a77dcc 100755 --- a/test/run-test-001.sh +++ b/test/run-test-001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' -o "$1" = 'expected' ]; then echo 42 diff --git a/test/run-test-002.sh b/test/run-test-002.sh index 0c40419..0986d12 100755 --- a/test/run-test-002.sh +++ b/test/run-test-002.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then echo 23 diff --git a/test/search-001.sh b/test/search-001.sh index 9be0a3b..810109a 100755 --- a/test/search-001.sh +++ b/test/search-001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ ! -x "$(command -v faketime)" ]; then echo "libfaketime not found - skipping $0..." diff --git a/test/todo-001.sh b/test/todo-001.sh index 013e130..bbefe1d 100755 --- a/test/todo-001.sh +++ b/test/todo-001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -t | sort diff --git a/test/todo-002.sh b/test/todo-002.sh index b62b60e..9e06dc3 100755 --- a/test/todo-002.sh +++ b/test/todo-002.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -t3 diff --git a/test/todo-003.sh b/test/todo-003.sh index 3f18288..c86d9c5 100755 --- a/test/todo-003.sh +++ b/test/todo-003.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" if [ "$1" = 'actual' ]; then "$CALCURSE" --read-only -D "$DATA_DIR"/ -t0 | sort -n diff --git a/test/true-001.sh b/test/true-001.sh index b69e4bd..067db46 100755 --- a/test/true-001.sh +++ b/test/true-001.sh @@ -1,5 +1,5 @@ #!/bin/sh -. ./test-init.sh +. "${TEST_INIT:-./test-init.sh}" true |