grep-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep-3.7.98-c9ac on Solaris 11 OmniOS


From: Jim Meyering
Subject: Re: grep-3.7.98-c9ac on Solaris 11 OmniOS
Date: Sun, 3 Jul 2022 11:50:07 -0700

On Sun, Jul 3, 2022 at 6:10 AM Bruno Haible <bruno@clisp.org> wrote:
>
> On Solaris 11 OmniOS, in 64-bit mode, all tests pass, except one:
>
>
> FAIL: long-pattern-perf
> =======================
>
> ++ initial_cwd_=/home/bruno/grep-3.7.98-c9ac/build-64/tests
> +++ testdir_prefix_
> +++ printf gt
> ++ pfx_=gt
> +++ mktempd_ /home/bruno/grep-3.7.98-c9ac/build-64/tests 
> gt-long-pattern-perf.XXXX
> +++ case $# in
> +++ destdir_=/home/bruno/grep-3.7.98-c9ac/build-64/tests
> +++ template_=gt-long-pattern-perf.XXXX
> +++ MAX_TRIES_=4
> +++ case $destdir_ in
> +++ destdir_slash_=/home/bruno/grep-3.7.98-c9ac/build-64/tests/
> +++ case $template_ in
> ++++ unset TMPDIR
> +++ d=/home/bruno/grep-3.7.98-c9ac/build-64/tests/gt-long-pattern-perf.a4Lv
> +++ case $d in
> +++ :
> +++ test -d 
> /home/bruno/grep-3.7.98-c9ac/build-64/tests/gt-long-pattern-perf.a4Lv
> ++++ ls -dgo 
> /home/bruno/grep-3.7.98-c9ac/build-64/tests/gt-long-pattern-perf.a4Lv
> +++ perms='drwx------   2       2 Jul  3 14:57 
> /home/bruno/grep-3.7.98-c9ac/build-64/tests/gt-long-pattern-perf.a4Lv'
> +++ case $perms in
> +++ :
> +++ echo /home/bruno/grep-3.7.98-c9ac/build-64/tests/gt-long-pattern-perf.a4Lv
> +++ return
> ++ 
> test_dir_=/home/bruno/grep-3.7.98-c9ac/build-64/tests/gt-long-pattern-perf.a4Lv
> ++ cd /home/bruno/grep-3.7.98-c9ac/build-64/tests/gt-long-pattern-perf.a4Lv
> ++ case $srcdir in
> ++ srcdir=../../../tests
> ++ builddir=..
> ++ export srcdir builddir
> ++ gl_init_sh_nl_='
> '
> ++ IFS='
> '
> ++ for sig_ in 1 2 3 13 15
> +++ expr 1 + 128
> ++ eval 'trap '\''Exit 129'\'' 1'
> +++ trap 'Exit 129' 1
> ++ for sig_ in 1 2 3 13 15
> +++ expr 2 + 128
> ++ eval 'trap '\''Exit 130'\'' 2'
> +++ trap 'Exit 130' 2
> ++ for sig_ in 1 2 3 13 15
> +++ expr 3 + 128
> ++ eval 'trap '\''Exit 131'\'' 3'
> +++ trap 'Exit 131' 3
> ++ for sig_ in 1 2 3 13 15
> +++ expr 13 + 128
> ++ eval 'trap '\''Exit 141'\'' 13'
> +++ trap 'Exit 141' 13
> ++ for sig_ in 1 2 3 13 15
> +++ expr 15 + 128
> ++ eval 'trap '\''Exit 143'\'' 15'
> +++ trap 'Exit 143' 15
> ++ saved_IFS='
> '
> ++ IFS=:
> ++ new_PATH=
> ++ sep_=
> ++ for dir in $PATH
> ++ case "$dir" in
> ++ test -d /home/bruno/grep-3.7.98-c9ac/build-64/src/.
> ++ new_PATH=/home/bruno/grep-3.7.98-c9ac/build-64/src
> ++ sep_=:
> ++ for dir in $PATH
> ++ case "$dir" in
> ++ for dir in $PATH
> ++ case "$dir" in
> ++ for dir in $PATH
> ++ case "$dir" in
> ++ test -d /usr/bin/.
> ++ new_PATH=/home/bruno/grep-3.7.98-c9ac/build-64/src:/usr/bin
> ++ sep_=:
> ++ for dir in $PATH
> ++ case "$dir" in
> ++ test -d /usr/sbin/.
> ++ new_PATH=/home/bruno/grep-3.7.98-c9ac/build-64/src:/usr/bin:/usr/sbin
> ++ sep_=:
> ++ for dir in $PATH
> ++ case "$dir" in
> ++ test -d /sbin/.
> ++ new_PATH=/home/bruno/grep-3.7.98-c9ac/build-64/src:/usr/bin:/usr/sbin:/sbin
> ++ sep_=:
> ++ for dir in $PATH
> ++ case "$dir" in
> ++ test -d /opt/ooce/bin/.
> ++ 
> new_PATH=/home/bruno/grep-3.7.98-c9ac/build-64/src:/usr/bin:/usr/sbin:/sbin:/opt/ooce/bin
> ++ sep_=:
> ++ for dir in $PATH
> ++ case "$dir" in
> ++ test -d /usr/gnu/bin/.
> ++ 
> new_PATH=/home/bruno/grep-3.7.98-c9ac/build-64/src:/usr/bin:/usr/sbin:/sbin:/opt/ooce/bin:/usr/gnu/bin
> ++ sep_=:
> ++ IFS='
> '
> ++ 
> PATH=/home/bruno/grep-3.7.98-c9ac/build-64/src:/usr/bin:/usr/sbin:/sbin:/opt/ooce/bin:/usr/gnu/bin
> ++ export PATH
> ++ trap remove_tmp_ 0
> + path_prepend_ ../src
> + test 1 '!=' 0
> + path_dir_=../src
> + case $path_dir_ in
> + abs_path_dir_=/home/bruno/grep-3.7.98-c9ac/build-64/tests/../src
> + case $abs_path_dir_ in
> + 
> PATH=/home/bruno/grep-3.7.98-c9ac/build-64/tests/../src:/home/bruno/grep-3.7.98-c9ac/build-64/src:/usr/bin:/usr/sbin:/sbin:/opt/ooce/bin:/usr/gnu/bin
> + create_exe_shims_ /home/bruno/grep-3.7.98-c9ac/build-64/tests/../src
> + case $EXEEXT in
> + return 0
> + shift
> + test 0 '!=' 0
> + export PATH
> + fail=0
> + expensive_
> + test yes '!=' yes
> + require_perl_
> + test perl
> + perl -e 'use warnings'
> + echo x
> + seq 10000 50000
> + tr -d '\012'
> + LC_ALL=C
> + env -- tr -d '\012'
> + cat r r r r r r r r r r
> + mv r re
> ++ user_time_ 1 grep -f re in
> ++ perl -le '
>     my $expected_exit_status = $ARGV[0];
>     shift @ARGV;
>
>     system (@ARGV);
>     my ($user, $system, $child_user, $child_system) = times;
>
>     my $me = q(long-pattern-perf);
>     $? == -1
>       and die qq($me: failed to exec ") . join (" ", @ARGV) . qq(": $!\n);
>     my $rc = $?;
>     my $sig = ($rc & 127);
>     $sig and die "$me: child died with signal $sig\n";
>     $rc >>= 8;
>     $rc == $expected_exit_status
>       or die "$me: bad exit status: expected $expected_exit_status; got 
> $rc\n";
>
>     # Print milliseconds of child user time.
>     $child_user *= 1000;
>     print int ($child_user + 0.5)' 1 grep -f re in
> + base_ms=155
> ++ user_time_ 1 grep -f re-10x in
> ++ perl -le '
>     my $expected_exit_status = $ARGV[0];
>     shift @ARGV;
>
>     system (@ARGV);
>     my ($user, $system, $child_user, $child_system) = times;
>
>     my $me = q(long-pattern-perf);
>     $? == -1
>       and die qq($me: failed to exec ") . join (" ", @ARGV) . qq(": $!\n);
>     my $rc = $?;
>     my $sig = ($rc & 127);
>     $sig and die "$me: child died with signal $sig\n";
>     $rc >>= 8;
>     $rc == $expected_exit_status
>       or die "$me: bad exit status: expected $expected_exit_status; got 
> $rc\n";
>
>     # Print milliseconds of child user time.
>     $child_user *= 1000;
>     print int ($child_user + 0.5)' 1 grep -f re-10x in
> grep: memory exhausted
> long-pattern-perf: bad exit status: expected 1; got 2
> + b10x_ms=
> + fail=1
> + returns_ 1 expr 155 '<' / 20
> expr: syntax error
> + fail=1
> + Exit 1
> + set +e
> + exit 1
> + exit 1
> + remove_tmp_
> + __st=1
> + cleanup_
> + :
> + test '' = yes
> + cd /home/bruno/grep-3.7.98-c9ac/build-64/tests
> + chmod -R u+rwx 
> /home/bruno/grep-3.7.98-c9ac/build-64/tests/gt-long-pattern-perf.a4Lv
> + rm -rf /home/bruno/grep-3.7.98-c9ac/build-64/tests/gt-long-pattern-perf.a4Lv
> + exit 1
> FAIL long-pattern-perf (exit status: 1)
>
>
> As you can see, the 'grep' program failed with an xmalloc/xrealloc failure,
> leading to exit code 2, and then 'expr' was invoked with invalid arguments.

