summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2022-07-03 11:46:09 -0700
committerJim Meyering <meyering@fb.com>2022-07-03 11:46:09 -0700
commitaa8ca91c0810b1fe62cb4ff76621b352ac7a9e6e (patch)
tree0be05ea2512a18a9341d9bb6a71e150e105fe9ee /tests
parentb47a3fb1554cd7d9d69b9c662e8a91438f30025a (diff)
downloadgrep-aa8ca91c0810b1fe62cb4ff76621b352ac7a9e6e.tar.gz
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
Diffstat (limited to 'tests')
-rwxr-xr-xtests/long-pattern-perf8
1 files 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.