Commit Graph

41 Commits

Author SHA1 Message Date
pateldeev
0eb33cfa5c Add missing absl dependency from build. 2023-05-08 13:02:56 -07:00
Derek Mauro
e33c2b24ca Use RE2 for the regex implementation when building with Bazel and using Abseil
bazel build --define=absl=1 ...

A dependency on RE2 is now required when building GoogleTest with Abseil.
Using RE2 will provide a consistent cross-platform regex experience.

Users will need to add the com_googlesource_code_re2, bazel_skylib,
and platforms repository to their WORKSPACE files. See our WORKSPACE
file in the root directory of this project for an example of how to
add the dependencies.

Please note that the com_googlesource_code_re2 dependency must use a
commit from the `abseil` branch of the project:
https://github.com/google/re2/tree/abseil

PiperOrigin-RevId: 444650118
Change-Id: I45c55b26684c0c50d721a05b81c5f8a0c092400f
2022-04-26 13:27:20 -07:00
Derek Mauro
25dcdc7e8b Use the Abseil flags library when Abseil is present
When built with `--define=absl=1` under Bazel, GoogleTest
flags use ABSL_FLAG instead of GoogleTest's own implementation.

There are some minor behavior differences in this mode.

The most notable difference is that unrecognized flags result
in a flag parsing error, and are not returned to the user though
a modified argc/argv, unless they appear after the positional
argument delimiter ("--").

For example, to pass a non-Abseil flag, you would have to do
./mytest --gtest_color=false -- --myflag=myvalue

The documentation at https://abseil.io/docs/cpp/guides/flags
may be helpful in understanding the behavior.

There are some other minor differences. For example,
passing --help results in the program returning 1 instead of 0.

https://github.com/google/googletest/issues/3646

PiperOrigin-RevId: 439312700
Change-Id: Id696a25f50f24a5b1785c45ca8fa59794f86fd5c
2022-04-04 07:39:03 -07:00
Yesudeep Mangalapilly
9e3fb4ea94 Fix linker errors on FreeBSD. 2021-10-08 08:55:39 -07:00
Vertexwahn
277e0a0168 Remove bazelbuild/rules_cc dependency 2021-09-17 10:04:26 +02:00
Manuel Binna
f0ff512b75 Link -lregex on QNX
According to the 2nd point on [1], -lregex is required on QNX.

[1] https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.ide.userguide/topic/writing_test_programs.html
2021-07-07 19:14:58 +02:00
Manuel Binna
4281d2149c Don't link pthread on QNX
On QNX, pthread is part of libc [1]. There's no separate pthread library
to link.

[1] https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.lib_ref/topic/p/pthread_create.html
2021-06-26 13:26:20 +02:00
Abseil Team
c0777e6565 Googletest export
Remove the dependency on Objective C++ in iOS builds.

252ce9c52d introduced the use of
NSTemporaryDirectory() on iOS, which requires Core Foundation, and
Objective C++.

