mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Tests: Make "run_all --fast" even faster
- Run isolated tests in the background, bringing the time for running "run_all" down to the time it takes to run the old tests.
This commit is contained in:
parent
accd51bc35
commit
3a7af017f8
2 changed files with 21 additions and 4 deletions
1
test/.gitignore
vendored
1
test/.gitignore
vendored
|
@ -5,6 +5,7 @@
|
||||||
*.runlog
|
*.runlog
|
||||||
_run_all_parallel.txt
|
_run_all_parallel.txt
|
||||||
_run_all_serial.txt
|
_run_all_serial.txt
|
||||||
|
_run_all_parallel_rc1
|
||||||
autocomplete.t
|
autocomplete.t
|
||||||
color.t
|
color.t
|
||||||
config.t
|
config.t
|
||||||
|
|
|
@ -11,6 +11,9 @@ runlog_cleanup() {
|
||||||
if [ -f "_run_all_serial.txt" ]; then
|
if [ -f "_run_all_serial.txt" ]; then
|
||||||
rm _run_all_serial.txt
|
rm _run_all_serial.txt
|
||||||
fi
|
fi
|
||||||
|
if [ -f "_run_all_parallel_rc1" ]; then
|
||||||
|
rm _run_all_parallel_rc1
|
||||||
|
fi
|
||||||
for i in *.runlog; do
|
for i in *.runlog; do
|
||||||
# Ugly hack. :)
|
# Ugly hack. :)
|
||||||
if [ -f "$i" ]; then
|
if [ -f "$i" ]; then
|
||||||
|
@ -43,6 +46,15 @@ get_numprocs() {
|
||||||
echo $numprocs
|
echo $numprocs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_all_parallel() {
|
||||||
|
numprocs=$(get_numprocs)
|
||||||
|
cat _run_all_parallel.txt | xargs -n 1 -P $numprocs sh -c 'echo "#" $0 > $0.runlog; $0 >> $0.runlog 2>&1'
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
touch _run_all_parallel_rc1
|
||||||
|
fi
|
||||||
|
rm _run_all_parallel.txt
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
rc=0
|
rc=0
|
||||||
if [ x"$1" = x"--verbose" ];
|
if [ x"$1" = x"--verbose" ];
|
||||||
|
@ -80,8 +92,6 @@ elif [ "$1" = "--fast" ]; then
|
||||||
# Clean up after aborted runs
|
# Clean up after aborted runs
|
||||||
runlog_cleanup
|
runlog_cleanup
|
||||||
|
|
||||||
numprocs=$(get_numprocs)
|
|
||||||
|
|
||||||
for i in ${TESTBLOB}; do
|
for i in ${TESTBLOB}; do
|
||||||
if [ -x "$i" ]; then
|
if [ -x "$i" ]; then
|
||||||
# Only Python tests are guaranteed to run isolated.
|
# Only Python tests are guaranteed to run isolated.
|
||||||
|
@ -95,6 +105,8 @@ elif [ "$1" = "--fast" ]; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
run_all_parallel&
|
||||||
|
|
||||||
while read i; do
|
while read i; do
|
||||||
echo '#' $i >>all.log
|
echo '#' $i >>all.log
|
||||||
|
|
||||||
|
@ -104,8 +116,12 @@ elif [ "$1" = "--fast" ]; then
|
||||||
fi
|
fi
|
||||||
done < _run_all_serial.txt
|
done < _run_all_serial.txt
|
||||||
|
|
||||||
cat _run_all_parallel.txt | xargs -n 1 -P $numprocs sh -c 'echo "#" $0 > $0.runlog; $0 >> $0.runlog 2>&1'
|
while [ -f "_run_all_parallel.txt" ]; do
|
||||||
if [ $? -ne 0 ]; then
|
# Wait for the parallelized tests to finish running.
|
||||||
|
sleep 1 # sleep 0.1 is not portable.
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -f "_run_all_parallel_rc1" ]; then
|
||||||
rc=1
|
rc=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue