3 # SPDX-FileCopyrightText: 2021 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
5 # SPDX-License-Identifier: GPL-3.0-or-later
8 cp -a input-files
/testdir2 tmp
10 NICEPAR
="nice nice parallel"
13 cat <<'EOF' | sed -e 's/;$/; /;s/$SERVER1/'$SERVER1'/;s/$SERVER2/'$SERVER2'/' | stdout parallel -vj0 -k --joblog /tmp/jl-`basename $0` -L1 -r
14 echo '### bug #42329: --line-buffer gives wrong output';
15 $NICEPAR --line-buffer --tag seq ::: 10000000 | wc -c;
16 $NICEPAR --line-buffer seq ::: 10000000 | wc -c
18 echo '### Test \0 as recend';
19 printf "a\0b\0c\0" | $NICEPAR --recend '\0' -k -N1 --pipe cat -v \; echo;
20 printf "\0a\0b\0c" | $NICEPAR --recstart '\0' -k -N1 --pipe cat -v \; echo
22 echo '### Test filenames containing UTF-8';
24 find . -name '*.jpg' | $NICEPAR -j +0 convert -geometry 120 {} {//}/thumb_{/};
25 find |grep -v CVS | sort;
27 echo '### bug #39554: Feature request: line buffered output';
28 parallel -j0 --linebuffer 'echo -n start {};sleep 0.{#};echo middle -n {};sleep 1.{#}5;echo next to last {};sleep 1.{#};echo -n last {}' ::: A B C
31 echo '### bug #39554: Feature request: line buffered output --tag';
32 parallel --tag -j0 --linebuffer 'echo -n start {};sleep 0.{#};echo middle -n {};sleep 1.{#}5;echo next to last {};sleep 1.{#};echo -n last {}' ::: A B C
35 echo '### test round-robin';
36 nice seq 1000 | $NICEPAR -j4 --block 1k --pipe --round-robin wc | sort
38 echo '### bug #43600: --pipe --linebuffer --round does not work'
39 seq 10000000000 | parallel --pipe --linebuffer --round cat | head | wc -l
41 echo '### Check that 4 processes are really used'
42 seq 1000000 | parallel -j4 --pipe --round --line-buf wc | wc -l
44 echo '### --version must have higher priority than retired options'
45 $NICEPAR --version -g -Y -U -W -T | tail -n9
47 echo '### bug #39787: --xargs broken'
48 nice perl -e 'for(1..30000){print "$_\n"}' | $NICEPAR --xargs -k echo | perl -ne 'print length $_,"\n"'
50 echo '### --delay should grow by 3 sec per arg'
51 stdout /usr/bin/time -f %e parallel --delay 3 true ::: 1 2 | perl -ne '$_ >= 3 and $_ <= 8 and print "OK\n"'
52 stdout /usr/bin/time -f %e parallel --delay 3 true ::: 1 2 3 | perl -ne '$_ >= 6 and $_ <= 11 and print "OK\n"'
54 echo '### Exit value should not be affected if an earlier job times out'
55 $NICEPAR -j2 --timeout 1 --joblog - -k ::: "sleep 10" "exit 255" | field 7
57 echo '### --header regexp'
58 (echo %head1; echo %head2; seq 5) | $NICEPAR -kj2 --pipe -N2 --header '(%.*\n)*' echo JOB{#}\;cat
60 echo '### --header num'
61 (echo %head1; echo %head2; seq 5) | $NICEPAR -kj2 --pipe -N2 --header 2 echo JOB{#}\;cat
63 echo '### --header regexp --round-robin'
64 (echo %head1; echo %head2; seq 5) | $NICEPAR -kj2 --pipe -N2 --round --header '(%.*\n)*' echo JOB\;wc | sort
66 echo '### --header num --round-robin'
67 (echo %head1; echo %head2; seq 5) | $NICEPAR -kj2 --pipe -N2 --round --header 2 echo JOB{#}\;wc | sort
69 echo '### shebang-wrap'
70 $NICEPAR -k {} {} A B C ::: ./input-files/shebang/shebangwrap.*[^~]
72 echo 'bug #43967: Error if there exists a bin/zsh or bin/bash dir (with zsh or bash).'
73 mkdir -p /tmp/bash$$/bash; PATH=/tmp/bash$$:$PATH parallel echo ::: OK; rm -rf /tmp/bash$$