Bug 248452

Summary: lib.googletest.gtest_main.googletest-port-test.main failed after r363679
Product: Base System Reporter: Li-Wen Hsu <lwhsu>
Component: testsAssignee: Kyle Evans <kevans>
Status: Closed FIXED    
Severity: Affects Only Me CC: kevans
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Li-Wen Hsu freebsd_committer freebsd_triage 2020-08-03 12:49:59 UTC
[ RUN      ] RETest/0.ImplicitConstructorWorks
/usr/src/contrib/googletest/googletest/src/gtest-port.cc:673: Failure
Value of: is_valid_
  Actual: false
Expected: true
Regular expression ".*(\w+)" is not a valid POSIX Extended regular expression.
[  FAILED  ] RETest/0.ImplicitConstructorWorks, where TypeParam = std::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > (0 ms)

[ RUN      ] RETest/1.ImplicitConstructorWorks
/usr/src/contrib/googletest/googletest/src/gtest-port.cc:673: Failure
Value of: is_valid_
  Actual: false
Expected: true
Regular expression ".*(\w+)" is not a valid POSIX Extended regular expression.
[  FAILED  ] RETest/1.ImplicitConstructorWorks, where TypeParam = char const* (0 ms)
Comment 1 commit-hook freebsd_committer freebsd_triage 2020-08-03 12:51:52 UTC
A commit references this bug:

Author: lwhsu
Date: Mon Aug  3 12:51:14 UTC 2020
New revision: 363797
URL: https://svnweb.freebsd.org/changeset/base/363797

Log:
  Disable tests failing after r363679

  PR:		248452
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/contrib/googletest/googletest/test/googletest-port-test.cc
Comment 2 Kyle Evans freebsd_committer freebsd_triage 2020-08-03 12:56:10 UTC
My internal triage session below...

I note that:

Regular expression ".*(\w+)" is not a valid POSIX Extended regular expression.

\w is a GNU regex(3) extension that's short-hand for the POSIX-specified [[:alnum:]].  Prior to r363679, this expression would have been valid but incorrect, as it would match a literal 'w' rather than [[:alnum:]]. This is technically undefined behavior, and r363679 switched things up so that we have two valid interpretations of that UB, either:

1.) Expression fails to compile, extraneous escape, OR
2.) Expression compiles and uses the GNU-extended behavior (libregex)

This is favorable over #1 being 'Expression compiles and matches a literal w'.

I will fix this by soon (tonight, hopefully) introducing \w and \s, at least, and linking gtest against libregex.
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-08-04 02:19:16 UTC
A commit references this bug:

Author: kevans
Date: Tue Aug  4 02:18:25 UTC 2020
New revision: 363820
URL: https://svnweb.freebsd.org/changeset/base/363820

Log:
  gtest: link against libregex for GNU extensions

  gtest tests want to use \w ([[:alnum:]]) at the very least, which was
  causing them to fail after r363679.

  Start linking against libregex so that this shorthand is implemented.

  PR:		248452

Changes:
  head/lib/googletest/gtest/Makefile
  head/share/mk/src.libnames.mk
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-08-04 02:21:17 UTC
A commit references this bug:

Author: kevans
Date: Tue Aug  4 02:20:16 UTC 2020
New revision: 363821
URL: https://svnweb.freebsd.org/changeset/base/363821

Log:
  Re-enable disabled googletest-port-test tests after r363820

  gtest now links against libregex here, and the tests pass locally.

  PR:		248452

Changes:
  head/contrib/googletest/googletest/test/googletest-port-test.cc
Comment 5 Kyle Evans freebsd_committer freebsd_triage 2020-08-04 03:15:51 UTC
Pending additional confirmation from CI that the tests are fine in a build after 363821, after which this can hopefully be closed with a satisfactory resolution.