2017-01-06 21:53:21 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Each test should at most run 1 ssh against parallel@lo or lo
|
|
|
|
|
|
|
|
par_path_remote_bash() {
|
|
|
|
echo 'bug #47695: How to set $PATH on remote? Bash'
|
|
|
|
rm -rf /tmp/parallel
|
|
|
|
cp /usr/local/bin/parallel /tmp
|
|
|
|
|
2018-01-22 16:23:23 +00:00
|
|
|
cat <<'_EOS' | stdout ssh nopathbash@lo -T | grep -Ev 'For upgrade information, please visit:|updates are security updates|packages can be updated|System restart required|Welcome to|https://|Ubuntu|http://|from 13 to 17 years|mentor:|New release|do-release-upgrade|\s*^$' | uniq
|
2017-01-06 21:53:21 +00:00
|
|
|
echo BASH Path before: $PATH with no parallel
|
|
|
|
parallel echo ::: 1
|
|
|
|
# Race condition stderr/stdout
|
|
|
|
sleep 1
|
|
|
|
echo '^^^^^^^^ Not found is OK'
|
|
|
|
# Exporting a big variable should not fail
|
|
|
|
export A="`seq 1000`"
|
|
|
|
PATH=$PATH:/tmp
|
|
|
|
. /usr/local/bin/env_parallel.bash
|
|
|
|
# --filter to see if $PATH with parallel is transferred
|
|
|
|
env_parallel --filter --env A,PATH -Slo echo '$PATH' ::: OK
|
|
|
|
_EOS
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
par_path_remote_csh() {
|
|
|
|
echo 'bug #47695: How to set $PATH on remote? csh'
|
|
|
|
rm -rf /tmp/parallel
|
|
|
|
cp /usr/local/bin/parallel /tmp
|
|
|
|
|
2018-01-22 16:23:23 +00:00
|
|
|
cat <<'_EOS' | stdout ssh nopathcsh@lo -T | grep -Ev 'For upgrade information, please visit:|updates are security updates|packages can be updated|System restart required|Welcome to|https://|Ubuntu|http://|from 13 to 17 years|mentor:|New release|do-release-upgrade|\s*^$' | uniq
|
2017-01-06 21:53:21 +00:00
|
|
|
echo CSH Path before: $PATH with no parallel
|
|
|
|
which parallel >& /dev/stdout
|
|
|
|
echo '^^^^^^^^ Not found is OK'
|
|
|
|
alias parallel=/tmp/parallel
|
|
|
|
# Exporting a big variable should not fail
|
|
|
|
setenv A "`seq 1000`"
|
|
|
|
setenv PATH ${PATH}:/tmp
|
|
|
|
cp /usr/local/bin/env_parallel* /tmp
|
2017-12-03 00:40:01 +00:00
|
|
|
rehash
|
2017-01-06 21:53:21 +00:00
|
|
|
if ("`alias env_parallel`" == '') then
|
|
|
|
source `which env_parallel.csh`
|
|
|
|
endif
|
|
|
|
# --filter to see if $PATH with parallel is transferred
|
|
|
|
env_parallel --filter --env A,PATH -Slo echo '$PATH' ::: OK
|
2017-06-22 11:35:58 +00:00
|
|
|
# Sleep needed to avoid stderr/stdout mixing
|
|
|
|
sleep 1
|
2017-01-06 21:53:21 +00:00
|
|
|
echo Right now it seems csh does not respect $PATH if set from Perl
|
|
|
|
echo Done
|
|
|
|
_EOS
|
|
|
|
}
|
|
|
|
|
|
|
|
par_keep_order() {
|
|
|
|
echo '### Test --keep-order'
|
|
|
|
seq 0 2 |
|
|
|
|
parallel --keep-order -j100% -S 1/:,2/parallel@lo -q perl -e 'sleep 1;print "job{}\n";exit({})'
|
|
|
|
}
|
|
|
|
|
|
|
|
par_keeporder() {
|
|
|
|
echo '### Test --keeporder'
|
|
|
|
seq 0 2 |
|
|
|
|
parallel --keeporder -j100% -S 1/:,2/parallel@lo -q perl -e 'sleep 1;print "job{}\n";exit({})'
|
|
|
|
}
|
|
|
|
|
2017-04-17 14:25:58 +00:00
|
|
|
par_load_csh() {
|
|
|
|
echo '### Gave Word too long.'
|
|
|
|
parallel --load 100% -S csh@lo echo ::: a
|
|
|
|
}
|
2017-01-06 21:53:21 +00:00
|
|
|
|
2017-08-23 22:38:49 +00:00
|
|
|
par_PARALLEL_RSYNC_OPTS() {
|
|
|
|
echo '### test rsync opts'
|
|
|
|
touch parallel_rsync_opts.test
|
|
|
|
parallel --rsync-opts -rlDzRRRR -vv -S parallel@lo --trc {}.out touch {}.out ::: parallel_rsync_opts.test |
|
|
|
|
perl -ne 's/(rsync .*?RRRR)/print $1/ge'
|
|
|
|
export PARALLEL_RSYNC_OPTS=-zzrrllddRRRR
|
|
|
|
parallel -vv -S parallel@lo --trc {}.out touch {}.out ::: parallel_rsync_opts.test |
|
|
|
|
perl -ne 's/(rsync .*?RRRR)/print $1/ge'
|
|
|
|
rm parallel_rsync_opts.test parallel_rsync_opts.test.out
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
par_bar_m() {
|
|
|
|
echo '### test --bar -m'
|
|
|
|
stdout parallel --bar -P 2 -m sleep ::: 1 1 2 2 3 3 |
|
|
|
|
perl -pe 's/\r/\n/g'|
|
|
|
|
grep -E '^[0-9]+ *$' |
|
|
|
|
uniq
|
|
|
|
}
|
|
|
|
|
2018-04-27 16:52:00 +00:00
|
|
|
par_retries_1() {
|
|
|
|
echo '### Test of --retries - it should run 13 jobs in total';
|
|
|
|
export PARALLEL="--retries 1 -S 12/localhost,1/:,parallel@parallel-server1 -uq"
|
|
|
|
seq 0 12 |
|
|
|
|
stdout parallel perl -e 'print "job{}\n";exit({})' | wc -l
|
|
|
|
}
|
|
|
|
|
|
|
|
par_retries_2() {
|
|
|
|
echo '### Test of --retries - it should run 25 jobs in total';
|
|
|
|
export PARALLEL="--retries 2 -S 12/localhost,1/:,parallel@parallel-server1 -uq"
|
|
|
|
seq 0 12 |
|
|
|
|
stdout parallel perl -e 'print "job{}\n";exit({})' | wc -l
|
|
|
|
}
|
|
|
|
|
|
|
|
par_retries_4() {
|
|
|
|
echo '### Test of --retries - it should run 49 jobs in total';
|
|
|
|
export PARALLEL="--retries 4 -S 12/localhost,1/:,parallel@parallel-server1 -uq"
|
|
|
|
seq 0 12 |
|
|
|
|
stdout parallel perl -e 'print "job{}\n";exit({})' | wc -l
|
|
|
|
}
|
|
|
|
|
|
|
|
par_retries_bug_from_2010() {
|
|
|
|
echo '### Bug with --retries'
|
|
|
|
seq 1 8 |
|
|
|
|
parallel --retries 2 --sshlogin 8/localhost,8/: -j+0 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
seq 1 8 |
|
|
|
|
parallel --retries 2 --sshlogin 8/localhost,8/: -j+1 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
seq 1 2 |
|
|
|
|
parallel --retries 2 --sshlogin 8/localhost,8/: -j-1 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
seq 1 1 |
|
|
|
|
parallel --retries 2 --sshlogin 1/localhost,1/: -j1 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
seq 1 1 |
|
|
|
|
parallel --retries 2 --sshlogin 1/localhost,1/: -j9 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
seq 1 1 |
|
|
|
|
parallel --retries 2 --sshlogin 1/localhost,1/: -j0 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
|
|
|
|
echo '### These were not affected by the bug'
|
|
|
|
seq 1 8 |
|
|
|
|
parallel --retries 2 --sshlogin 1/localhost,9/: -j-1 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
seq 1 8 |
|
|
|
|
parallel --retries 2 --sshlogin 8/localhost,8/: -j-1 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
seq 1 1 |
|
|
|
|
parallel --retries 2 --sshlogin 1/localhost,1/: "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
seq 1 4 |
|
|
|
|
parallel --retries 2 --sshlogin 2/localhost,2/: -j-1 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
seq 1 4 |
|
|
|
|
parallel --retries 2 --sshlogin 2/localhost,2/: -j1 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
seq 1 4 |
|
|
|
|
parallel --retries 2 --sshlogin 1/localhost,1/: -j1 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
seq 1 2 |
|
|
|
|
parallel --retries 2 --sshlogin 1/localhost,1/: -j1 "hostname; false" |
|
|
|
|
wc -l
|
|
|
|
}
|
|
|
|
|
2017-01-06 21:53:21 +00:00
|
|
|
export -f $(compgen -A function | grep par_)
|
|
|
|
#compgen -A function | grep par_ | sort | parallel --delay $D -j$P --tag -k '{} 2>&1'
|
2017-01-12 22:36:15 +00:00
|
|
|
compgen -A function | grep par_ | sort |
|
|
|
|
parallel --joblog /tmp/jl-`basename $0` --delay 0.1 -j10 --tag -k '{} 2>&1'
|