diff --git a/CMakeLists.txt b/CMakeLists.txt index fd68b59bf..2c5805a3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,9 +145,9 @@ add_subdirectory (src/shell) add_subdirectory (doc) add_subdirectory (i18n) add_subdirectory (scripts) -if (EXISTS test) +if (EXISTS ${CMAKE_SOURCE_DIR}/test) add_subdirectory (test EXCLUDE_FROM_ALL) -endif (EXISTS test) +endif (EXISTS ${CMAKE_SOURCE_DIR}/test) if (EXISTS performance) add_subdirectory (performance EXCLUDE_FROM_ALL) endif (EXISTS performance) diff --git a/ChangeLog b/ChangeLog index d395c4c52..2093ec52c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ Features Gill). + #1227 A new 'verify_l10n' utility ensures the localizations are in sync (thanks to Wim Schuermann). + + #1250 Support out-of-tree test runs (thanks to Jakub Wilk). + Stores un-synched transactions in /backlog.data. + Adds a new 'synchronize' command to sync data with a task server. + Adds a new 'sync' verbosity token, which will reminds when a backlog builds diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index dd6fda4f6..6da3406de 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -12,17 +12,29 @@ set (test_SRCS autocomplete.t color.t config.t date.t directory.t dom.t width.t json_test) message ("-- Configuring run_all") -set (TESTBLOB "*.t") +if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + +set (TESTBLOB "./*.t") if (CYGWIN) -set (TESTBLOB "*.t *.t.exe") +set (TESTBLOB "./*.t ./*.t.exe") endif (CYGWIN) + +else (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + +set (TESTBLOB "${CMAKE_SOURCE_DIR}/test/*.t ${CMAKE_BINARY_DIR}/test/*.t") +if (CYGWIN) +set (TESTBLOB "${CMAKE_SOURCE_DIR}/test/*.t ${CMAKE_BINARY_DIR}/test/*.t.exe") +endif (CYGWIN) + +endif (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + configure_file ( - ${CMAKE_SOURCE_DIR}/test/run_all.in - ${CMAKE_SOURCE_DIR}/test/run_all) + run_all.in + run_all) add_custom_target (test ./run_all --verbose DEPENDS ${test_SRCS} task_executable - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test) + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test) add_custom_target (build_tests DEPENDS ${test_SRCS} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test) diff --git a/test/bash_completion.t b/test/bash_completion.t index 4d1892042..2fa0a462a 100755 --- a/test/bash_completion.t +++ b/test/bash_completion.t @@ -41,10 +41,13 @@ if (open my $fh, '>', 'bug.rc') ok (-r 'bug.rc', 'Created bug.rc'); } +my $source_dir = $0; +$source_dir =~ s{[^/]+$}{..}; + # Copy task.sh and make substitutions & additions needed for testing. if (open my $target, '>', 'task.sh') { - if (open my $source, '<', '../scripts/bash/task.sh') + if (open my $source, '<', "$source_dir/scripts/bash/task.sh") { while (<$source>) { diff --git a/test/export.yaml.t b/test/export.yaml.t index 614d1be93..9d307f96a 100755 --- a/test/export.yaml.t +++ b/test/export.yaml.t @@ -30,6 +30,9 @@ use strict; use warnings; use Test::More tests => 22; +my $source_dir = $0; +$source_dir =~ s{[^/]+$}{..}; + # Create the rc file. if (open my $fh, '>', 'export.rc') { @@ -44,7 +47,7 @@ if (open my $fh, '>', 'export.rc') qx{../src/task rc:export.rc add priority:H project:A one 2>&1}; qx{../src/task rc:export.rc add +tag1 +tag2 two 2>&1}; -my $output = qx{../src/task rc:export.rc export | ../scripts/add-ons/export-yaml.pl > ./export.txt 2>&1}; +my $output = qx{../src/task rc:export.rc export | $source_dir/scripts/add-ons/export-yaml.pl > ./export.txt 2>&1}; my @lines; if (open my $fh, '<', './export.txt') { diff --git a/test/import.todo.sh.t b/test/import.todo.sh.t index da82caa8f..45da5b7ba 100755 --- a/test/import.todo.sh.t +++ b/test/import.todo.sh.t @@ -30,6 +30,9 @@ use strict; use warnings; use Test::More tests => 26; +my $source_dir = $0; +$source_dir =~ s{[^/]+$}{..}; + # Create the rc file. if (open my $fh, '>', 'import.rc') { @@ -64,7 +67,7 @@ if (open my $fh, '>', 'import.txt') } # Convert todo.sh --> task JSON. -qx{../scripts/add-ons/import-todo.sh.pl import.json 2>&1}; +qx{$source_dir/scripts/add-ons/import-todo.sh.pl import.json 2>&1}; # Import the JSON. my $output = qx{../src/task rc:import.rc import import.json 2>&1}; diff --git a/test/import.yaml.t b/test/import.yaml.t index 008474aec..0af9a8964 100755 --- a/test/import.yaml.t +++ b/test/import.yaml.t @@ -30,6 +30,9 @@ use strict; use warnings; use Test::More tests => 16; +my $source_dir = $0; +$source_dir =~ s{[^/]+$}{..}; + # Create the rc file. if (open my $fh, '>', 'import.rc') { @@ -71,7 +74,7 @@ EOF } # Convert YAML --> task JSON. -qx{../scripts/add-ons/import-yaml.pl import.json 2>&1}; +qx{$source_dir/scripts/add-ons/import-yaml.pl import.json 2>&1}; # Import the JSON. my $output = qx{../src/task rc:import.rc import import.json 2>&1 >/dev/null}; @@ -123,7 +126,7 @@ EOF } # Convert YAML --> task JSON. -qx{../scripts/add-ons/import-yaml.pl import.json 2>&1}; +qx{$source_dir/scripts/add-ons/import-yaml.pl import.json 2>&1}; # Import the JSON. $output = qx{../src/task rc:import.rc import import.json 2>&1 >/dev/null}; diff --git a/test/json_test.t b/test/json_test.t index f4709f123..1a5004db7 100755 --- a/test/json_test.t +++ b/test/json_test.t @@ -30,7 +30,10 @@ use strict; use warnings; use Test::More; -my @files = glob "./json/*.json"; +my $source_dir = $0; +$source_dir =~ s{[^/]+$}{..}; + +my @files = glob "$source_dir/test/json/*.json"; plan tests => scalar @files; my $output; diff --git a/test/run_all.in b/test/run_all.in index 20d178427..2157a6a66 100755 --- a/test/run_all.in +++ b/test/run_all.in @@ -5,7 +5,7 @@ then for i in ${TESTBLOB} do echo '#' $i - ./$i > test.log 2>&1 + $i > test.log 2>&1 while read LINE do echo $LINE @@ -37,7 +37,7 @@ else COUNT=`expr $COUNT + 1` fi - ./$i >> all.log 2>&1 + $i >> all.log 2>&1 done if [ $BAR -eq 1 ]; then