Thanks for reporting that.
That is a poor failure mode, so I'm going to improve it.

I measured that running the test using the larger (2MB regex) requires
a certain amount of space to avoid malloc failure on a fedora 36 system.
Inserting this line into the test script lets it continue to function,
but decreasing the limit makes it fail:
  ulimit -v 870000

Here's the patch I expect to push soon.
With that, the test will still fail on this system, but at least not
due to a syntax error.
Does this system really have so little virtual memory? (less than about 1GB?)
Or maybe something about it is less efficient, which makes grep
require more than on Fedora 36?

Subject: [PATCH] tests: long-pattern-perf: better handle exhausted virtual
 memory

* tests/long-pattern-perf: Don't fail due to a syntax error
when one of the subtests exhausts virtual memory. The larger
test (with a 2MiB regexp) needs about 870MiB of virtual memory.
Require that each timing run exit with status 0, else fail with
a framework_failure_. Reported by Bruno Haible in
https://lists.gnu.org/r/grep-devel/2022-07/msg00006.html
---
 tests/long-pattern-perf | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/long-pattern-perf b/tests/long-pattern-perf
index 4557bbf..25893e9 100755
--- a/tests/long-pattern-perf
+++ b/tests/long-pattern-perf
@@ -32,8 +32,12 @@ seq 10000 50000 | tr -d '\012' > r || framework_failure_
 cat r r r r r r r r r r > re-10x || framework_failure_
 mv r re || framework_failure_

-base_ms=$(user_time_ 1 grep -f re in    ) || fail=1
-b10x_ms=$(user_time_ 1 grep -f re-10x in) || fail=1
+returns_ 0 user_time_ 1 grep -f re in > base-ms \
+    || framework_failure_ 'failed to compute baseline timing'
+base_ms=$(cat base-ms)
+returns_ 0 user_time_ 1 grep -f re-10x in > b10x-ms \
+    || framework_failure_ 'failed to compute 10x timing'
+b10x_ms=$(cat b10x-ms)

 # Increasing the length of the regular expression by a factor
 # of 10 should cause no more than a 10x increase in duration.
-- 
2.37.0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]