mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Unit testing
- verbose unit testing to help flod tinderbox in displaying the results.
This commit is contained in:
parent
8cd43ce2b2
commit
31bbc0ea2f
2 changed files with 51 additions and 33 deletions
|
@ -10,7 +10,8 @@ set (test_SRCS autocomplete.t color.t config.t date.t directory.t dom.t
|
||||||
duration.t file.t i18n.t json.t list.t nibbler.t path.t rx.t
|
duration.t file.t i18n.t json.t list.t nibbler.t path.t rx.t
|
||||||
t.t t2.t taskmod.t tdb2.t text.t uri.t util.t view.t json_test)
|
t.t t2.t taskmod.t tdb2.t text.t uri.t util.t view.t json_test)
|
||||||
|
|
||||||
add_custom_target (test ./run_all DEPENDS ${test_SRCS} task_executable
|
add_custom_target (test ./run_all --verbose
|
||||||
|
DEPENDS ${test_SRCS} task_executable
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test)
|
||||||
|
|
||||||
add_custom_target (build_tests DEPENDS ${test_SRCS}
|
add_custom_target (build_tests DEPENDS ${test_SRCS}
|
||||||
|
|
67
test/run_all
67
test/run_all
|
@ -1,39 +1,56 @@
|
||||||
#! /bin/bash
|
#! /bin/sh
|
||||||
|
|
||||||
date > all.log
|
if [ x"$1" = x"--verbose" ];
|
||||||
STARTEPOCH=`perl -e 'print time'`
|
then
|
||||||
|
for i in *.t *.t.exe
|
||||||
|
do
|
||||||
|
echo '#' $i
|
||||||
|
./$i > test.log 2>&1
|
||||||
|
while read LINE
|
||||||
|
do
|
||||||
|
echo $LINE
|
||||||
|
done < test.log
|
||||||
|
rm test.log
|
||||||
|
done
|
||||||
|
else
|
||||||
|
date > all.log
|
||||||
|
|
||||||
VRAMSTEG=/usr/local/bin/vramsteg
|
# Perl is used here to get the time in seconds
|
||||||
BAR=0
|
# because 'date +%s' isn't supported on Solaris.
|
||||||
if [ -x $VRAMSTEG ]; then
|
STARTEPOCH=`perl -e 'print time'`
|
||||||
|
|
||||||
|
VRAMSTEG=`which vramsteg`
|
||||||
|
BAR=0
|
||||||
|
if [ -x "$VRAMSTEG" ]; then
|
||||||
BAR=1
|
BAR=1
|
||||||
COUNT=0
|
COUNT=0
|
||||||
TOTAL=$(ls *.t | wc -l)
|
TOTAL=`ls *.t | wc -l`
|
||||||
START=$($VRAMSTEG --now)
|
START=`$VRAMSTEG --now`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for i in *.t *.t.exe
|
for i in *.t *.t.exe
|
||||||
do
|
do
|
||||||
echo '#' $i >>all.log
|
echo '#' $i >>all.log
|
||||||
|
|
||||||
if [ $BAR == 1 ]; then
|
if [ $BAR -eq 1 ]; then
|
||||||
$VRAMSTEG --label 'All tests' --min 0 --max $TOTAL --current $COUNT --percentage --start $START --estimate
|
$VRAMSTEG --label 'All tests' --min 0 --max $TOTAL --current $COUNT --percentage --start $START --estimate
|
||||||
COUNT=$[COUNT + 1]
|
COUNT=`expr $COUNT + 1`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./$i >> all.log 2>&1
|
./$i >> all.log 2>&1
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $BAR == 1 ]; then
|
if [ $BAR -eq 1 ]; then
|
||||||
$VRAMSTEG --remove
|
$VRAMSTEG --remove
|
||||||
|
fi
|
||||||
|
|
||||||
|
date >> all.log
|
||||||
|
|
||||||
|
ENDEPOCH=`perl -e 'print time'`
|
||||||
|
RUNTIME=`expr $ENDEPOCH - $STARTEPOCH`
|
||||||
|
|
||||||
|
printf "Pass: %5d\n" `grep -c '^ok' all.log`
|
||||||
|
printf "Fail: %5d\n" `grep -c '^not' all.log`
|
||||||
|
printf "Skipped: %5d\n" `grep -c '^skip' all.log`
|
||||||
|
printf "Runtime: %5d seconds\n" $RUNTIME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
date >> all.log
|
|
||||||
ENDEPOCH=`perl -e 'print time'`
|
|
||||||
|
|
||||||
RUNTIME=$(($ENDEPOCH - $STARTEPOCH))
|
|
||||||
|
|
||||||
printf "Pass: %5d\n" $(grep -c ^ok all.log)
|
|
||||||
printf "Fail: %5d\n" $(grep -c ^not all.log)
|
|
||||||
printf "Skipped: %5d\n" $(grep -c ^skip all.log)
|
|
||||||
printf "Runtime: %5d seconds\n" $RUNTIME
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue