parallel/testsuite/tests-to-run/parallel-local19.sh

115 lines
4.1 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
# Test {.}
rsync -Ha --delete input-files/testdir2/ tmp/
cd tmp
2016-05-17 00:11:38 +00:00
echo '### Test {.} and {}'
2016-05-17 00:11:38 +00:00
find . -name '*.jpg' | parallel -j +0 convert -geometry 120 {} {.}_thumb.jpg
echo '### Test {.} with files that have no . but dir does'
2016-05-17 00:11:38 +00:00
mkdir -p /tmp/test-of-{.}-parallel/subdir;
touch /tmp/test-of-{.}-parallel/subdir/file;
touch /tmp/test-of-{.}-parallel/subdir/file{.}.funkyextension}};
find /tmp/test-of-{.}-parallel -type f | parallel echo {.} | sort;
rm -rf /tmp/test-of-{.}-parallel/subdir
2010-07-09 12:10:22 +00:00
find -type f | parallel -k diff {} a/foo ">"{.}.diff
2016-05-17 00:11:38 +00:00
ls | parallel -kv --group "ls {}|wc;echo {}"
ls | parallel -kj500 'sleep 1; ls {} | perl -ne "END{print $..\" {}\n\"}"'
ls | parallel -kj500 --group 'sleep 1; ls {} | perl -ne "END{print $..\" {}\n\"}"'
mkdir 1-col 2-col
2016-05-17 00:11:38 +00:00
2010-07-09 12:10:22 +00:00
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 \
# -L1 will join lines ending in ' '
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -vj0 -k -L1 --joblog /tmp/jl-`basename $0` -r
2014-02-16 15:34:47 +00:00
echo '### Test compress'
seq 5 | parallel -j2 --tag --compress 'seq {} | pv -q -L 10'
echo '### Test compress - stderr'
seq 5 | parallel -j2 --tag --compress 'seq {} | pv -q -L 10 >&2' 2>&1 >/dev/null
echo '### Test weird regexp chars'
seq 1 6 | parallel -j1 -I :: -X echo a::b::^c::[.}c
echo '### Test -m'
2016-05-17 00:11:38 +00:00
(echo foo;echo bar;echo joe.gif) | parallel -j1 -km echo 1{}2{.}3 A{.}B{.}C
(echo foo;echo bar;echo joe.gif) | parallel -j1 -kX echo 1{}2{.}3 A{.}B{.}C
seq 1 6 | parallel -k printf '{}.gif\\n' | parallel -j1 -km echo a{}b{.}c{.}
seq 1 6 | parallel -k printf '{}.gif\\n' | parallel -j1 -kX echo a{}b{.}c{.}
echo '### Test -m with 10000 args';
seq 10000 | perl -pe 's/$/.gif/' |
parallel -j1 -km echo a{}b{.}c{.} |
tee >(wc; sleep 1) >(md5sum; sleep 1) >/dev/null;
wait;
sleep 1
echo '### Test -X with 10000 args';
seq 10000 | perl -pe 's/$/.gif/' |
parallel -j1 -kX echo a{}b{.}c{.} |
tee >(wc; sleep 1) >(md5sum; sleep 1) >/dev/null;
wait;
sleep 1
echo '### Test -X with 10000 args and 5 expansions'
seq 10000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c{.}{.}{} | wc -l
seq 10000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c{.}{.} | wc -l
seq 10000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c{.} | wc -l
seq 10000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c | wc -l
seq 10000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b | wc -l
2016-05-17 00:11:38 +00:00
2010-07-09 12:10:22 +00:00
echo '### Test {.} does not repeat more than {}'
seq 15 | perl -pe 's/$/.gif/' | parallel -j1 -s 80 -kX echo a{}b{.}c{.}
seq 15 | perl -pe 's/$/.gif/' | parallel -j1 -s 80 -km echo a{}b{.}c{.}
2016-05-17 00:11:38 +00:00
echo '### Test -I with shell meta chars'
seq 10000 | parallel -j1 -I :: -X echo a::b::c:: | wc -l
seq 10000 | parallel -j1 -I '<>' -X echo 'a<>b<>c<>' | wc -l
seq 10000 | parallel -j1 -I '<' -X echo 'a<b<c<' | wc -l
seq 10000 | parallel -j1 -I '>' -X echo 'a>b>c>' | wc -l
2016-05-17 00:11:38 +00:00
echo '### Test {.}'
2016-05-17 00:11:38 +00:00
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
echo '### Test -I with -X and -m'
2016-05-17 00:11:38 +00:00
seq 10 | parallel -k 'seq 1 {.} | 'parallel' -k -I :: echo {.} ::'
seq 10 | parallel -k 'seq 1 {.} | 'parallel' -j1 -X -k -I :: echo a{.} b::'
seq 10 | parallel -k 'seq 1 {.} | 'parallel' -j1 -m -k -I :: echo a{.} b::'
2016-05-17 00:11:38 +00:00
echo '### Test -i'
2016-05-17 00:11:38 +00:00
(echo a; echo END; echo b) | parallel -k -i -eEND echo repl{.}ce
echo '### Test --replace'
2016-05-17 00:11:38 +00:00
(echo a; echo END; echo b) | parallel -k --replace -eEND echo repl{.}ce
echo '### Test -t'
2016-05-17 00:11:38 +00:00
(echo b; echo c; echo f) | parallel -k -t echo {.}ar 2>&1 >/dev/null
echo '### Test --verbose'
2016-05-17 00:11:38 +00:00
(echo b; echo c; echo f) | parallel -k --verbose echo {.}ar 2>&1 >/dev/null
EOF