From 028e24274f6b2b9ab11917a7d56c06f73cf906d3 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sat, 20 Sep 2014 21:36:02 +0200 Subject: [PATCH] Passes testsuite. --- src/parallel.pod | 6 ++-- testsuite/Makefile | 4 +-- testsuite/input-files/perllib/perl | 1 + testsuite/tests-to-run/parallel-freebsd.sh | 16 +++++----- testsuite/tests-to-run/parallel-local150.sh | 9 ++++-- testsuite/tests-to-run/parallel-polarhome.sh | 6 ++-- testsuite/wanted-results/parallel-freebsd | 20 +++++------- testsuite/wanted-results/parallel-local150 | 32 +++----------------- 8 files changed, 36 insertions(+), 58 deletions(-) create mode 120000 testsuite/input-files/perllib/perl diff --git a/src/parallel.pod b/src/parallel.pod index 7c317dc2..3fb79d49 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -76,9 +76,9 @@ similar to B. The I must be an executable, a script, a composed command, or a function. -If it is a Bash function you need to B the -function first. An alias will, however, not work (see why -http://www.perlmonks.org/index.pl?node_id=484296). +If it is a Bash function you need to B the function +first. To use aliases copy the full environment as described under +B<--env> and use B instead of B. If it is a zsh function you will need to use this helper function B to export and to set $SHELL to bash: diff --git a/testsuite/Makefile b/testsuite/Makefile index c228d66e..d4d46fe3 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -45,8 +45,8 @@ startvm: # Make sure we can reach the virtual machines sudo ifconfig wlan0:0 192.168.1.72 # If they are already running: Don't fail - VBoxManage startvm CentOS3-root:centos3 || true - VBoxManage startvm RedHat9-root:redhat9 || true + VBoxManage startvm CentOS3-root:centos3 || VBoxManage controlvm CentOS3-root:centos3 resume || true + VBoxManage startvm RedHat9-root:redhat9 || VBoxManage controlvm RedHat9-root:redhat9 resume || true stopvm: VBoxManage controlvm CentOS3-root:centos3 savestate diff --git a/testsuite/input-files/perllib/perl b/testsuite/input-files/perllib/perl new file mode 120000 index 00000000..2cf28ba5 --- /dev/null +++ b/testsuite/input-files/perllib/perl @@ -0,0 +1 @@ +perl32 \ No newline at end of file diff --git a/testsuite/tests-to-run/parallel-freebsd.sh b/testsuite/tests-to-run/parallel-freebsd.sh index ef4f3690..d4a30493 100644 --- a/testsuite/tests-to-run/parallel-freebsd.sh +++ b/testsuite/tests-to-run/parallel-freebsd.sh @@ -9,10 +9,13 @@ ping -c 1 freebsd7.tange.dk >/dev/null 2>&1 ssh freebsd7.tange.dk touch .parallel/will-cite scp -q .*/src/{parallel,sem,sql,niceload} freebsd7.tange.dk:bin/ -cat <<'EOF' | sed -e 's/$SERVER1/'$SERVER1'/;s/$SERVER2/'$SERVER2'/' | stdout parallel -k -S freebsd7.tange.dk -vj9 +cat <<'EOF' | sed -e 's/$SERVER1/'$SERVER1'/;s/$SERVER2/'$SERVER2'/' | stdout parallel -k -S freebsd7.tange.dk -vj9 -L1 echo 'bug #40136: FreeBSD: No more processes' -# Long line due to FreeBSD's /bin/sh stupidity - sem --jobs 3 --id my_id -u 'echo First started; sleep 5; echo The first finished' && sem --jobs 3 --id my_id -u 'echo Second started; sleep 6; echo The second finished' && sem --jobs 3 --id my_id -u 'echo Third started; sleep 7; echo The third finished' && sem --jobs 3 --id my_id -u 'echo Fourth started; sleep 8; echo The fourth finished' && sem --wait --id my_id + sem --jobs 3 --id my_id -u 'echo First started; sleep 5; echo The first finished' && + sem --jobs 3 --id my_id -u 'echo Second started; sleep 6; echo The second finished' && + sem --jobs 3 --id my_id -u 'echo Third started; sleep 7; echo The third finished' && + sem --jobs 3 --id my_id -u 'echo Fourth started; sleep 8; echo The fourth finished' && + sem --wait --id my_id echo 'Test --compress --pipe' jot 1000 | parallel --compress --pipe cat | wc @@ -21,7 +24,7 @@ echo 'bug #41613: --compress --line-buffer no newline'; perl -e 'print "It worked"'| parallel --pipe --compress --line-buffer cat; echo echo 'bug #40135: FreeBSD: sem --fg does not finish under /bin/sh' - sem --fg 'sleep 1; echo The job finished' + sem --fg 'sleep 1; echo The job finished' echo 'bug #40133: FreeBSD: --round-robin gives no output' jot 1000000 | parallel --round-robin --pipe -kj3 wc | sort @@ -36,9 +39,8 @@ echo 'bug #40134: FreeBSD: --shebang(-wrap) not working' chmod 755 ./shebang-wrap; ./shebang-wrap wrap works echo 'bug #40134: FreeBSD: --shebang(-wrap) with options not working' - (echo '#!/usr/bin/env -S parallel --shebang-wrap -v -k -j 0 /usr/bin/perl -w :::'; echo 'print @ARGV,"\n";') > shebang-wrap; - chmod 755 ./shebang-wrap; ./shebang-wrap wrap works with options - + (echo '#!/usr/bin/env -S parallel --shebang-wrap -v -k -j 0 /usr/bin/perl -w :::'; echo 'print @ARGV,"\n";') > shebang-wrap-opt; + chmod 755 ./shebang-wrap-opt; ./shebang-wrap-opt wrap works with options EOF diff --git a/testsuite/tests-to-run/parallel-local150.sh b/testsuite/tests-to-run/parallel-local150.sh index 9f1073c2..8e569a15 100644 --- a/testsuite/tests-to-run/parallel-local150.sh +++ b/testsuite/tests-to-run/parallel-local150.sh @@ -3,13 +3,16 @@ rsync -Ha --delete input-files/segfault/ tmp/ cd tmp +median() { perl -e '@a=sort {$a<=>$b} <>;print $a[$#a/2]';} +export -f median + # -L1 will join lines ending in ' ' cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -vj0 -k -L1 echo '### bug #41565: Print happens in blocks - not after each job complete' -echo 'The timing here is important: 2 3 4 5 6' - ping -c 7 lo | parallel -j3 'echo {#}' | timestamp -dd | perl -pe '$_=int($_+0.2)."\n"' +echo 'The timing here is important: a full second between each' + ping -c 15 lo | parallel -j3 'echo {#}' | timestamp -dd | perl -pe '$_=int($_+0.3)."\n"' | median echo '300 ms jobs:' - ping -i .3 -c 10 lo | parallel -j3 --delay 0.3 echo | timestamp -d -d | perl -pe 's/(...).*/int($1*10+0.2)/e' | tail -n +2 + ping -i .3 -c 10 lo | parallel -j3 --delay 0.3 echo | timestamp -d -d | perl -pe 's/(.....).*/int($1*10+0.2)/e' | median echo '### Test --tagstring' nice parallel -j1 -X -v --tagstring a{}b echo ::: 3 4 diff --git a/testsuite/tests-to-run/parallel-polarhome.sh b/testsuite/tests-to-run/parallel-polarhome.sh index 5228bc8f..b8bcda6c 100644 --- a/testsuite/tests-to-run/parallel-polarhome.sh +++ b/testsuite/tests-to-run/parallel-polarhome.sh @@ -8,7 +8,7 @@ P_WORKING="minix freebsd solaris openbsd netbsd debian aix redhat hpux qnx tru64 P="$P_WORKING" POLAR=`parallel -k echo {}.polarhome.com ::: $P` -# Avoid the stupid /etc/issue.net banner at Polarhome +# Avoid the stupid /etc/issue.net banner at Polarhome: -oLogLevel=quiet echo '### Tests on polarhome machines' echo 'Setup on polarhome machines' @@ -19,8 +19,8 @@ copy_and_test() { # scp to each polarhome machine do not work. Use cat # Avoid the stupid /etc/issue.net banner with -oLogLevel=quiet echo '### Run the test on '$H - cat `which parallel` | ssh -oLogLevel=quiet $H 'cat > bin/p.tmp && chmod 755 bin/p.tmp && mv bin/p.tmp bin/parallel; bin/perl bin/parallel echo Works on {} ::: '$H + cat `which parallel` | ssh -oLogLevel=quiet $H 'cat > bin/p.tmp && chmod 755 bin/p.tmp && mv bin/p.tmp bin/parallel && bin/perl bin/parallel echo Works on {} ::: '$H } export -f copy_and_test -stdout parallel -j0 -k --timeout 80 --delay 0.1 --tag -v copy_and_test {} ::: $POLAR +stdout parallel -j0 -k --retries 5 --timeout 80 --delay 0.1 --tag -v copy_and_test {} ::: $POLAR diff --git a/testsuite/wanted-results/parallel-freebsd b/testsuite/wanted-results/parallel-freebsd index 0ec998a5..1e016129 100644 --- a/testsuite/wanted-results/parallel-freebsd +++ b/testsuite/wanted-results/parallel-freebsd @@ -2,7 +2,6 @@ tange@freebsd7 echo 'bug #40136: FreeBSD: No more processes' bug #40136: FreeBSD: No more processes -# Long line due to FreeBSD's /bin/sh stupidity sem --jobs 3 --id my_id -u 'echo First started; sleep 5; echo The first finished' && sem --jobs 3 --id my_id -u 'echo Second started; sleep 6; echo The second finished' && sem --jobs 3 --id my_id -u 'echo Third started; sleep 7; echo The third finished' && sem --jobs 3 --id my_id -u 'echo Fourth started; sleep 8; echo The fourth finished' && sem --wait --id my_id First started Second started @@ -22,7 +21,7 @@ bug #41613: --compress --line-buffer no newline It worked echo 'bug #40135: FreeBSD: sem --fg does not finish under /bin/sh' bug #40135: FreeBSD: sem --fg does not finish under /bin/sh - sem --fg 'sleep 1; echo The job finished' + sem --fg 'sleep 1; echo The job finished' The job finished echo 'bug #40133: FreeBSD: --round-robin gives no output' bug #40133: FreeBSD: --round-robin gives no output @@ -37,25 +36,22 @@ bug #40133: FreeBSD: --round-robin gives no output 315465 315465 2097150 echo 'bug #40134: FreeBSD: --shebang not working' bug #40134: FreeBSD: --shebang not working - (echo '#!/usr/bin/env -S parallel --shebang -rk echo'; echo It; echo worked) > shebang; - chmod 755 ./shebang; ./shebang + (echo '#!/usr/bin/env -S parallel --shebang -rk echo'; echo It; echo worked) > shebang; chmod 755 ./shebang; ./shebang It worked echo 'bug #40134: FreeBSD: --shebang(-wrap) not working' bug #40134: FreeBSD: --shebang(-wrap) not working - (echo '#!/usr/bin/env -S parallel --shebang-wrap /usr/bin/perl :::'; echo 'print @ARGV,"\n";') > shebang-wrap; - chmod 755 ./shebang-wrap; ./shebang-wrap wrap works + (echo '#!/usr/bin/env -S parallel --shebang-wrap /usr/bin/perl :::'; echo 'print @ARGV,"\n";') > shebang-wrap; chmod 755 ./shebang-wrap; ./shebang-wrap wrap works wrap works echo 'bug #40134: FreeBSD: --shebang(-wrap) with options not working' bug #40134: FreeBSD: --shebang(-wrap) with options not working - (echo '#!/usr/bin/env -S parallel --shebang-wrap -v -k -j 0 /usr/bin/perl -w :::'; echo 'print @ARGV,"\n";') > shebang-wrap; - chmod 755 ./shebang-wrap; ./shebang-wrap wrap works with options -/usr/bin/perl -w ./shebang-wrap wrap + (echo '#!/usr/bin/env -S parallel --shebang-wrap -v -k -j 0 /usr/bin/perl -w :::'; echo 'print @ARGV,"\n";') > shebang-wrap-opt; chmod 755 ./shebang-wrap-opt; ./shebang-wrap-opt wrap works with options +/usr/bin/perl -w ./shebang-wrap-opt wrap wrap -/usr/bin/perl -w ./shebang-wrap works +/usr/bin/perl -w ./shebang-wrap-opt works works -/usr/bin/perl -w ./shebang-wrap with +/usr/bin/perl -w ./shebang-wrap-opt with with -/usr/bin/perl -w ./shebang-wrap options +/usr/bin/perl -w ./shebang-wrap-opt options options diff --git a/testsuite/wanted-results/parallel-local150 b/testsuite/wanted-results/parallel-local150 index 9bc9b4c1..5248080b 100644 --- a/testsuite/wanted-results/parallel-local150 +++ b/testsuite/wanted-results/parallel-local150 @@ -1,36 +1,12 @@ echo '### bug #41565: Print happens in blocks - not after each job complete' ### bug #41565: Print happens in blocks - not after each job complete -echo 'The timing here is important: 2 3 4 5 6' -The timing here is important: 2 3 4 5 6 - ping -c 7 lo | parallel -j3 'echo {#}' | timestamp -dd | perl -pe '$_=int($_+0.2)."\n"' -2 +echo 'The timing here is important: a full second between each' +The timing here is important: a full second between each + ping -c 15 lo | parallel -j3 'echo {#}' | timestamp -dd | perl -pe '$_=int($_+0.3)."\n"' | median 1 -1 -1 -1 -0 -0 -0 -0 -0 -0 -0 echo '300 ms jobs:' 300 ms jobs: - ping -i .3 -c 10 lo | parallel -j3 --delay 0.3 echo | timestamp -d -d | perl -pe 's/(...).*/int($1*10+0.2)/e' | tail -n +2 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 + ping -i .3 -c 10 lo | parallel -j3 --delay 0.3 echo | timestamp -d -d | perl -pe 's/(.....).*/int($1*10+0.2)/e' | median 3 echo '### Test --tagstring' ### Test --tagstring