mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Actually run shell tests (#3583)
Two of these used EXPFAIL which, because nothing is interpreting the TAP output, does not work. So, that functionality is removed, and the expected-to-fail bits are commented out or removed. There was a conditional on the filename in `bash_tap.sh` which caused it to not actually do anything and just run the test as a simple shell script. That, too, has been removed.
This commit is contained in:
parent
c0b708d1f3
commit
17889a3f25
5 changed files with 69 additions and 54 deletions
|
@ -60,9 +60,6 @@ foreach (src_FILE ${test_SRCS})
|
||||||
)
|
)
|
||||||
endforeach (src_FILE)
|
endforeach (src_FILE)
|
||||||
|
|
||||||
configure_file(bash_tap.sh bash_tap.sh COPYONLY)
|
|
||||||
configure_file(bash_tap_tw.sh bash_tap_tw.sh COPYONLY)
|
|
||||||
|
|
||||||
add_subdirectory(basetest)
|
add_subdirectory(basetest)
|
||||||
add_subdirectory(simpletap)
|
add_subdirectory(simpletap)
|
||||||
|
|
||||||
|
@ -198,3 +195,40 @@ foreach (python_Test ${pythonTests})
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
endforeach(python_Test)
|
endforeach(python_Test)
|
||||||
|
|
||||||
|
# -- Shell tests
|
||||||
|
|
||||||
|
set (shell_SRCS
|
||||||
|
tw-1637.test.sh
|
||||||
|
tw-1643.test.sh
|
||||||
|
tw-1688.test.sh
|
||||||
|
tw-1715.test.sh
|
||||||
|
tw-1718.test.sh
|
||||||
|
tw-1804.test.sh
|
||||||
|
tw-1883.test.sh
|
||||||
|
tw-1895.test.sh
|
||||||
|
tw-1938.test.sh
|
||||||
|
tw-2124.test.sh
|
||||||
|
tw-2189.test.sh
|
||||||
|
tw-2257.test.sh
|
||||||
|
tw-2386.test.sh
|
||||||
|
tw-2392.test.sh
|
||||||
|
tw-2429.test.sh
|
||||||
|
tw-2451.test.sh
|
||||||
|
tw-2514.test.sh
|
||||||
|
tw-2530.test.sh
|
||||||
|
tw-2550.test.sh
|
||||||
|
tw-2581.test.sh
|
||||||
|
tw-3102.test.sh
|
||||||
|
tw-3109.test.sh
|
||||||
|
)
|
||||||
|
|
||||||
|
configure_file(bash_tap.sh bash_tap.sh COPYONLY)
|
||||||
|
configure_file(bash_tap_tw.sh bash_tap_tw.sh COPYONLY)
|
||||||
|
|
||||||
|
foreach (shell_Test ${shell_SRCS})
|
||||||
|
add_test(NAME ${shell_Test}
|
||||||
|
COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/${shell_Test}
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
)
|
||||||
|
endforeach(shell_Test)
|
||||||
|
|
|
@ -8,13 +8,7 @@ function bashtap_on_error {
|
||||||
# $bashtap_line contains the last executed line, or an error.
|
# $bashtap_line contains the last executed line, or an error.
|
||||||
echo -n "$bashtap_output"
|
echo -n "$bashtap_output"
|
||||||
|
|
||||||
# Determine if this failure was expected
|
echo "not ok 1 - ${bashtap_line}"
|
||||||
if [[ ! -z "$EXPFAIL" ]]
|
|
||||||
then
|
|
||||||
todo_suffix=" # TODO"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "not ok 1 - ${bashtap_line}${todo_suffix}"
|
|
||||||
bashtap_clean_tmpdir
|
bashtap_clean_tmpdir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,41 +75,35 @@ function bashtap_get_absolute_path {
|
||||||
bashtap_org_pwd=$(pwd)
|
bashtap_org_pwd=$(pwd)
|
||||||
bashtap_org_script=$(bashtap_get_absolute_path "$0")
|
bashtap_org_script=$(bashtap_get_absolute_path "$0")
|
||||||
|
|
||||||
if [ "${0:(-2)}" == ".t" ] || [ "$1" == "-t" ]; then
|
# Make sure any failing commands are caught.
|
||||||
# Make sure any failing commands are caught.
|
set -e
|
||||||
set -e
|
set -o pipefail
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
# TAP header. Hardcoded number of tests, 1.
|
# TAP header. Hardcoded number of tests, 1.
|
||||||
echo "1..1"
|
echo "1..1"
|
||||||
|
|
||||||
# Output TAP failure on early exit.
|
# Output TAP failure on early exit.
|
||||||
trap bashtap_on_error EXIT
|
trap bashtap_on_error EXIT
|
||||||
|
|
||||||
# The different calls to mktemp are necessary for OSX compatibility.
|
# The different calls to mktemp are necessary for OSX compatibility.
|
||||||
bashtap_tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'bash_tap')
|
bashtap_tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'bash_tap')
|
||||||
if [ ! -z "$bashtap_tmpdir" ]; then
|
if [ ! -z "$bashtap_tmpdir" ]; then
|
||||||
cd "$bashtap_tmpdir"
|
cd "$bashtap_tmpdir"
|
||||||
else
|
|
||||||
bashtap_line="Unable to create temporary directory."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Scripts sourced before bash_tap.sh may declare this function.
|
|
||||||
if declare -f bashtap_setup >/dev/null; then
|
|
||||||
bashtap_setup
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run test file interpreting failing commands as a test failure.
|
|
||||||
bashtap_run_testcase && echo "ok 1"
|
|
||||||
|
|
||||||
# Since we're in a sourced file and just ran the parent script,
|
|
||||||
# exit without running it a second time.
|
|
||||||
trap - EXIT
|
|
||||||
bashtap_clean_tmpdir
|
|
||||||
exit
|
|
||||||
else
|
else
|
||||||
if declare -f bashtap_setup >/dev/null; then
|
bashtap_line="Unable to create temporary directory."
|
||||||
bashtap_setup
|
exit 1
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Scripts sourced before bash_tap.sh may declare this function.
|
||||||
|
if declare -f bashtap_setup >/dev/null; then
|
||||||
|
bashtap_setup
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run test file interpreting failing commands as a test failure.
|
||||||
|
bashtap_run_testcase && echo "ok 1"
|
||||||
|
|
||||||
|
# Since we're in a sourced file and just ran the parent script,
|
||||||
|
# exit without running it a second time.
|
||||||
|
trap - EXIT
|
||||||
|
bashtap_clean_tmpdir
|
||||||
|
exit
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
function setup_taskrc {
|
function setup_taskrc {
|
||||||
# Configuration
|
# Configuration
|
||||||
for i in pending.data completed.data undo.data backlog.data taskrc; do
|
for i in taskchampion.sqlite3 taskrc; do
|
||||||
if [ -f "$i" ]; then
|
if [ -f "$i" ]; then
|
||||||
rm "$i" 2>&1 >/dev/null
|
rm "$i" 2>&1 >/dev/null
|
||||||
fi
|
fi
|
||||||
|
@ -26,6 +26,7 @@ function setup_taskrc {
|
||||||
echo 'color.header=rgb025' >> taskrc
|
echo 'color.header=rgb025' >> taskrc
|
||||||
echo 'color.footer=rgb025' >> taskrc
|
echo 'color.footer=rgb025' >> taskrc
|
||||||
echo 'color.error=bold white on red' >> taskrc
|
echo 'color.error=bold white on red' >> taskrc
|
||||||
|
echo 'news.version=99.0.0' >> taskrc
|
||||||
}
|
}
|
||||||
|
|
||||||
function find_task_binary {
|
function find_task_binary {
|
||||||
|
|
|
@ -7,9 +7,3 @@
|
||||||
# Filtering for description with a dash works
|
# Filtering for description with a dash works
|
||||||
task add foo-bar
|
task add foo-bar
|
||||||
task foo-bar list | grep foo-bar
|
task foo-bar list | grep foo-bar
|
||||||
|
|
||||||
# Filtering for tag with dash does not work right now
|
|
||||||
export EXPFAIL=true
|
|
||||||
|
|
||||||
task add test +one-two
|
|
||||||
task +one-two list
|
|
||||||
|
|
|
@ -7,8 +7,6 @@ task 1 mod start:yesterday+18h
|
||||||
task 1 done end:yesterday+20h
|
task 1 done end:yesterday+20h
|
||||||
|
|
||||||
# this does not work without journal.info
|
# this does not work without journal.info
|
||||||
export EXPFAIL=true
|
|
||||||
|
|
||||||
# Check that 2 hour interval is reported by task info
|
# Check that 2 hour interval is reported by task info
|
||||||
task info | grep -F "Start deleted"
|
#task info | grep -F "Start deleted"
|
||||||
[[ ! -z `task info | grep -F "Start deleted (duration: 2:00:00)."` ]]
|
#[[ ! -z `task info | grep -F "Start deleted (duration: 2:00:00)."` ]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue