From f9ff5717fe339db255c9af69f08216eb48684719 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sat, 29 Dec 2018 22:33:50 +0100 Subject: [PATCH] sem --quote should not add empty argument. --- src/parallel | 7 +++--- testsuite/tests-to-run/parallel-local-0.3s.sh | 5 ++++ testsuite/tests-to-run/parallel-local-10s.sh | 24 ++++++++++--------- testsuite/tests-to-run/parallel-local-sql.sh | 2 +- testsuite/wanted-results/parallel-local-0.3s | 3 +++ testsuite/wanted-results/parallel-local-10s | 8 +++---- testsuite/wanted-results/parallel-local-ssh1 | 20 ++++++++-------- 7 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/parallel b/src/parallel index 9cab6a5e..39aea1af 100755 --- a/src/parallel +++ b/src/parallel @@ -10229,13 +10229,14 @@ sub replace_placeholders { my @quotegroup; my @quoted; for (map { $_ eq "\0empty" ? "" : $_ } - grep { $_ ne "\0ign" } - grep { $_ !~ /\0noarg/ } + grep { $_ ne "\0ign" and $_ ne "\0noarg" and $_ ne "'\0noarg'" } @replaced, "\0end") { if($_ eq "\0spc" or $_ eq "\0end") { # \0spc splits quotable groups if($quote) { - CORE::push @quoted, ::Q(join"",@quotegroup); + if(@quotegroup) { + CORE::push @quoted, ::Q(join"",@quotegroup); + } } else { CORE::push @quoted, join"",@quotegroup; } diff --git a/testsuite/tests-to-run/parallel-local-0.3s.sh b/testsuite/tests-to-run/parallel-local-0.3s.sh index 701bbe0d..b8fcdb3a 100644 --- a/testsuite/tests-to-run/parallel-local-0.3s.sh +++ b/testsuite/tests-to-run/parallel-local-0.3s.sh @@ -881,6 +881,11 @@ par_pipe_N1_regexp() { parallel -kN1 --recstart 'begin\n' --pipe echo JOB{#}\;cat\;echo END } +par_sem_quote() { + echo '### sem --quote should not add empty argument' + sem --fg --quote -v 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' diff --git a/testsuite/tests-to-run/parallel-local-10s.sh b/testsuite/tests-to-run/parallel-local-10s.sh index 2dddd748..e818b312 100644 --- a/testsuite/tests-to-run/parallel-local-10s.sh +++ b/testsuite/tests-to-run/parallel-local-10s.sh @@ -67,32 +67,34 @@ par_pipe_line_buffer_compress() { par__pipepart_spawn() { echo '### bug #46214: Using --pipepart doesnt spawn multiple jobs in version 20150922' - seq 1000000 > /tmp/num1000000; - stdout nice parallel --pipepart --progress -a /tmp/num1000000 --block 10k -j0 true | - grep 1:local | perl -pe 's/\d\d\d/999/g; s/[2-9]/2+/g;' + seq 1000000 > /tmp/num1000000 + stdout parallel --pipepart --progress -a /tmp/num1000000 --block 10k -j0 true | + grep 1:local | perl -pe 's/\d\d\d/999/g; s/[2-9]/2+/g;' } par__pipe_tee() { echo 'bug #45479: --pipe/--pipepart --tee' echo '--pipe --tee' - random1G() { + random100M() { < /dev/zero openssl enc -aes-128-ctr -K 1234 -iv 1234 2>/dev/null | - head -c 1G; + head -c 100M; } - random1G | parallel --pipe --tee cat ::: {1..3} | LC_ALL=C wc -c + random100M | parallel --pipe --tee cat ::: {1..3} | LC_ALL=C wc -c } par__pipepart_tee() { echo 'bug #45479: --pipe/--pipepart --tee' echo '--pipepart --tee' - random1G() { + export TMPDIR=/dev/shm/parallel + mkdir -p $TMPDIR + random100M() { < /dev/zero openssl enc -aes-128-ctr -K 1234 -iv 1234 2>/dev/null | - head -c 1G; + head -c 100M; } tmp=$(mktemp) - random1G >$tmp + random100M >$tmp parallel --pipepart --tee -a $tmp cat ::: {1..3} | LC_ALL=C wc -c rm $tmp } @@ -193,8 +195,8 @@ par_maxlinelen_X_I() { par_compress_fail() { echo "### bug #41609: --compress fails" - seq 12 | parallel --compress --compress-program bzip2 -k seq {} 1000000 | md5sum - seq 12 | parallel --compress -k seq {} 1000000 | md5sum + seq 12 | parallel --compress --compress-program gzip -k seq {} 10000 | md5sum + seq 12 | parallel --compress -k seq {} 10000 | md5sum } par_round_robin_blocks() { diff --git a/testsuite/tests-to-run/parallel-local-sql.sh b/testsuite/tests-to-run/parallel-local-sql.sh index cba779f9..d2640d0b 100755 --- a/testsuite/tests-to-run/parallel-local-sql.sh +++ b/testsuite/tests-to-run/parallel-local-sql.sh @@ -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 300 -vj3 -k --tag --joblog /tmp/jl-`basename $0` p_wrapper \ + stdout parallel --timeout 30 -vj50% -k --tag --joblog /tmp/jl-`basename $0` p_wrapper \ :::: - ::: \$MYSQL \$PG \$SQLITE diff --git a/testsuite/wanted-results/parallel-local-0.3s b/testsuite/wanted-results/parallel-local-0.3s index d34fa6c4..42026cb5 100644 --- a/testsuite/wanted-results/parallel-local-0.3s +++ b/testsuite/wanted-results/parallel-local-0.3s @@ -1512,6 +1512,9 @@ par_retries_replacement_string 22 par_retries_replacement_string 33 par_retries_replacement_string 33 par_retries_replacement_string 33 +par_sem_quote ### sem --quote should not add empty argument +par_sem_quote echo +par_sem_quote par_slow_pipe_regexp ### bug #53718: --pipe --regexp -N blocks par_slow_pipe_regexp This should take a few ms, but took more than 2 hours par_slow_pipe_regexp 980 981 5881 diff --git a/testsuite/wanted-results/parallel-local-10s b/testsuite/wanted-results/parallel-local-10s index d7c9e4dc..2748f94c 100644 --- a/testsuite/wanted-results/parallel-local-10s +++ b/testsuite/wanted-results/parallel-local-10s @@ -5,15 +5,15 @@ par__memleak Test if memory consumption(300 jobs) < memory consumption(30 jobs) par__memleak 1 par__pipe_tee bug #45479: --pipe/--pipepart --tee par__pipe_tee --pipe --tee -par__pipe_tee 3221225472 +par__pipe_tee 314572800 par__pipepart_spawn ### bug #46214: Using --pipepart doesnt spawn multiple jobs in version 20150922 par__pipepart_spawn 1:local / 2+ / 2+2+2+ par__pipepart_tee bug #45479: --pipe/--pipepart --tee par__pipepart_tee --pipepart --tee -par__pipepart_tee 3221225472 +par__pipepart_tee 314572800 par_compress_fail ### bug #41609: --compress fails -par_compress_fail 24812dd0f24a26d08a780f988b9d5ad2 - -par_compress_fail 24812dd0f24a26d08a780f988b9d5ad2 - +par_compress_fail f1a751b1283e99e7dda40f63f1225f74 - +par_compress_fail f1a751b1283e99e7dda40f63f1225f74 - par_interactive ### Test -p --interactive par_interactive opt--interactive 1 par_interactive opt--interactive 3 diff --git a/testsuite/wanted-results/parallel-local-ssh1 b/testsuite/wanted-results/parallel-local-ssh1 index d1e61ca6..030e2826 100644 --- a/testsuite/wanted-results/parallel-local-ssh1 +++ b/testsuite/wanted-results/parallel-local-ssh1 @@ -3,25 +3,25 @@ echo '### Test --load remote' ssh parallel@lo 'seq 10 | parallel --nice 19 --timeout 15 -j0 -qN0 perl -e while\(1\)\{\ \}' & sleep 1; stdout /usr/bin/time -f %e parallel -S parallel@lo --load 10 sleep ::: 1 | perl -ne '$_ > 10 and print "OK\n"' OK parallel: Warning: This job was killed because it timed out: -parallel: Warning: perl -e 'while(1){ }' '' +parallel: Warning: perl -e 'while(1){ }' parallel: Warning: This job was killed because it timed out: -parallel: Warning: perl -e 'while(1){ }' '' +parallel: Warning: perl -e 'while(1){ }' parallel: Warning: This job was killed because it timed out: -parallel: Warning: perl -e 'while(1){ }' '' +parallel: Warning: perl -e 'while(1){ }' parallel: Warning: This job was killed because it timed out: -parallel: Warning: perl -e 'while(1){ }' '' +parallel: Warning: perl -e 'while(1){ }' parallel: Warning: This job was killed because it timed out: -parallel: Warning: perl -e 'while(1){ }' '' +parallel: Warning: perl -e 'while(1){ }' parallel: Warning: This job was killed because it timed out: -parallel: Warning: perl -e 'while(1){ }' '' +parallel: Warning: perl -e 'while(1){ }' parallel: Warning: This job was killed because it timed out: -parallel: Warning: perl -e 'while(1){ }' '' +parallel: Warning: perl -e 'while(1){ }' parallel: Warning: This job was killed because it timed out: -parallel: Warning: perl -e 'while(1){ }' '' +parallel: Warning: perl -e 'while(1){ }' parallel: Warning: This job was killed because it timed out: -parallel: Warning: perl -e 'while(1){ }' '' +parallel: Warning: perl -e 'while(1){ }' parallel: Warning: This job was killed because it timed out: -parallel: Warning: perl -e 'while(1){ }' '' +parallel: Warning: perl -e 'while(1){ }' echo '**' ** echo '### Stop if all hosts are filtered and there are no hosts left to run on'