From 29a7113d7ffefe650e5c9503b093ba89f21dfb9d Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sun, 10 Jul 2016 23:00:20 +0200 Subject: [PATCH] testsuite: Faster test of whether --linebuffer matters. --- testsuite/tests-to-run/parallel-local-100s.sh | 54 ++++++------------- testsuite/tests-to-run/parallel-local-30s.sh | 43 +++++++++++++++ testsuite/wanted-results/parallel-local-100s | 49 +++++++---------- testsuite/wanted-results/parallel-local-30s | 4 ++ 4 files changed, 82 insertions(+), 68 deletions(-) diff --git a/testsuite/tests-to-run/parallel-local-100s.sh b/testsuite/tests-to-run/parallel-local-100s.sh index d6cb104d..e8984d0b 100644 --- a/testsuite/tests-to-run/parallel-local-100s.sh +++ b/testsuite/tests-to-run/parallel-local-100s.sh @@ -8,45 +8,23 @@ TMP5G=${TMP5G:-/dev/shm} export TMP5G -cat <<'EOF' | sed -e 's/;$/; /;s/$SERVER1/'$SERVER1'/;s/$SERVER2/'$SERVER2'/' | stdout parallel -vj0 -k --joblog /tmp/jl-`basename $0` -L1 -echo '### Test of --retries on unreachable host' +par_retries_unreachable() { + echo '### Test of --retries on unreachable host' 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 echo Start; seq 1 20000 | perl -pe 's/^/true /'; echo echo end) | + stdout parallel -uj 0 | egrep -v 'processes took|adjusting' +} -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' +par_over_4GB() { + 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 '**' - -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 '**' - -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 +export -f $(compgen -A function | grep par_) +compgen -A function | grep par_ | sort | parallel -vj0 -k --tag --joblog /tmp/jl-`basename $0` '{} 2>&1' diff --git a/testsuite/tests-to-run/parallel-local-30s.sh b/testsuite/tests-to-run/parallel-local-30s.sh index 88123115..747d7142 100644 --- a/testsuite/tests-to-run/parallel-local-30s.sh +++ b/testsuite/tests-to-run/parallel-local-30s.sh @@ -49,6 +49,49 @@ par_memory_leak() { 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_) compgen -A function | grep par_ | sort | parallel -j6 --tag -k '{} 2>&1' diff --git a/testsuite/wanted-results/parallel-local-100s b/testsuite/wanted-results/parallel-local-100s index 9fe1bb28..05bbcede 100644 --- a/testsuite/wanted-results/parallel-local-100s +++ b/testsuite/wanted-results/parallel-local-100s @@ -1,34 +1,23 @@ -echo '### Test of --retries on unreachable host' -### 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' +par_compress_linebuffer 2>&1 bug #41613: --compress --line-buffer no --tagstring 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 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 diff --git a/testsuite/wanted-results/parallel-local-30s b/testsuite/wanted-results/parallel-local-30s index c92e9918..dbf72423 100644 --- a/testsuite/wanted-results/parallel-local-30s +++ b/testsuite/wanted-results/parallel-local-30s @@ -4,6 +4,10 @@ par_bug_48290 4 par_bug_48290 3 par_bug_48290 2 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 Of 10 runs of 1 job at least one should be bigger than a 3000 job run par_memory_leak Good: No memleak detected.