testsuite: Faster test of whether --linebuffer matters.

This commit is contained in:
Ole Tange 2016-07-10 23:00:20 +02:00
parent 1cb786c62e
commit 29a7113d7f
4 changed files with 82 additions and 68 deletions

View file

@ -8,45 +8,23 @@
TMP5G=${TMP5G:-/dev/shm} TMP5G=${TMP5G:-/dev/shm}
export TMP5G export TMP5G
cat <<'EOF' | sed -e 's/;$/; /;s/$SERVER1/'$SERVER1'/;s/$SERVER2/'$SERVER2'/' | stdout parallel -vj0 -k --joblog /tmp/jl-`basename $0` -L1 par_retries_unreachable() {
echo '### Test of --retries on unreachable host' echo '### Test of --retries on unreachable host'
seq 2 | stdout parallel -k --retries 2 -v -S 4.3.2.1,: echo seq 2 | stdout parallel -k --retries 2 -v -S 4.3.2.1,: echo
}
echo '**' par_outside_file_handle_limit() {
echo "### Test Force outside the file handle limit, 2009-02-17 Gave fork error" echo "### Test Force outside the file handle limit, 2009-02-17 Gave fork error"
(echo echo Start; seq 1 20000 | perl -pe 's/^/true /'; echo echo end) | stdout parallel -uj 0 | egrep -v 'processes took|adjusting' (echo echo Start; seq 1 20000 | perl -pe 's/^/true /'; echo echo end) |
stdout parallel -uj 0 | egrep -v 'processes took|adjusting'
echo '**' }
par_over_4GB() {
echo '### Test if we can deal with output > 4 GB' echo '### Test if we can deal with output > 4 GB'
echo | nice parallel --tmpdir $TMP5G -q perl -e '$a="x"x1000000;for(0..4300){print $a}' | nice md5sum echo |
nice parallel --tmpdir $TMP5G -q perl -e '$a="x"x1000000;for(0..4300){print $a}' |
nice md5sum
}
echo '**' export -f $(compgen -A function | grep par_)
compgen -A function | grep par_ | sort | parallel -vj0 -k --tag --joblog /tmp/jl-`basename $0` '{} 2>&1'
echo 'bug #41613: --compress --line-buffer no --tagstring';
diff
<(nice perl -e 'for("x011".."x110"){print "$_\t", ("\n", map { rand } (1..100000)) }'|
nice parallel -N10 -L1 --pipe -j6 --block 20M --compress
pv -qL 1000000 | perl -pe 's/(....).*/$1/')
<(nice perl -e 'for("x011".."x110"){print "$_\t", ("\n", map { rand } (1..100000)) }'|
nice parallel -N10 -L1 --pipe -j6 --block 20M --compress --line-buffer
pv -qL 1000000 | perl -pe 's/(....).*/$1/')
>/dev/null
|| (echo 'Good: --line-buffer matters'; false) && echo 'Bad: --line-buffer not working'
echo 'bug #41613: --compress --line-buffer with --tagstring';
diff
<(nice perl -e 'for("x011".."x110"){print "$_\t", ("\n", map { rand } (1..100000)) }'|
nice parallel -N10 -L1 --pipe -j6 --block 20M --compress --tagstring {#}
pv -qL 1000000 | perl -pe 's/(....).*/$1/')
<(nice perl -e 'for("x011".."x110"){print "$_\t", ("\n", map { rand } (1..100000)) }'|
nice parallel -N10 -L1 --pipe -j6 --block 20M --compress --tagstring {#} --line-buffer
pv -qL 1000000 | perl -pe 's/(....).*/$1/')
>/dev/null
|| (echo 'Good: --line-buffer matters'; false) && echo 'Bad: --line-buffer not working'
echo '**'
EOF

View file

@ -49,6 +49,49 @@ par_memory_leak() {
fi fi
} }
par_linebuffer_matters_compress_tag() {
echo "### (--linebuffer) --compress --tag should give different output"
random_data_with_id_prepended() {
perl -pe 's/^/'$1'/' /dev/urandom |
pv -qL 300000 | head -c 1000000
}
export -f random_data_with_id_prepended
nolb=$(seq 10 |
parallel -j0 --compress --tag random_data_with_id_prepended {#} |
field 1 | uniq)
lb=$(seq 10 |
parallel -j0 --linebuffer --compress --tag random_data_with_id_prepended {#} |
field 1 | uniq)
if [ "$lb" == "$nolb" ] ; then
echo "BAD: --linebuffer makes no difference"
else
echo "OK: --linebuffer makes a difference"
fi
}
par_linebuffer_matters_compress() {
echo "### (--linebuffer) --compress --tag should give different output"
random_data_with_id_prepended() {
perl -pe 's/^/'$1'/' /dev/urandom |
pv -qL 300000 | head -c 1000000
}
export -f random_data_with_id_prepended
nolb=$(seq 10 |
parallel -j0 --compress random_data_with_id_prepended {#} |
field 1 | uniq)
lb=$(seq 10 |
parallel -j0 --linebuffer --compress random_data_with_id_prepended {#} |
field 1 | uniq)
if [ "$lb" == "$nolb" ] ; then
echo "BAD: --linebuffer makes no difference"
else
echo "OK: --linebuffer makes a difference"
fi
}
export -f $(compgen -A function | grep par_) export -f $(compgen -A function | grep par_)
compgen -A function | grep par_ | sort | parallel -j6 --tag -k '{} 2>&1' compgen -A function | grep par_ | sort | parallel -j6 --tag -k '{} 2>&1'

View file

@ -1,34 +1,23 @@
echo '### Test of --retries on unreachable host' par_compress_linebuffer 2>&1
### Test of --retries on unreachable host
seq 2 | stdout parallel -k --retries 2 -v -S 4.3.2.1,: echo
parallel: Warning: Could not figure out number of cpus on 4.3.2.1 (). Using 1.
echo 1
1
echo 2
2
echo '**'
**
echo "### Test Force outside the file handle limit, 2009-02-17 Gave fork error"
### Test Force outside the file handle limit, 2009-02-17 Gave fork error
(echo echo Start; seq 1 20000 | perl -pe 's/^/true /'; echo echo end) | stdout parallel -uj 0 | egrep -v 'processes took|adjusting'
parallel: Warning: Only enough file handles to run 252 jobs in parallel.
parallel: Warning: Running 'parallel -j0 -N 252 --pipe parallel -j0' or
parallel: Warning: raising ulimit -n or /etc/security/limits.conf may help.
Start
end
echo '**'
**
echo '### Test if we can deal with output > 4 GB'
### Test if we can deal with output > 4 GB
echo | nice parallel --tmpdir $TMP5G -q perl -e '$a="x"x1000000;for(0..4300){print $a}' | nice md5sum
46a318993dfc8e2afd71ff2bc6f605f1 -
echo '**'
**
echo 'bug #41613: --compress --line-buffer no --tagstring'; diff <(nice perl -e 'for("x011".."x110"){print "$_\t", ("\n", map { rand } (1..100000)) }'| nice parallel -N10 -L1 --pipe -j6 --block 20M --compress pv -qL 1000000 | perl -pe 's/(....).*/$1/') <(nice perl -e 'for("x011".."x110"){print "$_\t", ("\n", map { rand } (1..100000)) }'| nice parallel -N10 -L1 --pipe -j6 --block 20M --compress --line-buffer pv -qL 1000000 | perl -pe 's/(....).*/$1/') >/dev/null || (echo 'Good: --line-buffer matters'; false) && echo 'Bad: --line-buffer not working'
bug #41613: --compress --line-buffer no --tagstring bug #41613: --compress --line-buffer no --tagstring
Good: --line-buffer matters Good: --line-buffer matters
echo 'bug #41613: --compress --line-buffer with --tagstring'; diff <(nice perl -e 'for("x011".."x110"){print "$_\t", ("\n", map { rand } (1..100000)) }'| nice parallel -N10 -L1 --pipe -j6 --block 20M --compress --tagstring {#} pv -qL 1000000 | perl -pe 's/(....).*/$1/') <(nice perl -e 'for("x011".."x110"){print "$_\t", ("\n", map { rand } (1..100000)) }'| nice parallel -N10 -L1 --pipe -j6 --block 20M --compress --tagstring {#} --line-buffer pv -qL 1000000 | perl -pe 's/(....).*/$1/') >/dev/null || (echo 'Good: --line-buffer matters'; false) && echo 'Bad: --line-buffer not working' par_compress_linebuffer_tagstring 2>&1
bug #41613: --compress --line-buffer with --tagstring bug #41613: --compress --line-buffer with --tagstring
Good: --line-buffer matters Good: --line-buffer matters
echo '**' par_outside_file_handle_limit 2>&1
** par_outside_file_handle_limit ### Test Force outside the file handle limit, 2009-02-17 Gave fork error
par_outside_file_handle_limit parallel: Warning: Only enough file handles to run 252 jobs in parallel.
par_outside_file_handle_limit parallel: Warning: Running 'parallel -j0 -N 252 --pipe parallel -j0' or
par_outside_file_handle_limit parallel: Warning: raising ulimit -n or /etc/security/limits.conf may help.
par_outside_file_handle_limit Start
par_outside_file_handle_limit end
par_over_4GB 2>&1
par_over_4GB ### Test if we can deal with output > 4 GB
par_over_4GB 46a318993dfc8e2afd71ff2bc6f605f1 -
par_retries_unreachable 2>&1
par_retries_unreachable ### Test of --retries on unreachable host
par_retries_unreachable parallel: Warning: Could not figure out number of cpus on 4.3.2.1 (). Using 1.
par_retries_unreachable echo 1
par_retries_unreachable 1
par_retries_unreachable echo 2
par_retries_unreachable 2

View file

@ -4,6 +4,10 @@ par_bug_48290 4
par_bug_48290 3 par_bug_48290 3
par_bug_48290 2 par_bug_48290 2
par_bug_48290 1 par_bug_48290 1
par_linebuffer_matters_compress ### (--linebuffer) --compress --tag should give different output
par_linebuffer_matters_compress OK: --linebuffer makes a difference
par_linebuffer_matters_compress_tag ### (--linebuffer) --compress --tag should give different output
par_linebuffer_matters_compress_tag OK: --linebuffer makes a difference
par_memory_leak ### Test for memory leaks par_memory_leak ### Test for memory leaks
par_memory_leak Of 10 runs of 1 job at least one should be bigger than a 3000 job run par_memory_leak Of 10 runs of 1 job at least one should be bigger than a 3000 job run
par_memory_leak Good: No memleak detected. par_memory_leak Good: No memleak detected.