[PATCH] D136469: [llvm-lit][test] Fix regex to capture scientific notation

Owen Reynolds via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 10:24:25 PDT 2022


gbreynoo created this revision.
gbreynoo added reviewers: yuanfeng.peng, jdenny, mgorny.
Herald added a subscriber: delcypher.
Herald added a project: All.
gbreynoo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We were seeing an intermittent local test failure of `utils\lit\tests\test-output.py` in which the elapsed time output was being given in scientific notation. Python automatically represents small floating-point values in scientific notation so I have altered these tests regex to capture output in that format.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136469

Files:
  llvm/utils/lit/tests/test-output-micro.py
  llvm/utils/lit/tests/test-output.py


Index: llvm/utils/lit/tests/test-output.py
===================================================================
--- llvm/utils/lit/tests/test-output.py
+++ llvm/utils/lit/tests/test-output.py
@@ -7,7 +7,7 @@
 # CHECK-NEXT: "tests": [
 # CHECK-NEXT:   {
 # CHECK-NEXT:     "code": "PASS",
-# CHECK-NEXT:     "elapsed": {{[0-9.]+}},
+# CHECK-NEXT:     "elapsed": {{[+-]?([[:digit:]]+(.[[:digit:]]*)?|.[[:digit:]]+)([eE][+-]?[[:digit:]]+)?}},
 # CHECK-NEXT:     "metrics": {
 # CHECK-NEXT:       "value0": 1,
 # CHECK-NEXT:       "value1": 2.3456
Index: llvm/utils/lit/tests/test-output-micro.py
===================================================================
--- llvm/utils/lit/tests/test-output-micro.py
+++ llvm/utils/lit/tests/test-output-micro.py
@@ -39,7 +39,7 @@
 # CHECK-NEXT:   },
 # CHECK-NEXT:   {
 # CHECK-NEXT:     "code": "PASS",
-# CHECK-NEXT:     "elapsed": {{[0-9.]+}},
+# CHECK-NEXT:     "elapsed": {{[+-]?([[:digit:]]+(.[[:digit:]]*)?|.[[:digit:]]+)([eE][+-]?[[:digit:]]+)?}},
 # CHECK-NEXT:     "metrics": {
 # CHECK-NEXT:       "value0": 1,
 # CHECK-NEXT:       "value1": 2.3456


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136469.469673.patch
Type: text/x-patch
Size: 1100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221021/3037985b/attachment.bin>


More information about the llvm-commits mailing list