parallel: Faster --group-by. -vv --joblog / --onall --ssh bugfix.
[parallel.git] / testsuite / tests-to-run / parallel-local-10s.sh
blob4f49abd1f315d915faaf2c5428bc47b9c9bec386
1 #!/bin/bash
3 # Simple jobs that never fails
4 # Each should be taking 10-30s and be possible to run in parallel
5 # I.e.: No race conditions, no logins
7 par_bin() {
8 echo '### Test --bin'
9 seq 10 | parallel --pipe --bin 1 -j4 wc | sort
10 paste <(seq 10) <(seq 10 -1 1) |
11 parallel --pipe --colsep '\t' --bin 2 -j4 wc | sort
12 echo '### Test --bin with expression that gives 1..n'
13 paste <(seq 10) <(seq 10 -1 1) |
14 parallel --pipe --colsep '\t' --bin '2 $_=$_%2+1' -j4 wc | sort
15 echo '### Test --bin with expression that gives 0..n-1'
16 paste <(seq 10) <(seq 10 -1 1) |
17 parallel --pipe --colsep '\t' --bin '2 $_%=2' -j4 wc | sort
18 # Fails - blocks!
19 # paste <(seq 10) <(seq 10 -1 1) | parallel --pipe --colsep '\t' --bin 2 wc
22 par_nice() {
23 echo 'Check that --nice works'
24 # parallel-20160422 OK
25 check_for_2_bzip2s() {
26 perl -e '
27 for(1..5) {
28 # Try 5 times if the machine is slow starting bzip2
29 sleep(1);
30 @out = qx{ps -eo "%c %n" | grep 18 | grep bzip2};
31 if($#out == 1) {
32 # Should find 2 lines
33 print @out;
34 exit 0;
37 print "failed\n@out";
40 # wait for load < 8
41 parallel --load 8 echo ::: load_10
42 parallel -j0 --timeout 10 --nice 18 bzip2 '<' ::: /dev/zero /dev/zero &
43 pid=$!
44 check_for_2_bzip2s
45 parallel --retries 10 '! kill -TERM' ::: $pid 2>/dev/null
48 par_test_diff_roundrobin_k() {
49 echo '### test there is difference on -k'
50 . $(which env_parallel.bash)
51 mytest() {
52 K=$1
53 doit() {
54 # Sleep random time ever 1k line
55 # to mix up which process gets the next block
56 perl -ne '$t++ % 1000 or select(undef, undef, undef, rand()/10);print' |
57 md5sum
59 export -f doit
60 seq 1000000 |
61 parallel --block 65K --pipe $K --roundrobin doit |
62 sort
64 export -f mytest
65 parset a,b,c mytest ::: -k -k ''
66 # a == b and a != c or error
67 if [ "$a" == "$b" ]; then
68 if [ "$a" != "$c" ]; then
69 echo OK
70 else
71 echo error a c
73 else
74 echo error a b
78 par_colsep() {
79 echo '### Test of --colsep'
80 echo 'a%c%b' | parallel --colsep % echo {1} {3} {2}
81 (echo 'a%c%b'; echo a%c%b%d) | parallel -k --colsep % echo {1} {3} {2} {4}
82 (echo a%c%b; echo d%f%e) | parallel -k --colsep % echo {1} {3} {2}
83 parallel -k --colsep % echo {1} {3} {2} ::: a%c%b d%f%e
84 parallel -k --colsep % echo {1} {3} {2} ::: a%c%b
85 parallel -k --colsep % echo {1} {3} {2} {4} ::: a%c%b a%c%b%d
88 echo '### Test of tab as colsep'
89 printf 'def\tabc\njkl\tghi' | parallel -k --colsep '\t' echo {2} {1}
90 parallel -k -a <(printf 'def\tabc\njkl\tghi') --colsep '\t' echo {2} {1}
92 echo '### Test of multiple -a plus colsep'
93 parallel --xapply -k -a <(printf 'def\njkl\n') -a <(printf 'abc\tghi\nmno\tpqr') --colsep '\t' echo {2} {1}
95 echo '### Test of multiple -a no colsep'
96 parallel --xapply -k -a <(printf 'ghi\npqr\n') -a <(printf 'abc\tdef\njkl\tmno') echo {2} {1}
98 echo '### Test of quoting after colsplit'
99 parallel --colsep % echo {2} {1} ::: '>/dev/null%>/tmp/null'
101 echo '### Test of --colsep as regexp'
102 (echo 'a%c%%b'; echo a%c%b%d) | parallel -k --colsep %+ echo {1} {3} {2} {4}
103 parallel -k --colsep %+ echo {1} {3} {2} {4} ::: a%c%%b a%c%b%d
104 (echo 'a% c %%b'; echo a%c% b %d) | parallel -k --colsep %+ echo {1} {3} {2} {4}
105 (echo 'a% c %%b'; echo a%c% b %d) | parallel -k --colsep %+ echo '"{1}_{3}_{2}_{4}"'
107 echo '### Test of -C'
108 (echo 'a% c %%b'; echo a%c% b %d) | parallel -k -C %+ echo '"{1}_{3}_{2}_{4}"'
110 echo '### Test of --trim n'
111 (echo 'a% c %%b'; echo a%c% b %d) | parallel -k --trim n --colsep %+ echo '"{1}_{3}_{2}_{4}"'
112 parallel -k -C %+ echo '"{1}_{3}_{2}_{4}"' ::: 'a% c %%b' 'a%c% b %d'
114 echo '### Test of bug: If input is empty string'
115 (echo ; echo abcbdbebf;echo abc) | parallel -k --colsep b -v echo {1}{2}
118 par_failing_compressor() {
119 echo 'Compress with failing (de)compressor'
120 echo 'Test --tag/--line-buffer/--files in all combinations'
121 echo 'Test working/failing compressor/decompressor in all combinations'
122 echo '(-k is used as a dummy argument)'
123 stdout parallel -vk --header : --argsep ,,, \
124 parallel -k {tag} {lb} {files} --compress --compress-program {comp} --decompress-program {decomp} echo ::: C={comp},D={decomp} \
125 ,,, tag --tag -k \
126 ,,, lb --line-buffer -k \
127 ,,, files --files -k \
128 ,,, comp 'cat;true' 'cat;false' \
129 ,,, decomp 'cat;true' 'cat;false' |
130 perl -pe 's:/par......par:/tmpfile:'
133 par_fifo_under_csh() {
134 echo '### Test --fifo under csh'
136 csh -c "seq 3000000 | parallel -k --pipe --fifo 'sleep .{#};cat {}|wc -c ; false; echo \$status; false'"
137 echo exit $?
140 par_parset() {
141 echo '### test parset'
142 . `which env_parallel.bash`
144 echo 'Put output into $myarray'
145 parset myarray -k seq 10 ::: 14 15 16
146 echo "${myarray[1]}"
148 echo 'Put output into vars "$seq, $pwd, $ls"'
149 parset "seq pwd ls" -k ::: "seq 10" pwd ls
150 echo "$seq"
152 echo 'Put output into vars ($seq, $pwd, $ls)':
153 into_vars=(seq pwd ls)
154 parset "${into_vars[*]}" -k ::: "seq 5" pwd ls
155 echo "$seq"
157 echo 'The commands to run can be an array'
158 cmd=("echo '<<joe \"double space\" cartoon>>'" "pwd")
159 parset data -k ::: "${cmd[@]}"
160 echo "${data[0]}"
161 echo "${data[1]}"
163 echo 'You cannot pipe into parset, but must use a tempfile'
164 seq 10 > /tmp/parset_input_$$
165 parset res -k echo :::: /tmp/parset_input_$$
166 echo "${res[0]}"
167 echo "${res[9]}"
168 rm /tmp/parset_input_$$
170 echo 'or process substitution'
171 parset res -k echo :::: <(seq 0 10)
172 echo "${res[0]}"
173 echo "${res[9]}"
175 echo 'Commands with newline require -0'
176 parset var -k -0 ::: 'echo "line1
177 line2"' 'echo "command2"'
178 echo "${var[0]}"
181 par_parset2() {
182 . `which env_parallel.bash`
183 echo '### parset into array'
184 parset arr1 echo ::: foo bar baz
185 echo ${arr1[0]} ${arr1[1]} ${arr1[2]}
187 echo '### parset into vars with comma'
188 parset comma3,comma2,comma1 echo ::: baz bar foo
189 echo $comma1 $comma2 $comma3
191 echo '### parset into vars with space'
192 parset 'space3 space2 space1' echo ::: baz bar foo
193 echo $space1 $space2 $space3
195 echo '### parset with newlines'
196 parset 'newline3 newline2 newline1' seq ::: 3 2 1
197 echo "$newline1"
198 echo "$newline2"
199 echo "$newline3"
201 echo '### parset into indexed array vars'
202 parset 'myarray[6],myarray[5],myarray[4]' echo ::: baz bar foo
203 echo ${myarray[*]}
204 echo ${myarray[4]} ${myarray[5]} ${myarray[5]}
206 echo '### env_parset'
207 alias myecho='echo myecho "$myvar" "${myarr[1]}"'
208 myvar="myvar"
209 myarr=("myarr 0" "myarr 1" "myarr 2")
210 mynewline="`echo newline1;echo newline2;`"
211 env_parset arr1 myecho ::: foo bar baz
212 echo "${arr1[0]} ${arr1[1]} ${arr1[2]}"
213 env_parset comma3,comma2,comma1 myecho ::: baz bar foo
214 echo "$comma1 $comma2 $comma3"
215 env_parset 'space3 space2 space1' myecho ::: baz bar foo
216 echo "$space1 $space2 $space3"
217 env_parset 'newline3 newline2 newline1' 'echo "$mynewline";seq' ::: 3 2 1
218 echo "$newline1"
219 echo "$newline2"
220 echo "$newline3"
221 env_parset 'myarray[6],myarray[5],myarray[4]' myecho ::: baz bar foo
222 echo "${myarray[*]}"
223 echo "${myarray[4]} ${myarray[5]} ${myarray[5]}"
225 echo 'bug #52507: parset arr1 -v echo ::: fails'
226 parset arr1 -v seq ::: 1 2 3
227 echo "${arr1[2]}"
230 par_perlexpr_repl() {
231 echo '### {= and =} in different groups separated by space'
232 parallel echo {= s/a/b/ =} ::: a
233 parallel echo {= s/a/b/=} ::: a
234 parallel echo {= s/a/b/=}{= s/a/b/=} ::: a
235 parallel echo {= s/a/b/=}{=s/a/b/=} ::: a
236 parallel echo {= s/a/b/=}{= {= s/a/b/=} ::: a
237 parallel echo {= s/a/b/=}{={=s/a/b/=} ::: a
238 parallel echo {= s/a/b/ =} {={==} ::: a
239 parallel echo {={= =} ::: a
240 parallel echo {= {= =} ::: a
241 parallel echo {= {= =} =} ::: a
243 echo '### bug #45842: Do not evaluate {= =} twice'
244 parallel -k echo '{= $_=++$::G =}' ::: {1001..1004}
245 parallel -k echo '{=1 $_=++$::G =}' ::: {1001..1004}
246 parallel -k echo '{= $_=++$::G =}' ::: {1001..1004} ::: {a..c}
247 parallel -k echo '{=1 $_=++$::G =}' ::: {1001..1004} ::: {a..c}
249 echo '### bug #45939: {2} in {= =} fails'
250 parallel echo '{= s/O{2}//=}' ::: OOOK
251 parallel echo '{2}-{=1 s/O{2}//=}' ::: OOOK ::: OK
254 par_END() {
255 echo '### Test -i and --replace: Replace with argument'
256 (echo a; echo END; echo b) | parallel -k -i -eEND echo repl{}ce
257 (echo a; echo END; echo b) | parallel -k --replace -eEND echo repl{}ce
258 (echo a; echo END; echo b) | parallel -k -i+ -eEND echo repl+ce
259 (echo e; echo END; echo b) | parallel -k -i'*' -eEND echo r'*'plac'*'
260 (echo a; echo END; echo b) | parallel -k --replace + -eEND echo repl+ce
261 (echo a; echo END; echo b) | parallel -k --replace== -eEND echo repl=ce
262 (echo a; echo END; echo b) | parallel -k --replace = -eEND echo repl=ce
263 (echo a; echo END; echo b) | parallel -k --replace=^ -eEND echo repl^ce
264 (echo a; echo END; echo b) | parallel -k -I^ -eEND echo repl^ce
266 echo '### Test -E: Artificial end-of-file'
267 (echo include this; echo END; echo not this) | parallel -k -E END echo
268 (echo include this; echo END; echo not this) | parallel -k -EEND echo
270 echo '### Test -e and --eof: Artificial end-of-file'
271 (echo include this; echo END; echo not this) | parallel -k -e END echo
272 (echo include this; echo END; echo not this) | parallel -k -eEND echo
273 (echo include this; echo END; echo not this) | parallel -k --eof=END echo
274 (echo include this; echo END; echo not this) | parallel -k --eof END echo
277 par_xargs_compat() {
278 echo xargs compatibility
279 a_b-c() { echo a_b; echo c; }
280 a_b_-c-d() { echo a_b' '; echo c; echo d; }
281 a_b_-c-d-e() { echo a_b' '; echo c; echo d; echo e; }
282 one_mb_line() { perl -e 'print "z"x1000000'; }
283 stdsort() { "$@" | LC_ALL=C sort; }
285 echo '### Test -L -l and --max-lines'
286 a_b-c | parallel -km -L2 echo
287 a_b-c | parallel -k -L2 echo
288 a_b-c | xargs -L2 echo
290 echo '### xargs -L1 echo'
291 a_b-c | parallel -km -L1 echo
292 a_b-c | parallel -k -L1 echo
293 a_b-c | xargs -L1 echo
295 echo 'Lines ending in space should continue on next line'
296 echo '### xargs -L1 echo'
297 a_b_-c-d | parallel -km -L1 echo
298 a_b_-c-d | parallel -k -L1 echo
299 a_b_-c-d | xargs -L1 echo
301 echo '### xargs -L2 echo'
302 a_b_-c-d-e | parallel -km -L2 echo
303 a_b_-c-d-e | parallel -k -L2 echo
304 a_b_-c-d-e | xargs -L2 echo
306 echo '### xargs -l echo'
307 a_b_-c-d-e | parallel -l -km echo # This behaves wrong
308 a_b_-c-d-e | parallel -l -k echo # This behaves wrong
309 a_b_-c-d-e | xargs -l echo
311 echo '### xargs -l2 echo'
312 a_b_-c-d-e | parallel -km -l2 echo
313 a_b_-c-d-e | parallel -k -l2 echo
314 a_b_-c-d-e | xargs -l2 echo
316 echo '### xargs -l1 echo'
317 a_b_-c-d-e | parallel -km -l1 echo
318 a_b_-c-d-e | parallel -k -l1 echo
319 a_b_-c-d-e | xargs -l1 echo
321 echo '### xargs --max-lines=2 echo'
322 a_b_-c-d-e | parallel -km --max-lines 2 echo
323 a_b_-c-d-e | parallel -k --max-lines 2 echo
324 a_b_-c-d-e | xargs --max-lines=2 echo
326 echo '### xargs --max-lines echo'
327 a_b_-c-d-e | parallel --max-lines -km echo # This behaves wrong
328 a_b_-c-d-e | parallel --max-lines -k echo # This behaves wrong
329 a_b_-c-d-e | xargs --max-lines echo
331 echo '### test too long args'
332 one_mb_line | parallel echo 2>&1
333 one_mb_line | xargs echo 2>&1
334 (seq 1 10; one_mb_line; seq 12 15) | stdsort parallel -j1 -km -s 10 echo
335 (seq 1 10; one_mb_line; seq 12 15) | stdsort xargs -s 10 echo
336 (seq 1 10; one_mb_line; seq 12 15) | stdsort parallel -j1 -kX -s 10 echo
338 echo '### Test -x'
339 echo '-km'
340 (seq 1 10; echo 12345; seq 12 15) | stdsort parallel -j1 -km -s 10 -x echo
341 echo '-kX'
342 (seq 1 10; echo 12345; seq 12 15) | stdsort parallel -j1 -kX -s 10 -x echo
343 echo '-x'
344 (seq 1 10; echo 12345; seq 12 15) | stdsort xargs -s 10 -x echo
345 echo '-km -x'
346 (seq 1 10; echo 1234; seq 12 15) | stdsort parallel -j1 -km -s 10 -x echo
347 echo '-kX -x'
348 (seq 1 10; echo 1234; seq 12 15) | stdsort parallel -j1 -kX -s 10 -x echo
349 echo '-x'
350 (seq 1 10; echo 1234; seq 12 15) | stdsort xargs -s 10 -x echo
353 par_sem_2jobs() {
354 echo '### Test semaphore 2 jobs running simultaneously'
355 parallel --semaphore --id 2jobs -u -j2 'echo job1a 1; sleep 4; echo job1b 3'
356 sleep 0.5
357 parallel --semaphore --id 2jobs -u -j2 'echo job2a 2; sleep 4; echo job2b 5'
358 sleep 0.5
359 parallel --semaphore --id 2jobs -u -j2 'echo job3a 4; sleep 4; echo job3b 6'
360 parallel --semaphore --id 2jobs --wait
361 echo done
364 par_semaphore() {
365 echo '### Test if parallel invoked as sem will run parallel --semaphore'
366 sem --id as_sem -u -j2 'echo job1a 1; sleep 3; echo job1b 3'
367 sleep 0.5
368 sem --id as_sem -u -j2 'echo job2a 2; sleep 3; echo job2b 5'
369 sleep 0.5
370 sem --id as_sem -u -j2 'echo job3a 4; sleep 3; echo job3b 6'
371 sem --id as_sem --wait
372 echo done
375 par_line_buffer() {
376 echo "### --line-buffer"
377 tmp1=$(tempfile)
378 tmp2=$(tempfile)
380 seq 10 | parallel -j20 --line-buffer 'seq {} 10 | pv -qL 10' > $tmp1
381 seq 10 | parallel -j20 'seq {} 10 | pv -qL 10' > $tmp2
382 cat $tmp1 | wc
383 diff $tmp1 $tmp2 >/dev/null
384 echo These must diff: $?
385 rm $tmp1 $tmp2
388 par_pipe_line_buffer() {
389 echo "### --pipe --line-buffer"
390 tmp1=$(tempfile)
391 tmp2=$(tempfile)
393 nowarn() {
394 # Ignore certain warnings
395 # parallel: Warning: Starting 11 processes took > 2 sec.
396 # parallel: Warning: Consider adjusting -j. Press CTRL-C to stop.
397 grep -v '^parallel: Warning: (Starting|Consider)'
400 export PARALLEL="-N10 -L1 --pipe -j20 --tagstring {#}"
401 seq 200| parallel --line-buffer pv -qL 10 > $tmp1 2> >(nowarn)
402 seq 200| parallel pv -qL 10 > $tmp2 2> >(nowarn)
403 cat $tmp1 | wc
404 diff $tmp1 $tmp2 >/dev/null
405 echo These must diff: $?
406 rm $tmp1 $tmp2
409 par_pipe_line_buffer_compress() {
410 echo "### --pipe --line-buffer --compress"
411 seq 200| parallel -N10 -L1 --pipe -j20 --line-buffer --compress --tagstring {#} pv -qL 10 | wc
414 par__pipepart_spawn() {
415 echo '### bug #46214: Using --pipepart doesnt spawn multiple jobs in version 20150922'
416 seq 1000000 > /tmp/num1000000
417 stdout parallel --pipepart --progress -a /tmp/num1000000 --block 10k -j0 true |
418 grep 1:local | perl -pe 's/\d\d\d/999/g; s/[2-9]/2+/g;'
421 par__pipe_tee() {
422 echo 'bug #45479: --pipe/--pipepart --tee'
423 echo '--pipe --tee'
425 random100M() {
426 < /dev/zero openssl enc -aes-128-ctr -K 1234 -iv 1234 2>/dev/null |
427 head -c 100M;
429 random100M | parallel --pipe --tee cat ::: {1..3} | LC_ALL=C wc -c
432 par__pipepart_tee() {
433 echo 'bug #45479: --pipe/--pipepart --tee'
434 echo '--pipepart --tee'
436 export TMPDIR=/dev/shm/parallel
437 mkdir -p $TMPDIR
438 random100M() {
439 < /dev/zero openssl enc -aes-128-ctr -K 1234 -iv 1234 2>/dev/null |
440 head -c 100M;
442 tmp=$(mktemp)
443 random100M >$tmp
444 parallel --pipepart --tee -a $tmp cat ::: {1..3} | LC_ALL=C wc -c
445 rm $tmp
448 par_k() {
449 echo '### Test -k'
450 ulimit -n 50
451 (echo "sleep 3; echo begin";
452 seq 1 30 |
453 parallel -j1 -kq echo "sleep 1; echo {}";
454 echo "echo end") |
455 stdout nice parallel -k -j0 |
456 grep -Ev 'No more file handles.|Raising ulimit -n' |
457 perl -pe '/parallel:/ and s/\d/X/g'
460 par_k_linebuffer() {
461 echo '### bug #47750: -k --line-buffer should give current job up to now'
463 parallel --line-buffer --tag -k 'seq {} | pv -qL 10' ::: {10..20}
464 parallel --line-buffer -k 'echo stdout top;sleep 1;echo stderr in the middle >&2; sleep 1;echo stdout' ::: end 2>&1
467 par_maxlinelen_m_I() {
468 echo "### Test max line length -m -I"
470 seq 1 60000 | parallel -I :: -km -j1 echo a::b::c | LC_ALL=C sort >/tmp/114-a$$;
471 md5sum </tmp/114-a$$;
472 export CHAR=$(cat /tmp/114-a$$ | wc -c);
473 export LINES=$(cat /tmp/114-a$$ | wc -l);
474 echo "Chars per line ($CHAR/$LINES): "$(echo "$CHAR/$LINES" | bc);
475 rm /tmp/114-a$$
478 par_maxlinelen_X_I() {
479 echo "### Test max line length -X -I"
481 seq 1 60000 | parallel -I :: -kX -j1 echo a::b::c | LC_ALL=C sort >/tmp/114-b$$;
482 md5sum </tmp/114-b$$;
483 export CHAR=$(cat /tmp/114-b$$ | wc -c);
484 export LINES=$(cat /tmp/114-b$$ | wc -l);
485 echo "Chars per line ($CHAR/$LINES): "$(echo "$CHAR/$LINES" | bc);
486 rm /tmp/114-b$$
489 par_compress_fail() {
490 echo "### bug #41609: --compress fails"
491 seq 12 | parallel --compress --compress-program gzip -k seq {} 10000 | md5sum
492 seq 12 | parallel --compress -k seq {} 10000 | md5sum
495 par_results_csv() {
496 echo "bug #: --results csv"
498 doit() {
499 parallel -k $@ --results -.csv echo ::: H2 22 23 ::: H1 11 12;
501 export -f doit
502 parallel -k --tag doit ::: '--header :' '' \
503 ::: --tag '' ::: --files '' ::: --compress '' |
504 perl -pe 's:/par......par:/tmpfile:g;s/\d+\.\d+/999.999/g'
507 par_results_compress() {
508 tmp=$(mktemp)
509 rm "$tmp"
510 parallel --results $tmp --compress echo ::: 1 | wc -l
511 parallel --results $tmp echo ::: 1 | wc -l
512 rm -r "$tmp"
515 par_kill_children_timeout() {
516 echo '### Test killing children with --timeout and exit value (failed if timed out)'
517 pstree $$ | grep sleep | grep -v anacron | grep -v screensave | wc
518 doit() {
519 for i in `seq 100 120`; do
520 bash -c "(sleep $i)" &
521 sleep $i &
522 done;
523 wait;
524 echo No good;
526 export -f doit
527 parallel --timeout 3 doit ::: 1000000000 1000000001
528 echo $?;
529 sleep 2;
530 pstree $$ | grep sleep | grep -v anacron | grep -v screensave | wc
533 par_tmux_fg() {
534 echo 'bug #50107: --tmux --fg should also write how to access it'
535 stdout parallel --tmux --fg sleep ::: 3 | perl -pe 's/.tmp\S+/tmp/'
539 par_retries_all_fail() {
540 echo "bug #53748: -k --retries 10 + out of filehandles = blocking"
541 ulimit -n 30
542 seq 8 |
543 parallel -k -j0 --retries 2 --timeout 0.1 'echo {}; sleep {}; false' 2>/dev/null
546 par_sockets_cores_threads() {
547 echo '### Test --number-of-sockets/cores/threads'
548 unset PARALLEL_CPUINFO
549 unset PARALLEL_LSCPU
550 parallel --number-of-sockets
551 parallel --number-of-cores
552 parallel --number-of-threads
553 parallel --number-of-cpus
555 echo '### Test --use-sockets-instead-of-threads'
556 (seq 1 4 |
557 stdout parallel --use-sockets-instead-of-threads -j100% sleep) &&
558 echo sockets done &
559 (seq 1 4 | stdout parallel -j100% sleep) && echo threads done &
560 wait
561 echo 'Threads should complete first on machines with less than 8 sockets'
564 par_long_line_remote() {
565 echo '### Deal with long command lines on remote servers'
566 perl -e "print(((\"'\"x5000).\"\\n\")x6)" |
567 parallel -j1 -S lo -N 10000 echo {} |wc
568 perl -e 'print((("\$"x5000)."\n")x50)' |
569 parallel -j1 -S lo -N 10000 echo {} |wc
572 par_shellquote() {
573 echo '### Test --shellquote in all shells'
574 doit() {
575 # Run --shellquote for ascii 1..255 in a shell
576 shell="$1"
577 "$shell" -c perl\ -e\ \'print\ pack\(\"c\*\",1..255\)\'\ \|\ parallel\ -0\ --shellquote
579 export -f doit
580 parallel --tag -q -k doit {} ::: ash bash csh dash fish fizsh ksh2020 ksh93 lksh mksh posh rzsh sash sh static-sh tcsh yash zsh csh tcsh
583 par_tmp_full() {
584 # Assume /tmp/shm is easy to fill up
585 export SHM=/tmp/shm/parallel
586 mkdir -p $SHM
587 sudo umount -l $SHM 2>/dev/null
588 sudo mount -t tmpfs -o size=10% none $SHM
590 echo "### Test --tmpdir running full. bug #40733 was caused by this"
591 stdout parallel -j1 --tmpdir $SHM cat /dev/zero ::: dummy
594 par_jobs_file() {
595 echo '### Test of -j filename - non-existent file'
596 stdout parallel -j no_such_file echo ::: 1 |
597 perl -ne '/Tange, O.|Zenodo./ or print'
599 echo '### Test of -j filename'
600 echo 3 >/tmp/jobs_to_run1
601 parallel -j /tmp/jobs_to_run1 -v sleep {} ::: 10 8 6 5 4
602 # Should give 6 8 10 5 4
605 export -f $(compgen -A function | grep par_)
606 compgen -A function | grep par_ | LC_ALL=C sort |
607 parallel --timeout 1000% -j10 --tag -k --joblog /tmp/jl-`basename $0` '{} 2>&1' |
608 perl -pe 's/,31,0/,15,0/' |
609 perl -pe 's/131\d\d\d/131XXX/' |
610 # Replace $PWD with . even if given as ~/...
611 perl -pe 's:~:'$HOME':g' |
612 perl -pe 's:'$PWD':.:g' |
613 perl -pe 's:'$HOME':~:g'