This is an archive of the discontinued LLVM Phabricator instance.

[llvm-lit][test] Fix regex to capture scientific notation
ClosedPublic

Authored by gbreynoo on Oct 21 2022, 10:24 AM.

Details

Summary

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.

Diff Detail

Event Timeline

gbreynoo created this revision.Oct 21 2022, 10:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2022, 10:24 AM
Herald added a subscriber: delcypher. · View Herald Transcript
gbreynoo requested review of this revision.Oct 21 2022, 10:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2022, 10:24 AM

Intermittent error below:

[09:50:05] :	 [Step 3/3] next:10'0                     X error: no match found
[09:50:05] :	 [Step 3/3]           11:  "elapsed": 7.295608520507812e-05,
jdenny added inline comments.Oct 21 2022, 12:15 PM
llvm/utils/lit/tests/test-output-micro.py
42

If the goal is to be strict, then . needs to be escaped to make it literal.

However, is it important to be so strict here? What about something simple like {{[-+0-9.eE]+}}?

gbreynoo updated this revision to Diff 470148.Oct 24 2022, 7:38 AM

Updated after jdenny's suggested regex change.

gbreynoo added inline comments.Oct 24 2022, 7:44 AM
llvm/utils/lit/tests/test-output-micro.py
42

Thanks @jdenny, that's much better.

jdenny accepted this revision.Oct 24 2022, 9:55 AM

LGTM. Thanks for the fix.

If there's a publicly viewable build log showing the original error, it would be nice to link to that from the review.

This revision is now accepted and ready to land.Oct 24 2022, 9:55 AM
yuanfeng.peng accepted this revision.Oct 24 2022, 10:55 AM
This revision was landed with ongoing or failed builds.Oct 25 2022, 8:05 AM
This revision was automatically updated to reflect the committed changes.

Apologies @jdenny, the failure was occurring on a private build job and has no public access. The test failure can be found below:

08:56:44   ******************** TEST 'lit :: test-output.py' FAILED ********************
08:56:44   Script:
08:56:44   --
08:56:44   : 'RUN: at line 1';   env -u FILECHECK_OPTS "C:\Program Files\Python310\python.exe" D:\BuildAgent\work\e280ceab0c58d514\llvm\utils\lit\lit.py -j1 --order=lexical -v Inputs/test-data --output D:\BuildAgent\work\e280ceab0c58d514\build\utils\lit\tests\Output\test-output.py.tmp.results.out > D:\BuildAgent\work\e280ceab0c58d514\build\utils\lit\tests\Output\test-output.py.tmp.out
08:56:44   : 'RUN: at line 2';   FileCheck < D:\BuildAgent\work\e280ceab0c58d514\build\utils\lit\tests\Output\test-output.py.tmp.results.out D:\BuildAgent\work\e280ceab0c58d514\build\utils\lit\tests\test-output.py
08:56:44   --
08:56:44   Exit Code: 1
08:56:44   
08:56:44   Command Output (stdout):
08:56:44   --
08:56:44   $ ":" "RUN: at line 1"
08:56:44   $ "env" "-u" "FILECHECK_OPTS" "C:\Program Files\Python310\python.exe" "D:\BuildAgent\work\e280ceab0c58d514\llvm\utils\lit\lit.py" "-j1" "--order=lexical" "-v" "Inputs/test-data" "--output" "D:\BuildAgent\work\e280ceab0c58d514\build\utils\lit\tests\Output\test-output.py.tmp.results.out"
08:56:44   $ ":" "RUN: at line 2"
08:56:44   $ "FileCheck" "D:\BuildAgent\work\e280ceab0c58d514\build\utils\lit\tests\test-output.py"
08:56:44   # command stderr:
08:56:44   D:\BuildAgent\work\e280ceab0c58d514\build\utils\lit\tests\test-output.py:10:15: error: CHECK-NEXT: expected string not found in input
08:56:44   # CHECK-NEXT: "elapsed": {{[0-9.]+}},
08:56:44                 ^
08:56:44   <stdin>:10:17: note: scanning from here
08:56:44    "code": "PASS",
08:56:44                   ^
08:56:44   <stdin>:11:2: note: possible intended match here
08:56:44    "elapsed": 7.510185241699219e-05,
08:56:44    ^
08:56:44   
08:56:44   Input file: <stdin>
08:56:44   Check file: D:\BuildAgent\work\e280ceab0c58d514\build\utils\lit\tests\test-output.py
08:56:44   
08:56:44   -dump-input=help explains the following input dump.
08:56:44   
08:56:44   Input was:
08:56:44   <<<<<<
08:56:44              .
08:56:44              .
08:56:44              .
08:56:44              5:  0
08:56:44              6:  ],
08:56:44              7:  "elapsed": 0.46836328506469727,
08:56:44              8:  "tests": [
08:56:44              9:  {
08:56:44             10:  "code": "PASS",
08:56:44   next:10'0                     X error: no match found
08:56:44             11:  "elapsed": 7.510185241699219e-05,
08:56:44   next:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
08:56:44   next:10'1      ?                                  possible intended match
08:56:44             12:  "metrics": {
08:56:44   next:10'0     ~~~~~~~~~~~~~~
08:56:44             13:  "value0": 1,
08:56:44   next:10'0     ~~~~~~~~~~~~~~
08:56:44             14:  "value1": 2.3456
08:56:44   next:10'0     ~~~~~~~~~~~~~~~~~~
08:56:44             15:  },
08:56:44   next:10'0     ~~~~
08:56:44             16:  "name": "test-data :: metrics.ini",
08:56:44   next:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
08:56:44              .
08:56:44              .
08:56:44              .
08:56:44   >>>>>>
08:56:44   
08:56:44   error: command failed with exit status: 1