This CL replaces NSTemporaryDirectory() with an equivalent solution
(according to Apple's documentation at [1]) available to C/C++ code.
Avoiding Objective C++ and Core Foundation makes it easier to integrate
googletest in projects that can't use the supplied Bazel build files.

[1] https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/RaceConditions.html#//apple_ref/doc/uid/TP40002585-SW10

PiperOrigin-RevId: 375474990
2021-05-25 13:34:32 -04:00
Abseil Team
252ce9c52d Googletest export
Fix iOS logging issues in tests

PiperOrigin-RevId: 370484087
2021-04-26 14:07:25 -04:00
Abseil Team
1a8ecf1813 Googletest export
Print std::u8string, std::u16string, and std::u32string as string literals

Previously, these types were printed as "{ U+123, U+456, U+789 }". However,
printed output in that form is difficult to compare against any literals that
might be defined in code. Instead, just treat these types like std::string
and std::wstring, escaping non-ASCII characters with a hexadecimal escape
sequence.

The tests have also been updated to cover the new functionality: as a bonus,
the tests now also pass with the MSVC toolchain.

Internally, the code has been reorganized to primarily operate in terms of
char32_t, under the assumption that char32_t will always be at least as big
as wchar_t. While that assumption is currently true, perhaps it won't be in
the future...

PiperOrigin-RevId: 364033132
2021-03-22 15:18:50 -04:00
Ezekiel Warren
5c08f92c88
Use @platforms instead of @bazel_tools for windows constraint 2021-03-14 18:41:28 -07:00
Rob Earhart
025e1a484d
Export LICENSE
This makes it easier to include the license in redistributions, as required by the license.
2020-08-12 16:10:57 -07:00
Krystian Kuzniarek
843267f0f1 specialize UniversalPrinter<> for std::any (without support for RTTI) 2020-05-29 13:59:42 +02:00
Yannic Bonenberger
6fd262ecf7 Prepare for Bazel incompatible changes
Fixes googletest for upcoming `--incompatible_load_cc_rules_from_bzl` (https://github.com/bazelbuild/bazel/issues/8743) and `--incompatible_load_python_rules_from_bzl` (https://github.com/bazelbuild/bazel/issues/9006).

This change was automatically generated with `buildifier -lint=fix -warnings=all $(find . -name "BUILD" -o -name "BUILD.bazel" -o -name "*.bzl")`.
2019-08-07 17:08:10 +02:00
misterg
82f9c8d65d Googletest export
Internal Change

PiperOrigin-RevId: 245788057
2019-04-29 14:32:28 -04:00
Pavel Samolysov
91bfc08228 Enable CI on Windows (appveyor) with Bazel
Signed-off-by: Pavel Samolysov <samolisov@gmail.com>
2019-01-22 12:28:09 +03:00
Pavel Samolysov
c868da1988 Enable building as a shared library (dll) on Windows with Bazel
While the google test library is being built as a shared library using Bazel,
so that there is a rule like

cc_test(
     name = "iterator_traits_test",
     linkstatic = 0,
     deps = ["@gtest//:gtest_main"],
     ...
)

in a BUILD file, the following error appears on Windows:

INFO: Found 1 test target...
ERROR: C:/../external/gtest/BUILD.bazel:55:1: output 'external/gtest/gtest.if.lib' was not created
ERROR: C:/../external/gtest/BUILD.bazel:55:1: not all outputs were created or valid
Target //test:iterator_traits_test failed to build

The reason is a missing "win_def_file" attribute of the "gtest" and
"gtest_main" rules in the BUILD.bazel inside the google test library
package.

The "windows_export_all_symbols" feature is added to the rules, this
feature forces Bazel to export all symbols from the google test library
to linker. I believe exporting all symbols from a testing library makes
no problem for the application from a point of view on encapsulation.

Signed-off-by: Pavel Samolysov <samolisov@gmail.com>
2019-01-14 16:20:56 +03:00
misterg
3fd66989bb Googletest export
Fix bazel issue

PiperOrigin-RevId: 223829127
2018-12-03 14:22:48 -05:00
misterg
ba344cbc40 Googletest export
Fix bazel issue

PiperOrigin-RevId: 223823930
2018-12-03 13:58:20 -05:00
krzysio
105579a6e4 Googletest export
Improve Bazel build files.

New target gtest_prod allows access to the FRIEND_TEST macro without depending on the entirety of GTest in production executables. Additionally, duplicate config_setting rules were removed and formatting was adjusted.

PiperOrigin-RevId: 220279205
2018-11-07 14:37:18 -05:00
misterg
a7b21c950d Googletest export
Internal Change

PiperOrigin-RevId: 215236414
2018-10-01 14:31:07 -04:00
durandal
be429c8924 Googletest export
Add myself to the authors table.

PiperOrigin-RevId: 214822035
2018-10-01 14:30:53 -04:00
Derek Mauro
82670da613 Merge branch 'master' into stacktrace 2018-07-12 16:51:04 -04:00
Derek Mauro
6c7878a151 Adds the UniversalPrinter for absl::variant. 2018-07-12 13:46:50 -04:00
Derek Mauro
4c41787764 Adds stacktrace support from Abseil to Google Test
This change adds the ability to generate stacktraces in Google Test on
both failures of assertions/expectations and on crashes. The
stacktrace support is conditionally available only when using Abseil
with Google Test.

To use this support, run the test under Bazel with a command like this:

bazel test --define absl=1 --test_env=GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1 //path/to/your:test

The "--define absl=1" part enables stacktraces on assertion/expectation
failures.

The "--test_env=GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1" part enables
the signal handler that logs a stacktrace in the event of a crash
(this also requires the "--define absl=1" part). This is not the
default since it may interfere with existing tests.
2018-07-10 14:30:42 -04:00
Gennadiy Civil
e6ec8bc52f Merges and also adding new bazel build mode 2018-01-31 12:05:18 -05:00
Gennadiy Civil
2a4683021a Ability to optionally depend on Abseil plus upstream of 183716547 2018-01-30 11:42:03 -05:00
Loo Rong Jie
cbd15d417e [Bazel] Detect Windows with cpu value x64_windows and x64_windows_msvc
and x64_windows_msvc
2018-01-09 08:29:44 +08:00
Zhongming Qu
99d0ef39a6 Also can build when included in source. 2017-08-18 04:00:02 -07:00
Zhongming Qu
9538687a89 Remove trailing whitespaces in BUILD.bazel 2017-08-18 03:59:53 -07:00
misterg
c3f65335b7 Addressing comments 2017-08-10 15:33:09 -04:00
misterg
cb5b05436d Added Copyright 2017-08-10 12:03:27 -04:00
misterg
b98e30b427 Initial Revision, review 164634031 2017-08-10 11:54:46 -04:00
misterg
66a036959f WIP 2017-08-09 14:37:58 -04:00
misterg
ac885f3ab2 WIP 2017-08-09 11:47:54 -04:00
misterg
e66b6bc868 WIP, win testing 2017-08-08 15:41:44 -04:00
misterg
8815087cfa WIP 2017-08-08 15:17:56 -04:00
misterg
aa31cb67c2 WIP 2017-08-02 15:40:14 -04:00
misterg
6615f7df11 WIP 2017-08-02 14:36:39 -04:00
misterg
b3edada290 WIP 2017-08-01 14:50:59 -04:00
misterg
f63e2a14a2 WIP 2017-08-01 14:36:29 -04:00