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>
This commit is contained in:
Lukas Fleischer 2014-07-08 14:56:51 +02:00
parent 8aaaf18268
commit 7904af5d9d
49 changed files with 52 additions and 49 deletions

View File

@ -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 \

View File

@ -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..."

View File

@ -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" \

View File

@ -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" \

View File

@ -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" \

View File

@ -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" \

View File

@ -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" \

View File

@ -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" \

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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" \

View File

@ -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

View File

@ -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..."

View File

@ -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..."

View File

@ -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" \

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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..."

View File

@ -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..."

View File

@ -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..."

View File

@ -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..."

View File

@ -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" \

View File

@ -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" \

View File

@ -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" \

View File

@ -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" \

View File

@ -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" \

View File

@ -1,6 +1,6 @@
#!/bin/sh
. ./test-init.sh
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' -o "$1" = 'expected' ]; then
echo 42

View File

@ -1,6 +1,6 @@
#!/bin/sh
. ./test-init.sh
. "${TEST_INIT:-./test-init.sh}"
if [ "$1" = 'actual' ]; then
echo 23

View File

@ -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..."

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,5 @@
#!/bin/sh
. ./test-init.sh
. "${TEST_INIT:-./test-init.sh}"
true