build2-packaging / glfw

build2 package for glfw
0 stars 1 forks source link

Remove regex check in monitors.testscript #6

Closed Swat-SomeBug closed 2 years ago

Swat-SomeBug commented 2 years ago

Fixes #5

Swat-SomeBug commented 2 years ago

I don't see any issues if what you want is to ignore the output. But you could have also made the regex match either empty or the expected output, by wrapping your original regex into something like this (I think, haven't tested):

%(
...
%)?

This way you would at least know the test doesn't print gibberish.

I tested out the wrapping but no matter what I did, the regex always failed. In the end I tested with:

%(
%.*%
%)*?

The error returned was the stdout was empty. Is the above regex expected to work on empty stdout?

I'm currently using the following version

build2 0.15.0-a.0.2f29c7fbe758
libbutl 0.15.0-a.0.0ae2c768fc8b
Swat-SomeBug commented 2 years ago

Merged and package revision is released v3.3.6+1.

boris-kolpackov commented 2 years ago
%(
...
%)?

I tested out the wrapping but no matter what I did, the regex always failed.

Ok, I finally got to look into this and it turned out to be a nuance of how the line regex works. The above regex actually contains 4 "line chars" not 3 -- there is an empty line at the end. And such a regex can never match empty output. Needless to say, this is very unintuitive and so we've added a special case to make sure the above regex matches as one would expect. The fix is available in the latest staged toolchain.