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:
parent
8aaaf18268
commit
7904af5d9d
@ -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 \
|
||||
|
@ -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..."
|
||||
|
@ -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" \
|
||||
|
@ -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" \
|
||||
|
@ -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" \
|
||||
|
@ -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" \
|
||||
|
@ -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" \
|
||||
|
@ -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" \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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" \
|
||||
|
@ -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
|
||||
|
@ -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..."
|
||||
|
@ -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..."
|
||||
|
@ -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" \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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..."
|
||||
|
@ -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..."
|
||||
|
@ -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..."
|
||||
|
@ -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..."
|
||||
|
@ -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" \
|
||||
|
@ -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" \
|
||||
|
@ -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" \
|
||||
|
@ -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" \
|
||||
|
@ -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" \
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./test-init.sh
|
||||
. "${TEST_INIT:-./test-init.sh}"
|
||||
|
||||
if [ "$1" = 'actual' -o "$1" = 'expected' ]; then
|
||||
echo 42
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./test-init.sh
|
||||
. "${TEST_INIT:-./test-init.sh}"
|
||||
|
||||
if [ "$1" = 'actual' ]; then
|
||||
echo 23
|
||||
|
@ -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..."
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./test-init.sh
|
||||
. "${TEST_INIT:-./test-init.sh}"
|
||||
|
||||
true
|
||||
|
Loading…
x
Reference in New Issue
Block a user