parallel --halt soon,fail=100% </dev/null should not give division by zero.

This commit is contained in:
Ole Tange 2018-12-29 23:21:46 +01:00
parent f9ff5717fe
commit 036319dc09
4 changed files with 10 additions and 2 deletions

View file

@ -216,7 +216,7 @@ sub halt {
if($Global::halt_pct) {
$Global::halt_exitstatus =
::ceil($Global::total_failed /
$Global::total_started * 100);
($Global::total_started || 1) * 100);
} elsif($Global::halt_count) {
$Global::halt_exitstatus =
::min(undef_as_zero($Global::total_failed),101);

View file

@ -886,6 +886,12 @@ par_sem_quote() {
sem --fg --quote -v echo
}
par_halt_on_error_division_by_zero() {
echo '### --halt-on-error soon,fail=100% with no input should not give division by zero'
stdout parallel --halt-on-error soon,fail=100% echo </dev/null
echo $?
}
export -f $(compgen -A function | grep par_)
compgen -A function | grep par_ | LC_ALL=C sort |
parallel --timeout 20 -j6 --tag -k --joblog +/tmp/jl-`basename $0` '{} 2>&1'

View file

@ -148,5 +148,5 @@ export -f $(compgen -A function | egrep 'p_|par_')
# Tested that -j0 in parallel is fastest (up to 15 jobs)
# more than 3 jobs: sqlite locks
compgen -A function | grep par_ | LC_ALL=C sort |
stdout parallel --timeout 30 -vj50% -k --tag --joblog /tmp/jl-`basename $0` p_wrapper \
stdout parallel --timeout 60 -vj50% -k --tag --joblog /tmp/jl-`basename $0` p_wrapper \
:::: - ::: \$MYSQL \$PG \$SQLITE

View file

@ -1326,6 +1326,8 @@ par_file_ending_in_newline ### Hans found a bug giving unitialized variable
par_file_ending_in_newline gzip /tmp/parallel_f1
par_file_ending_in_newline gzip '/tmp/parallel_f2
par_file_ending_in_newline '
par_halt_on_error_division_by_zero ### --halt-on-error soon,fail=100% with no input should not give division by zero
par_halt_on_error_division_by_zero 0
par_halt_one_job # Halt soon if there is a single job
par_halt_one_job should run 0 1 = job 1 2
par_halt_one_job 1