From c535c25450321782653d653b0abef51d7e880f53 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Mon, 21 Feb 2011 02:31:30 +0100 Subject: [PATCH] parallel: implemented /etc/parallel/config. Passes testsuite. --- doc/release_new_version | 9 ++++++- src/parallel | 6 +++-- testsuite/tests-to-run/test15.sh | 4 ++-- testsuite/tests-to-run/test51.sh | 6 ++--- testsuite/tests-to-run/test52.sh | 16 ++++++++++--- testsuite/wanted-results/test15 | 12 +++++----- testsuite/wanted-results/test51 | 1 - testsuite/wanted-results/test52 | 41 ++++++++++++++++++++++++++++++++ 8 files changed, 77 insertions(+), 18 deletions(-) diff --git a/doc/release_new_version b/doc/release_new_version index ea3fe408..198c4a46 100644 --- a/doc/release_new_version +++ b/doc/release_new_version @@ -147,12 +147,19 @@ at: http://ftp.gnu.org/gnu/parallel/ New in this release: +* --tollef to be switch compatible with Tollef's parallel. + +* Site wide config file: /etc/parallel/config + * Opscode Cookbook for Chef. Thanks to Joshua Timberman. https://github.com/opscode/cookbooks/tree/master/gnu_parallel -* The examples translated into Japanese. Thanks to Koshigoe. +* Man page examples translated into Japanese. Thanks to Koshigoe. http://w.koshigoe.jp/study/?%5Bsystem%5D+GNU+parallel+%BB%C8%CD%D1%CE%E3#l13 +* Review with examples in German. Thanks to M. Nieberg. + http://kenntwas.de/2011/linux/gnu-parallel/ + * A review of the --pipe option in German. Thanks to Mathias Huber. http://www.linux-magazin.de/NEWS/GNU-Parallel-20110205-stueckelt-Daten diff --git a/src/parallel b/src/parallel index c0f39911..0072df97 100755 --- a/src/parallel +++ b/src/parallel @@ -574,8 +574,10 @@ sub read_options { # Add options from .parallel/config and other profiles my @ARGV_profile = (); my @ARGV_env = (); - my @config_profiles = ($ENV{'HOME'}."/.parallel/config", - $ENV{'HOME'}."/.parallelrc"); + my @config_profiles = ( + "/etc/parallel/config", + $ENV{'HOME'}."/.parallel/config", + $ENV{'HOME'}."/.parallelrc"); my @profiles = @config_profiles; if($::opt_profile) { # --profile overrides default profiles diff --git a/testsuite/tests-to-run/test15.sh b/testsuite/tests-to-run/test15.sh index 832ca06c..fc204f5a 100755 --- a/testsuite/tests-to-run/test15.sh +++ b/testsuite/tests-to-run/test15.sh @@ -6,8 +6,8 @@ echo '### Test -p --interactive' cat >/tmp/parallel-script-for-expect <<_EOF #!/bin/bash -seq 1 3 | parallel -k -p echo opt-p -seq 1 3 | parallel -k --interactive echo opt--interactive +seq 1 3 | parallel -k -p "sleep 0.1; echo opt-p" +seq 1 3 | parallel -k --interactive "sleep 0.1; echo opt--interactive" _EOF chmod 755 /tmp/parallel-script-for-expect diff --git a/testsuite/tests-to-run/test51.sh b/testsuite/tests-to-run/test51.sh index b55d8227..16675434 100644 --- a/testsuite/tests-to-run/test51.sh +++ b/testsuite/tests-to-run/test51.sh @@ -78,13 +78,13 @@ echo 12a34b45a6 | parallel -k --pipe --recend 'b' --rrs 'echo -n "$PARALLEL_SEQ>"; cat; echo; sleep 0.1' echo '### Test -N even' -seq 1 10 | parallel -j2 -k -N 2 --pipe cat";echo ole;sleep 0.1" +seq 1 10 | parallel -j2 -k -N 2 --pipe cat";echo ole;sleep 0.\$PARALLEL_SEQ" echo '### Test -N odd' -seq 1 11 | parallel -j2 -k -N 2 --pipe cat";echo ole;sleep 0.1" +seq 1 11 | parallel -j2 -k -N 2 --pipe cat";echo ole;sleep 0.\$PARALLEL_SEQ" echo '### Test -N even+2' -seq 1 12 | parallel -j2 -k -N 2 --pipe cat";echo ole;sleep 0.1" +seq 1 12 | parallel -j2 -k -N 2 --pipe cat";echo ole;sleep 0.\$PARALLEL_SEQ" echo '### Test --recstart + --recend' cat /tmp/blocktest | parallel -k --recstart 44 --recend "44" -j10 --pipe sort -n |md5sum diff --git a/testsuite/tests-to-run/test52.sh b/testsuite/tests-to-run/test52.sh index 8af65027..98f65a03 100644 --- a/testsuite/tests-to-run/test52.sh +++ b/testsuite/tests-to-run/test52.sh @@ -1,10 +1,20 @@ #!/bin/bash echo '### Test --tollef' -parallel --tollef echo -- 1 2 3 +parallel -k --tollef echo -- 1 2 3 ::: a b c echo '### Test --tollef --gnu' -parallel --tollef --gnu echo ::: 1 2 3 +parallel -k --tollef --gnu echo ::: 1 2 3 -- a b c echo '### Test --gnu' -parallel --gnu echo ::: 1 2 3 +parallel -k --gnu echo ::: 1 2 3 -- a b c + +echo "### test global config" +echo /etc/parallel/config | sudo parallel "echo --tollef > " +parallel -k echo -- 1 2 3 ::: a b c +parallel -k --gnu echo ::: 1 2 3 -- a b c +echo --gnu > ~/.parallel/config +parallel -k echo ::: 1 2 3 -- a b c +parallel -k --gnu echo ::: 1 2 3 -- a b c +sudo rm /etc/parallel/config +rm ~/.parallel/config diff --git a/testsuite/wanted-results/test15 b/testsuite/wanted-results/test15 index 69d183de..e2066cbf 100644 --- a/testsuite/wanted-results/test15 +++ b/testsuite/wanted-results/test15 @@ -1,14 +1,14 @@ ### Test -p --interactive spawn /tmp/parallel-script-for-expect -echo opt-p 1 ?...y -echo opt-p 2 ?...n +sleep 0.1; echo opt-p 1 ?...y +sleep 0.1; echo opt-p 2 ?...n +sleep 0.1; echo opt-p 3 ?...y opt-p 1 -echo opt-p 3 ?...y opt-p 3 -echo opt--interactive 1 ?...y -echo opt--interactive 2 ?...n +sleep 0.1; echo opt--interactive 1 ?...y +sleep 0.1; echo opt--interactive 2 ?...n +sleep 0.1; echo opt--interactive 3 ?...y opt--interactive 1 -echo opt--interactive 3 ?...y opt--interactive 3 ### Test -L -l and --max-lines a_b diff --git a/testsuite/wanted-results/test51 b/testsuite/wanted-results/test51 index ad1a6b91..6e72f779 100644 --- a/testsuite/wanted-results/test51 +++ b/testsuite/wanted-results/test51 @@ -132,7 +132,6 @@ ole 9 10 ole -ole ### Test -N odd 1 2 diff --git a/testsuite/wanted-results/test52 b/testsuite/wanted-results/test52 index cf2ea57d..a63dc8bc 100644 --- a/testsuite/wanted-results/test52 +++ b/testsuite/wanted-results/test52 @@ -2,11 +2,52 @@ 1 2 3 +::: +a +b +c ### Test --tollef --gnu 1 2 3 +-- +a +b +c ### Test --gnu 1 2 3 +-- +a +b +c +### test global config +1 +2 +3 +::: +a +b +c +1 +2 +3 +-- +a +b +c +1 +2 +3 +-- +a +b +c +1 +2 +3 +-- +a +b +c