aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/cpp/util/BUILD
Commit message (Collapse)AuthorAge
* Bazel client: add a simple profilerGravatar Laszlo Csomor2018-06-27
| | | | | | | | | | | | | | | | | | | | | | | | Add a simple profiler that can measure function call counts and durations, and report statistics by printing to stderr. Motivation: I recently needed a profiler for PR #5445 and PR #5448, so I'm adding the polished code now. Usage: 1. depend on //src/main/cpp/util:profiler 2. use StopWatch, Task, and ScopedTask objects as shown in profiler.h's class documentation See https://github.com/bazelbuild/bazel/issues/5444 Change-Id: I43f0afd124b486c694f451e8455a66ffca8137b6 Closes #5461. Change-Id: I43f0afd124b486c694f451e8455a66ffca8137b6 PiperOrigin-RevId: 202314319
* Add a utility function to accept windows-style envvars in paths.Gravatar ccalvarin2018-06-19
| | | | | | | | | | | For paths passed to Bazel on the command line, the shell expands these variables, but for hardcoded defaults, we must make the library call ourselves. We do not add similar support in Posix systems, where it is less common to rely on standard path-related variables. Prerequisit for issue #4502. RELNOTES: None. PiperOrigin-RevId: 201183214
* Move path-manipulation functions to own library file.Gravatar ccalvarin2018-06-05
| | | | | | | | | | | Leave functions that make file accesses in the file library, and general blaze utilities in the blaze_util file, but move the functions that boil down to string manipulation and path formatting to their own file. (With the exception of getCWD, since absolute path syntax is relevant here.) Doing this largely to consolidate all Windows path control into a single place, so that it's easier to notice inconsistencies. For instance, ConvertPath currently makes Windows paths absolute, but not Posix paths, and MakeAbsolute relies on this behavior. In addition, JoinPath assumes Posix path syntax, which leads to some odd looking paths. These will be fixed in a followup change. (Found these issues while working on #4502, trying to fix the windows-specific system bazelrc.) RELNOTES: None. PiperOrigin-RevId: 199368226
* Create BAZEL_DIE macro.Gravatar ccalvarin2018-04-03
| | | | | | | Will migrate die() instances in a later change, to keep this one clean. RELNOTES: None. PiperOrigin-RevId: 191491701
* Remove final third_party/gtest reference.Gravatar ccalvarin2018-03-26
| | | | | | | Missed this in https://github.com/bazelbuild/bazel/commit/8e9f4a8591d65c7972aea3957c57601570e0a39b. RELNOTES: None. PiperOrigin-RevId: 190506543
* Add dependency on googletest, so we can use gmock along with gtest.Gravatar ccalvarin2018-03-23
| | | | | | | third_party/gtest can go away after this. RELNOTES: None. PiperOrigin-RevId: 190221581
* Clean up Windows config_settingsGravatar Yun Peng2018-01-12
| | | | | | | | | | | | | | 1.Deleted config_setting for --cpu=x64_windows_msys, because we don't build Bazel with MSYS gcc anymore. 2.Deleted config_setting for --cpu=x64_windows_msvc, because it uses exactly the same toolchain as --cpu=x64_windows, it'll be removed in the future. This change reduces the complexity of our BUILD files and make them less confusing. Change-Id: I939831a6861413b0f745fb1be98aacd4fb780e0a PiperOrigin-RevId: 181751853
* Move bazel conditions into src/conditions.Gravatar tomlu2017-11-30
| | | | | | | This will enable an easier transition from checked-in BUILD files to ones generated by copybara. RELNOTES: None PiperOrigin-RevId: 177514519
* CI,windows: create test_suites for Windows testsGravatar L?szl? Csomor2017-09-19
| | | | | | | | | | | | | | | Add recursive test_suite rules for all tests that ci.bazel.io runs for Windows, and set the top-level test_suite as the CI test target. Doing so shortens the command line and works around https://github.com/bazelbuild/bazel/issues/3742 I verified that the old set of tests are the same as the new set. Change-Id: Id8d5da3f0c03c9b8969a9f8e1e9a3096888365aa PiperOrigin-RevId: 169242858
* Windows: clean up error reportingGravatar Laszlo Csomor2017-07-20
| | | | | | | | | | | | | | | | | | | In this commit: - remove blaze::PrintError in favor of blaze_util::PrintError - remove Ijar's PrintLastErrorMessage in favor of blaze_util::PrintError - use pdie every time path conversion fails, because that indicates a fatal error (bad user input for a path flag, or downright bug) - remove explicitly printing GetLastErrror; pdie and PrintError do it already - unify the pdie/PrintError message formats Fixes https://github.com/bazelbuild/bazel/issues/2935 Change-Id: I5feaf73885cab95c43a28c529ada6942e037b162 PiperOrigin-RevId: 162587490
* Windows, JNI: move around sourcesGravatar Laszlo Csomor2017-06-29
| | | | | | | | | | | | | | | | Move the Windows JNI C++ sources to a separate package and separate namespace. This no-op refactoring allows other build rules than Bazel's client library to depend on file I/O and/or JNI functionality. A follow-up commit will split the //src/main/native/windows:processes library into :jni-processes and :jni-file. Change-Id: I33c5f8ebd8961cc440db3b4a95ff78024d7c1d74 PiperOrigin-RevId: 160404298
* Make Bazel build with MSVC-default-toolchain Bazel Gravatar Yun Peng2017-03-08
| | | | | | | | | | | | | After this change, a msys bazel can be built with a MSVC-default Bazel by adding --cpu=x64_windows_msys --host=x64_windows_msys See https://github.com/bazelbuild/bazel/issues/2627 -- Change-Id: Iaa82bf4dd911c5740b98d3b2739dfccca6203f79 Reviewed-on: https://cr.bazel.build/9293 PiperOrigin-RevId: 149532274 MOS_MIGRATED_REVID=149532274
* Bazel client: refactors, small bugfixes Gravatar Laszlo Csomor2017-02-15
| | | | | | | | | | | | | | | | | | | In this change: * Fix pdie and PrintError to acquire the last error string as the first thing the method does, otherwise we may display an error coming from pdie's/PrintError's own logic * Auto-close file handles in file_test in order to avoid leaking them in case an assertion fails (which means an early return from the function) -- Change-Id: Ia4392b42cbc93b931dcee76993db0ad264d0c147 Reviewed-on: https://cr.bazel.build/8932 PiperOrigin-RevId: 147610527 MOS_MIGRATED_REVID=147610527
* Bazel client, Windows, tests: use CreateJuction Gravatar Laszlo Csomor2017-02-15
| | | | | | | | | | | | | Use the JNI library's CreateJuction in file_windows_test. See https://github.com/bazelbuild/bazel/issues/2107 -- Change-Id: I4ef1536d43691fe7a2ae3ee457064d4e8f4ac6d7 Reviewed-on: https://cr.bazel.build/8895 PiperOrigin-RevId: 147594365 MOS_MIGRATED_REVID=147594365
* Bazel client, JNI, Windows: impl. CreateJunction Gravatar Laszlo Csomor2017-02-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | Implement a CreateJunction function in the Windows JNI library. Also move a bit of code from file_windows to the JNI library, where it is (also) needed. This implementation is an improved version of `blaze_util::SymlinkDirectories` in blaze_util_windows: this version handles Windows paths as `name` and `target`, and performs more validation (e.g. on the length of `target`), plus has more comments explaining the logic. In a subsequent change I'll start using this new function in blaze_util_windows. This method will also be helpful in tests: we will no longer have to shell out to mklink. See https://github.com/bazelbuild/bazel/issues/2107 -- Change-Id: I7e9b085fdc2ba47be83da5319bded02bd323e71b Reviewed-on: https://cr.bazel.build/8892 PiperOrigin-RevId: 147585207 MOS_MIGRATED_REVID=147585207
* Windows JNI, refactor: move OpenDirectory to JNIGravatar Laszlo Csomor2017-02-14
| | | | | | | | | | | | Move the OpenDirectory helper method into the JNI library. We'll need it there; a subsequent change will make use of it there. See https://github.com/bazelbuild/bazel/issues/2107 -- PiperOrigin-RevId: 147448792 MOS_MIGRATED_REVID=147448792
* Bazel client, Windows, tests: `rm -rf TEST_TMPDIR`Gravatar Laszlo Csomor2017-02-10
| | | | | | | | | | | | Add test helpers to recursively delete the TEST_TMPDIR in the TearDown method of tests, to ensure each test sees a fresh temp directory. Also add tests for these test helpers. -- PiperOrigin-RevId: 147135561 MOS_MIGRATED_REVID=147135561
* Fix //src/test/cpp/util:logging_test on Windows Gravatar László Csomor2017-01-30
| | | | | | | | | | | | | | | Set $TMP to $TEST_TMPDIR, so that the CaptureStderr can safely call SetTempPathA and not get C:\Windows\ back as a result, which is unfortunately read-only. See https://github.com/bazelbuild/bazel/issues/2107 -- Change-Id: If63cb028f677d9a0d9597f83afc9e08f2e5d2529 Reviewed-on: https://cr.bazel.build/8494 PiperOrigin-RevId: 145961529 MOS_MIGRATED_REVID=145961529
* Bazel client: SplitPath works with Windows pathsGravatar Laszlo Csomor2016-12-19
| | | | | | | | | | | This allows correct behavior of Dirname and Basename on Windows. See https://github.com/bazelbuild/bazel/issues/2107 -- PiperOrigin-RevId: 142441234 MOS_MIGRATED_REVID=142441234
* Bazel client, Windows: implement pipe handlingGravatar Laszlo Csomor2016-12-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create WindowsPipe which implements IPipe, and is a Windows-native implementation of pipe handling. It wraps the ::CreatePipe, ::WriteFile, and ::ReadFile API functions. Start using WindowsPipe on MSYS. Also move everything from file_test.cc into file_posix_test.cc, because these test methods heavily depend on POSIX and they test file_posix's functionality anyway. Also add tests for pipes: this will use the platform-specific implementation of IPipe. file_test.cc is now platform-independent, and we can test it with --cpu=x64_windows_msvc (and it passes!). See https://github.com/bazelbuild/bazel/issues/2107 Might also fix: https://github.com/bazelbuild/bazel/issues/2182 https://github.com/bazelbuild/bazel/issues/2248 -- PiperOrigin-RevId: 142240377 MOS_MIGRATED_REVID=142240377
* Adds logging functionality to the bazel client, which will be activated in a ↵Gravatar Chloe Calvarin2016-11-23
| | | | | | | later change. -- MOS_MIGRATED_REVID=139951184
* Bazel client: implement directory tree walkingGravatar Laszlo Csomor2016-11-16
| | | | | | | | | | | | | | | | | | | | | | This change: - merges the //src/{main,test}/cpp:file and //src/{main,test}/cpp:file_platform libraries because "file" and "file_platform" need each other and this makes logical sense anyway - implements a function in file_<platform> to run a custom function on every child of a directory - implements a function in file.cc to recursively traverse a directory tree, based on the previosly mentioned function - removes the corresponding logic from the Bazel client to make it more portable -- MOS_MIGRATED_REVID=139309562
* Really mark //src/main/cpp/util:file_platform_test as manualGravatar Klaus Aehlig2016-11-11
| | | | | | | | | | ...as opposed to //src/test/cpp:blaze_util_test which works fine. -- Change-Id: I1e629e6f8eda47cd7eac11511d54ee23f7122848 Reviewed-on: https://bazel-review.googlesource.com/#/c/7335 MOS_MIGRATED_REVID=138871238
* Bazel client: wrap some POSIX functionsGravatar Laszlo Csomor2016-11-10
| | | | | | | | | | | | | | This change: - starts using blaze_util::CanAccess and blaze_util::PathExists instead of access(2) - implements and starts using blaze_util::GetCwd instead of getcwd(2) - implements and starts using blaze_util::ChangeDirectory instead of chdir(2) - adds tests for the new wrapper methods -- MOS_MIGRATED_REVID=138750297
* Add all the sources to //:srcs filegroup and add a check to detectGravatar Damien Martin-Guillerez2016-07-01
| | | | | | | | | | | missing file to it. We need to activate this check on presubmits -- Change-Id: Ia95e92d3816ce92bb69bc0e2cf56e9c60b68d970 Reviewed-on: https://bazel-review.googlesource.com/#/c/3949/ MOS_MIGRATED_REVID=126404792
* Make the integration tests pass with gRPC client/server comms.Gravatar Lukacs Berki2016-04-21
| | | | | | | | | | | In particular: - Make a SIGINT to the server interrupt every command - Parse negative numbers on the command line correctly (std::stoi throws an exception, and I'd rather not start using C++ exceptions) - Use "bytes" for command line arguments instead of "string" in the client/server proto . This is more principled, although we pretend all arguments are strings all over the place and it works for "blaze run" mostly by accident. -- MOS_MIGRATED_REVID=120434432
* Set sharding and tmpdir environment variables for googletestGravatar Brian Silverman2015-10-22
| | | | | | | | | | The patch for googletest to prefer GTEST_TMP_DIR is google/googletest#619 and should be merged soon. -- Change-Id: If48220e8e1e4e78a8768aeb14b5b58e4f246c8c3 Reviewed-on: https://bazel-review.googlesource.com/#/c/2170/ MOS_MIGRATED_REVID=106043714
* Some minor updates to the BUILD files.Gravatar Ulf Adams2015-09-15
| | | | | -- MOS_MIGRATED_REVID=103087492
* Externalize file_test and strings_test, and fix up the BUILD files.Gravatar Ulf Adams2015-08-10
-- MOS_MIGRATED_REVID=100109450