2010-02-03 23:54:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Test xargs compatibility
|
|
|
|
|
2013-12-05 23:21:21 +00:00
|
|
|
rm -f ~/.parallel/will-cite
|
|
|
|
|
2010-06-22 13:24:55 +00:00
|
|
|
echo '### Test -p --interactive'
|
|
|
|
cat >/tmp/parallel-script-for-expect <<_EOF
|
|
|
|
#!/bin/bash
|
|
|
|
|
2011-02-21 01:31:30 +00:00
|
|
|
seq 1 3 | parallel -k -p "sleep 0.1; echo opt-p"
|
|
|
|
seq 1 3 | parallel -k --interactive "sleep 0.1; echo opt--interactive"
|
2010-06-22 13:24:55 +00:00
|
|
|
_EOF
|
|
|
|
chmod 755 /tmp/parallel-script-for-expect
|
|
|
|
|
|
|
|
expect -b - <<_EOF
|
|
|
|
spawn /tmp/parallel-script-for-expect
|
|
|
|
expect "echo opt-p 1"
|
|
|
|
send "y\n"
|
|
|
|
expect "echo opt-p 2"
|
|
|
|
send "n\n"
|
|
|
|
expect "echo opt-p 3"
|
|
|
|
send "y\n"
|
|
|
|
expect "opt-p 1"
|
|
|
|
expect "opt-p 3"
|
|
|
|
expect "echo opt--interactive 1"
|
|
|
|
send "y\n"
|
|
|
|
expect "echo opt--interactive 2"
|
|
|
|
send "n\n"
|
2011-01-11 12:42:14 +00:00
|
|
|
expect "opt--interactive 1"
|
2010-06-22 13:24:55 +00:00
|
|
|
expect "echo opt--interactive 3"
|
|
|
|
send "y\n"
|
|
|
|
expect "opt--interactive 3"
|
|
|
|
_EOF
|
2011-10-17 01:10:32 +00:00
|
|
|
echo
|
2014-07-15 00:40:38 +00:00
|
|
|
cat <<'EOF' | parallel -vj0 -k -L1
|
2014-07-14 16:25:45 +00:00
|
|
|
echo '### Test killing children with --timeout and exit value (failed if timed out)'
|
2014-07-21 15:07:48 +00:00
|
|
|
pstree $$ | grep sleep | grep -v anacron | grep -v screensave | wc;
|
2014-07-14 16:25:45 +00:00
|
|
|
parallel --timeout 3 'true {} ; for i in `seq 100 120`; do bash -c "(sleep $i)" & sleep $i & done; wait; echo No good' ::: 1000000000 1000000001 ;
|
2014-07-21 15:07:48 +00:00
|
|
|
echo $?; sleep 2; pstree $$ | grep sleep | grep -v anacron | grep -v screensave | wc
|
2011-07-17 01:03:57 +00:00
|
|
|
EOF
|
2010-02-03 23:54:06 +00:00
|
|
|
|
2010-04-21 19:28:00 +00:00
|
|
|
cd input-files/test15
|
|
|
|
|
2010-06-12 23:24:25 +00:00
|
|
|
echo 'xargs Expect: 3 1 2'
|
|
|
|
echo 3 | xargs -P 1 -n 1 -a files cat -
|
2010-09-05 10:22:08 +00:00
|
|
|
echo 'parallel Expect: 3 1 via psedotty 2'
|
|
|
|
cat >/tmp/parallel-script-for-script <<EOF
|
|
|
|
#!/bin/bash
|
2012-01-08 18:52:00 +00:00
|
|
|
echo 3 | parallel --tty -k -P 1 -n 1 -a files cat -
|
2010-09-05 10:22:08 +00:00
|
|
|
EOF
|
|
|
|
chmod 755 /tmp/parallel-script-for-script
|
|
|
|
echo via pseudotty | script -q -f -c /tmp/parallel-script-for-script /dev/null
|
|
|
|
sleep 1
|
|
|
|
|
2010-06-12 23:24:25 +00:00
|
|
|
echo 'xargs Expect: 1 3 2'
|
|
|
|
echo 3 | xargs -I {} -P 1 -n 1 -a files cat {} -
|
2010-09-05 10:22:08 +00:00
|
|
|
echo 'parallel Expect: 1 3 2 via pseudotty'
|
|
|
|
cat >/tmp/parallel-script-for-script2 <<EOF
|
|
|
|
#!/bin/bash
|
2012-01-08 18:52:00 +00:00
|
|
|
echo 3 | parallel --tty -k -I {} -P 1 -n 1 -a files cat {} -
|
2010-09-05 10:22:08 +00:00
|
|
|
EOF
|
|
|
|
chmod 755 /tmp/parallel-script-for-script2
|
|
|
|
echo via pseudotty | script -q -f -c /tmp/parallel-script-for-script2 /dev/null
|
|
|
|
sleep 1
|
2010-06-12 23:24:25 +00:00
|
|
|
|
2011-07-17 00:22:39 +00:00
|
|
|
echo '### Hans found a bug giving unitialized variable'
|
|
|
|
echo >/tmp/parallel_f1
|
|
|
|
echo >/tmp/parallel_f2'
|
|
|
|
'
|
|
|
|
echo /tmp/parallel_f1 /tmp/parallel_f2 | stdout parallel -kv --delimiter ' ' gzip
|
|
|
|
rm /tmp/parallel_f*
|
|
|
|
|
|
|
|
|
2014-07-14 16:25:45 +00:00
|
|
|
touch ~/.parallel/will-cite
|