From aa8ca91c0810b1fe62cb4ff76621b352ac7a9e6e Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 3 Jul 2022 11:46:09 -0700 Subject: 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 4557bbf6..25893e97 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. -- cgit v1.2.1