From d5fa05b4250bfa6f620372a6060a18eb8428eb9b Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sun, 3 Mar 2013 13:45:31 +0100 Subject: [PATCH] Fixed bug #38354: -J profile_name should read from `pwd`/profile_name before ~/.parallel/profile_name --- src/parallel | 6 +- src/parallel.pod | 11 ++-- src/parallel.texi | 19 +++--- testsuite/tests-to-run/parallel-local164.sh | 57 +++++++++-------- testsuite/wanted-results/parallel-local164 | 70 +++++++++++---------- 5 files changed, 87 insertions(+), 76 deletions(-) diff --git a/src/parallel b/src/parallel index 93348dbe..47da84b0 100755 --- a/src/parallel +++ b/src/parallel @@ -1014,7 +1014,11 @@ sub read_options { # --profile overrides default profiles @profiles = (); for my $profile (@opt::profile) { - push @profiles, $ENV{'HOME'}."/.parallel/".$profile; + if(-r $profile) { + push @profiles, $profile; + } else { + push @profiles, $ENV{'HOME'}."/.parallel/".$profile; + } } } for my $profile (@profiles) { diff --git a/src/parallel.pod b/src/parallel.pod index 3790309a..3d97570a 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -839,9 +839,9 @@ B<--progress> on a running GNU B process. See also: B<--eta> -=item B<--max-args>=I +=item B<--max-args>=I (alpha testing) -=item B<-n> I +=item B<-n> I (alpha testing) Use at most I arguments per command line. Fewer than I arguments will be used if the size (see the B<-s> option) @@ -854,9 +854,9 @@ line. Implies B<-X> unless B<-m> is set. -=item B<--max-replace-args>=I +=item B<--max-replace-args>=I (alpha testing) -=item B<-N> I +=item B<-N> I (alpha testing) Use at most I arguments per command line. Like B<-n> but also makes replacement strings B<{1}> .. B<{>IB<}> that @@ -873,8 +873,7 @@ B Implies B<-X> unless B<-m> or B<--pipe> is set. When used with B<--pipe> B<-N> is the number of records to read. This -is much slower than B<--block> so avoid it if performance is -important. +is somewhat slower than B<--block>. =item B<--max-line-length-allowed> diff --git a/src/parallel.texi b/src/parallel.texi index 6527b75a..bc3b9ba1 100644 --- a/src/parallel.texi +++ b/src/parallel.texi @@ -895,11 +895,11 @@ By sending GNU @strong{parallel} SIGUSR2 you can toggle turning on/off See also: @strong{--eta} -@item @strong{--max-args}=@emph{max-args} -@anchor{@strong{--max-args}=@emph{max-args}} +@item @strong{--max-args}=@emph{max-args} (alpha testing) +@anchor{@strong{--max-args}=@emph{max-args} (alpha testing)} -@item @strong{-n} @emph{max-args} -@anchor{@strong{-n} @emph{max-args}} +@item @strong{-n} @emph{max-args} (alpha testing) +@anchor{@strong{-n} @emph{max-args} (alpha testing)} Use at most @emph{max-args} arguments per command line. Fewer than @emph{max-args} arguments will be used if the size (see the @strong{-s} option) @@ -911,11 +911,11 @@ line. Implies @strong{-X} unless @strong{-m} is set. -@item @strong{--max-replace-args}=@emph{max-args} -@anchor{@strong{--max-replace-args}=@emph{max-args}} +@item @strong{--max-replace-args}=@emph{max-args} (alpha testing) +@anchor{@strong{--max-replace-args}=@emph{max-args} (alpha testing)} -@item @strong{-N} @emph{max-args} -@anchor{@strong{-N} @emph{max-args}} +@item @strong{-N} @emph{max-args} (alpha testing) +@anchor{@strong{-N} @emph{max-args} (alpha testing)} Use at most @emph{max-args} arguments per command line. Like @strong{-n} but also makes replacement strings @strong{@{1@}} .. @strong{@{}@emph{max-args}@strong{@}} that @@ -932,8 +932,7 @@ This will set the owner of the homedir to the user: Implies @strong{-X} unless @strong{-m} or @strong{--pipe} is set. When used with @strong{--pipe} @strong{-N} is the number of records to read. This -is much slower than @strong{--block} so avoid it if performance is -important. +is somewhat slower than @strong{--block}. @item @strong{--max-line-length-allowed} @anchor{@strong{--max-line-length-allowed}} diff --git a/testsuite/tests-to-run/parallel-local164.sh b/testsuite/tests-to-run/parallel-local164.sh index 9db99c2f..58ff89dc 100644 --- a/testsuite/tests-to-run/parallel-local164.sh +++ b/testsuite/tests-to-run/parallel-local164.sh @@ -2,10 +2,39 @@ # -L1 will join lines ending in ' ' cat <<'EOF' | parallel -j10 -k -L1 +echo '### bug #38354: -J profile_name should read from `pwd`/profile_name before ~/.parallel/profile_name' + echo "echo echo from ./local_test_profile" > local_test_profile; + parallel --profile local_test_profile echo ::: 1; + rm local_test_profile + echo "### Test --delay" seq 9 | /usr/bin/time -f %e parallel -j3 --delay 0.57 true {} 2>&1 | perl -ne '$_ > 5 and print "More than 5 secs: OK\n"' +echo '### test --sshdelay' + stdout /usr/bin/time -f %e parallel -j0 --sshdelay 0.5 -S localhost true ::: 1 2 3 | perl -ne 'print($_ > 1.80 ? "OK\n" : "Not OK\n")' + +echo '### bug #38299: --resume-failed -k' + rm /tmp/joblog-38299; + parallel -k --resume-failed --joblog /tmp/joblog-38299 echo job{#} val {}\;exit {} ::: 0 1 2 3 0 1; + echo try 2. Gives failing - not 0; + parallel -k --resume-failed --joblog /tmp/joblog-38299 echo job{#} val {}\;exit {} ::: 0 1 2 3 0 1; + echo with exit 0; + parallel -k --resume-failed --joblog /tmp/joblog-38299 echo job{#} val {}\;exit 0 ::: 0 1 2 3 0 1; + echo try 2 again. Gives empty; + parallel -k --resume-failed --joblog /tmp/joblog-38299 echo job{#} val {}\;exit {} ::: 0 1 2 3 0 1 + +echo '### --resume -k' + rm -f /tmp/joblog-resume; + parallel -k --resume --joblog /tmp/joblog-resume echo job{}id\;exit {} ::: 0 1 2 3 0 5; + echo try 2 = nothing; + parallel -k --resume --joblog /tmp/joblog-resume echo job{}id\;exit {} ::: 0 1 2 3 0 5; + echo two extra; + parallel -k --resume --joblog /tmp/joblog-resume echo job{}id\;exit 0 ::: 0 1 2 3 0 5 6 7 + +echo "bug #37694: Empty string argument skipped when using --quote" + parallel -q --nonall perl -le 'print scalar @ARGV' 'a' 'b' '' + echo '### Test -k 5'; sleep 5 @@ -35,17 +64,14 @@ seq 1 10 | parallel -j 1 echo | sort seq 1 10 | parallel -j 2 echo | sort seq 1 10 | parallel -j 3 echo | sort -echo "bug #37694: Empty string argument skipped when using --quote" - parallel -q --nonall perl -le 'print scalar @ARGV' 'a' 'b' '' - echo "bug #37956: --colsep does not default to '\t' as specified in the man page." printf "A\tB\n1\tone" | parallel --header : echo {B} {A} echo '### Test --tollef' - parallel -k --tollef echo -- 1 2 3 ::: a b c | sort + stdout parallel -k --tollef echo -- 1 2 3 ::: a b c | sort echo '### Test --tollef --gnu' - parallel -k --tollef --gnu echo ::: 1 2 3 -- a b c + stdout parallel -k --tollef --gnu echo ::: 1 2 3 -- a b c echo '### Test --gnu' parallel -k --gnu echo ::: 1 2 3 -- a b c @@ -109,31 +135,10 @@ echo '### -k -i -0' echo '### -k -0 -i repl' printf '1\0002\0003\0004\0005\000' | stdout parallel -k -0 -i repl echo repl OK -echo '### test --sshdelay' - stdout /usr/bin/time -f %e parallel -j0 --sshdelay 0.5 -S localhost true ::: 1 2 3 | perl -ne 'print($_ > 1.80 ? "OK\n" : "Not OK\n")' - echo '### Negative replacement strings' parallel -X -j1 -N 6 echo {-1}orrec{1} ::: t B X D E c parallel -N 6 echo {-1}orrect ::: A B X D E c parallel --colsep ' ' echo '{2} + {4} = {2} + {-1}=' '$(( {2} + {-1} ))' ::: "1 2 3 4" parallel --colsep ' ' echo '{-3}orrect' ::: "1 c 3 4" -echo '### bug #38299: --resume-failed -k'; - rm /tmp/joblog-38299; - parallel -k --resume-failed --joblog /tmp/joblog-38299 echo job{#} val {}\;exit {} ::: 0 1 2 3 0 1; - echo try 2. Gives failing - not 0; - parallel -k --resume-failed --joblog /tmp/joblog-38299 echo job{#} val {}\;exit {} ::: 0 1 2 3 0 1; - echo with exit 0; - parallel -k --resume-failed --joblog /tmp/joblog-38299 echo job{#} val {}\;exit 0 ::: 0 1 2 3 0 1; - echo try 2 again. Gives empty; - parallel -k --resume-failed --joblog /tmp/joblog-38299 echo job{#} val {}\;exit {} ::: 0 1 2 3 0 1 - -echo '### --resume -k'; - rm -f /tmp/joblog-resume; - parallel -k --resume --joblog /tmp/joblog-resume echo job{}id\;exit {} ::: 0 1 2 3 0 5; - echo try 2 = nothing; - parallel -k --resume --joblog /tmp/joblog-resume echo job{}id\;exit {} ::: 0 1 2 3 0 5; - echo two extra; - parallel -k --resume --joblog /tmp/joblog-resume echo job{}id\;exit 0 ::: 0 1 2 3 0 5 6 7 - EOF diff --git a/testsuite/wanted-results/parallel-local164 b/testsuite/wanted-results/parallel-local164 index b2ac82f6..fcd3719e 100644 --- a/testsuite/wanted-results/parallel-local164 +++ b/testsuite/wanted-results/parallel-local164 @@ -1,5 +1,40 @@ +### bug #38354: -J profile_name should read from `pwd`/profile_name before ~/.parallel/profile_name +echo from ./local_test_profile echo 1 ### Test --delay More than 5 secs: OK +### test --sshdelay +OK +### bug #38299: --resume-failed -k +job1 val 0 +job2 val 1 +job3 val 2 +job4 val 3 +job5 val 0 +job6 val 1 +try 2. Gives failing - not 0 +job2 val 1 +job3 val 2 +job4 val 3 +job6 val 1 +with exit 0 +job2 val 1 +job3 val 2 +job4 val 3 +job6 val 1 +try 2 again. Gives empty +### --resume -k +job0id +job1id +job2id +job3id +job0id +job5id +try 2 = nothing +two extra +job6id +job7id +bug #37694: Empty string argument skipped when using --quote +3 ### Test -k 5 ### Test -k 3 ### Test -k 4 @@ -46,8 +81,6 @@ d 7 8 9 -bug #37694: Empty string argument skipped when using --quote -3 bug #37956: --colsep does not default to '\t' as specified in the man page. one 1 ### Test --tollef @@ -58,6 +91,8 @@ one 1 a b c +parallel: Warning: See: http://lists.gnu.org/archive/html/parallel/2013-02/msg00018.html +parallel: Warning: YOU ARE USING --tollef. --tollef is obsolete and will be retired 20140222. ### Test --tollef --gnu 1 2 @@ -197,39 +232,8 @@ OK 3 OK 4 OK 5 OK -### test --sshdelay -OK ### Negative replacement strings correct correct 2 + 4 = 2 + 4= 6 correct -### bug #38299: --resume-failed -k -job1 val 0 -job2 val 1 -job3 val 2 -job4 val 3 -job5 val 0 -job6 val 1 -try 2. Gives failing - not 0 -job2 val 1 -job3 val 2 -job4 val 3 -job6 val 1 -with exit 0 -job2 val 1 -job3 val 2 -job4 val 3 -job6 val 1 -try 2 again. Gives empty -### --resume -k -job0id -job1id -job2id -job3id -job0id -job5id -try 2 = nothing -two extra -job6id -job7id