diff --git a/Makefile b/Makefile index 3dd1a198..fdb6eb78 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ unittest: parallel unittest/tests-to-run/* unittest/wanted-results/* clean: rm -f parallel.1 + rm -rf unittest/input-files/random_dirs_no_newline + rm -rf unittest/input-files/random_dirs_with_newline dist: rm -rf ./unittest/input-files/random_dirs_*_newline || /bin/true diff --git a/unittest/actual-results/test16 b/unittest/actual-results/test16 new file mode 100644 index 00000000..1cb27194 --- /dev/null +++ b/unittest/actual-results/test16 @@ -0,0 +1,185 @@ +a1b1^c1[.}c a2b2^c2[.}c a3b3^c3[.}c a4b4^c4[.}c a5b5^c5[.}c a6b6^c6[.}c +ls 1-col.diff|wc;echo 1-col.diff + 1 1 11 +1-col.diff +ls 1-col.txt|wc;echo 1-col.txt + 1 1 10 +1-col.txt +ls 2-col.diff|wc;echo 2-col.diff + 1 1 11 +2-col.diff +ls 2-col.txt|wc;echo 2-col.txt + 1 1 10 +2-col.txt +ls a|wc;echo a + 3 3 13 +a +ls b|wc;echo b + 2 2 8 +b +ls 中国\ \(Zhōngguó\)|wc;echo 中国\ \(Zhōngguó\) + 4 12 118 +中国 (Zhōngguó) +1 1-col.diff +1 1-col.txt +1 2-col.diff +1 2-col.txt +3 a +2 b +4 中国 (Zhōngguó) +1 1-col.diff +1 1-col.txt +1 2-col.diff +1 2-col.txt +3 a +2 b +4 中国 (Zhōngguó) +touch -- 1-col/abc-1-col-1-col +touch -- 1-col/abc-1-col-1-col.diff +touch -- 1-col/abc-1-col-1-col.txt +touch -- 2-col/abc-2-col-2-col +touch -- 2-col/abc-2-col-2-col.diff +touch -- 2-col/abc-2-col-2-col.txt +touch -- a/abc-a-a +touch -- b/abc-b-b +touch -- 中国\ \(Zhōngguó\)/abc-中国\ \(Zhōngguó\)-中国\ \(Zhōngguó\) +rm -- 1-col/abc-1-col-1-col +rm -- 1-col/abc-1-col-1-col.diff +rm -- 1-col/abc-1-col-1-col.txt +rm -- 2-col/abc-2-col-2-col +rm -- 2-col/abc-2-col-2-col.diff +rm -- 2-col/abc-2-col-2-col.txt +rm -- a/abc-a-a +rm -- b/abc-b-b +rm -- 中国\ \(Zhōngguó\)/abc-中国\ \(Zhōngguó\)-中国\ \(Zhōngguó\) +1foo bar joe.gif2foo bar joe3 Afoo bar joeBfoo bar joeC +1foo2foo3 1bar2bar3 1joe.gif2joe3 AfooBfooC AbarBbarC AjoeBjoeC +a1.gif 2.gif 3.gif 4.gif 5.gif 6.gif b1 2 3 4 5 6 c1 2 3 4 5 6 +a1.gifb1c1 a 2.gifb 2c 2 a 3.gifb 3c 3 a 4.gifb 4c 4 a 5.gifb 5c 5 a 6.gifb 6c 6 abc +98c94dcab1efedab3f820935d230bc77 - + 12 180011 1286837 +12de4813eda45d364a51bef697eee299 - + 13 120000 1586682 +19 +15 +13 +10 +7 +9 +'a' +'a' +begin +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +end +1 1 +2 1 +2 2 +3 1 +3 2 +3 3 +4 1 +4 2 +4 3 +4 4 +5 1 +5 2 +5 3 +5 4 +5 5 +6 1 +6 2 +6 3 +6 4 +6 5 +6 6 +7 1 +7 2 +7 3 +7 4 +7 5 +7 6 +7 7 +8 1 +8 2 +8 3 +8 4 +8 5 +8 6 +8 7 +8 8 +9 1 +9 2 +9 3 +9 4 +9 5 +9 6 +9 7 +9 8 +9 9 +10 1 +10 2 +10 3 +10 4 +10 5 +10 6 +10 7 +10 8 +10 9 +10 10 +a1 b1 +a2 b1 b2 +a3 b1 b2 b3 +a4 b1 b2 b3 b4 +a5 b1 b2 b3 b4 b5 +a6 b1 b2 b3 b4 b5 b6 +a7 b1 b2 b3 b4 b5 b6 b7 +a8 b1 b2 b3 b4 b5 b6 b7 b8 +a9 b1 b2 b3 b4 b5 b6 b7 b8 b9 +a10 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 +a1 b1 +a2 b1 2 +a3 b1 2 3 +a4 b1 2 3 4 +a5 b1 2 3 4 5 +a6 b1 2 3 4 5 6 +a7 b1 2 3 4 5 6 7 +a8 b1 2 3 4 5 6 7 8 +a9 b1 2 3 4 5 6 7 8 9 +a10 b1 2 3 4 5 6 7 8 9 10 +replace +replace +echo bar +echo car +echo far +echo bar +echo car +echo far diff --git a/unittest/tests-to-run/test01.sh b/unittest/tests-to-run/test01.sh index 9b27096a..e659d0ef 100644 --- a/unittest/tests-to-run/test01.sh +++ b/unittest/tests-to-run/test01.sh @@ -1,7 +1,6 @@ #!/bin/bash -rm -rf tmp 2>/dev/null -cp -a input-files/testdir tmp +rsync -Ha --delete input-files/testdir/ tmp/ cd tmp echo echo test of cat pipe sh | parallel -j 50 2>&1 diff --git a/unittest/tests-to-run/test16.sh b/unittest/tests-to-run/test16.sh new file mode 100644 index 00000000..52d38dcd --- /dev/null +++ b/unittest/tests-to-run/test16.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# Test {.} + +# Test weird regexp chars +seq 1 6 | parallel -j1 -I :: -X echo a::b::^c::[.}c | mop + +rsync -Ha --delete input-files/testdir2/ tmp/ +cd tmp + +find . -name '*.jpg' | parallel -j +0 convert -geometry 120 {} {.}_thumb.jpg + +find -type f | parallel -k diff {} a/foo ">"{.}.diff +ls | parallel -kvg "ls {}|wc;echo {}" +ls | parallel -kj500 'sleep 1; ls {} | perl -ne "END{print $..\" {}\n\"}"' +ls | parallel -kgj500 'sleep 1; ls {} | perl -ne "END{print $..\" {}\n\"}"' +mkdir 1-col 2-col +ls | parallel -kv touch -- {.}/abc-{.}-{} 2>&1 +ls | parallel -kv rm -- {.}/abc-{.}-{} 2>&1 +#test05.sh:find . -type d -print0 | perl -0 -pe 's:^./::' | parallel -0 -v touch -- {}/abc-{}-{} 2>&1 \ +#test05.sh:find . -type d -print0 | perl -0 -pe 's:^./::' | parallel -0 -v rm -- {}/abc-{}-{} 2>&1 \ +#test05.sh:find . -type d -print0 | perl -0 -pe 's:^./::' | parallel -0 -v rmdir -- {} 2>&1 \ +(echo foo;echo bar;echo joe.gif) | parallel -km echo 1{}2{.}3 A{.}B{.}C +(echo foo;echo bar;echo joe.gif) | parallel -kX echo 1{}2{.}3 A{.}B{.}C +seq 1 6 | parallel -kX echo -e '{}.gif\\n' | parallel -km echo a{}b{.}c{.} +seq 1 6 | parallel -kX echo -e '{}.gif\\n' | parallel -kX echo a{}b{.}c{.} +seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -km echo a{}b{.}c{.} | mop -d 4 "|md5sum" "| wc" +seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -kX echo a{}b{.}c{.} | mop -d 4 "|md5sum" "| wc" +seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -kX echo a{}b{.}c{.}{.}{} | wc -l +seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -kX echo a{}b{.}c{.}{.} | wc -l +seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -kX echo a{}b{.}c{.} | wc -l +seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -kX echo a{}b{.}c | wc -l +seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -kX echo a{}b | wc -l +seq 1 60000 | parallel -I :: -X echo a::b::c:: | wc -l +echo a | parallel -qX echo "'"{.}"' " +echo a | parallel -qX echo "'{.}'" +(echo "sleep 3; echo begin"; seq 1 30 | parallel -kq echo "sleep 1; echo {.}"; echo "echo end") \ +| parallel -k -j0 +seq 1 10 | parallel -k 'seq 1 {.} | parallel -k -I :: echo {.} ::' +seq 1 10 | parallel -k 'seq 1 {.} | parallel -X -k -I :: echo a{.} b::' +seq 1 10 | parallel -k 'seq 1 {.} | parallel -m -k -I :: echo a{.} b::' +(echo a; echo END; echo b) | parallel -k -i -eEND echo repl{.}ce +(echo a; echo END; echo b) | parallel -k --replace -eEND echo repl{.}ce +(echo b; echo c; echo f) | parallel -k -t echo {.}ar 2>&1 >/dev/null +(echo b; echo c; echo f) | parallel -k --verbose echo {.}ar 2>&1 >/dev/null diff --git a/unittest/wanted-results/test16 b/unittest/wanted-results/test16 new file mode 100644 index 00000000..1cb27194 --- /dev/null +++ b/unittest/wanted-results/test16 @@ -0,0 +1,185 @@ +a1b1^c1[.}c a2b2^c2[.}c a3b3^c3[.}c a4b4^c4[.}c a5b5^c5[.}c a6b6^c6[.}c +ls 1-col.diff|wc;echo 1-col.diff + 1 1 11 +1-col.diff +ls 1-col.txt|wc;echo 1-col.txt + 1 1 10 +1-col.txt +ls 2-col.diff|wc;echo 2-col.diff + 1 1 11 +2-col.diff +ls 2-col.txt|wc;echo 2-col.txt + 1 1 10 +2-col.txt +ls a|wc;echo a + 3 3 13 +a +ls b|wc;echo b + 2 2 8 +b +ls 中国\ \(Zhōngguó\)|wc;echo 中国\ \(Zhōngguó\) + 4 12 118 +中国 (Zhōngguó) +1 1-col.diff +1 1-col.txt +1 2-col.diff +1 2-col.txt +3 a +2 b +4 中国 (Zhōngguó) +1 1-col.diff +1 1-col.txt +1 2-col.diff +1 2-col.txt +3 a +2 b +4 中国 (Zhōngguó) +touch -- 1-col/abc-1-col-1-col +touch -- 1-col/abc-1-col-1-col.diff +touch -- 1-col/abc-1-col-1-col.txt +touch -- 2-col/abc-2-col-2-col +touch -- 2-col/abc-2-col-2-col.diff +touch -- 2-col/abc-2-col-2-col.txt +touch -- a/abc-a-a +touch -- b/abc-b-b +touch -- 中国\ \(Zhōngguó\)/abc-中国\ \(Zhōngguó\)-中国\ \(Zhōngguó\) +rm -- 1-col/abc-1-col-1-col +rm -- 1-col/abc-1-col-1-col.diff +rm -- 1-col/abc-1-col-1-col.txt +rm -- 2-col/abc-2-col-2-col +rm -- 2-col/abc-2-col-2-col.diff +rm -- 2-col/abc-2-col-2-col.txt +rm -- a/abc-a-a +rm -- b/abc-b-b +rm -- 中国\ \(Zhōngguó\)/abc-中国\ \(Zhōngguó\)-中国\ \(Zhōngguó\) +1foo bar joe.gif2foo bar joe3 Afoo bar joeBfoo bar joeC +1foo2foo3 1bar2bar3 1joe.gif2joe3 AfooBfooC AbarBbarC AjoeBjoeC +a1.gif 2.gif 3.gif 4.gif 5.gif 6.gif b1 2 3 4 5 6 c1 2 3 4 5 6 +a1.gifb1c1 a 2.gifb 2c 2 a 3.gifb 3c 3 a 4.gifb 4c 4 a 5.gifb 5c 5 a 6.gifb 6c 6 abc +98c94dcab1efedab3f820935d230bc77 - + 12 180011 1286837 +12de4813eda45d364a51bef697eee299 - + 13 120000 1586682 +19 +15 +13 +10 +7 +9 +'a' +'a' +begin +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +end +1 1 +2 1 +2 2 +3 1 +3 2 +3 3 +4 1 +4 2 +4 3 +4 4 +5 1 +5 2 +5 3 +5 4 +5 5 +6 1 +6 2 +6 3 +6 4 +6 5 +6 6 +7 1 +7 2 +7 3 +7 4 +7 5 +7 6 +7 7 +8 1 +8 2 +8 3 +8 4 +8 5 +8 6 +8 7 +8 8 +9 1 +9 2 +9 3 +9 4 +9 5 +9 6 +9 7 +9 8 +9 9 +10 1 +10 2 +10 3 +10 4 +10 5 +10 6 +10 7 +10 8 +10 9 +10 10 +a1 b1 +a2 b1 b2 +a3 b1 b2 b3 +a4 b1 b2 b3 b4 +a5 b1 b2 b3 b4 b5 +a6 b1 b2 b3 b4 b5 b6 +a7 b1 b2 b3 b4 b5 b6 b7 +a8 b1 b2 b3 b4 b5 b6 b7 b8 +a9 b1 b2 b3 b4 b5 b6 b7 b8 b9 +a10 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 +a1 b1 +a2 b1 2 +a3 b1 2 3 +a4 b1 2 3 4 +a5 b1 2 3 4 5 +a6 b1 2 3 4 5 6 +a7 b1 2 3 4 5 6 7 +a8 b1 2 3 4 5 6 7 8 +a9 b1 2 3 4 5 6 7 8 9 +a10 b1 2 3 4 5 6 7 8 9 10 +replace +replace +echo bar +echo car +echo far +echo bar +echo car +echo far