aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/native
Commit message (Collapse)AuthorAge
* 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
* Fix //src/test/native:windows_jni_test on WindowsGravatar Yun Peng2017-03-09
| | | | | | | | -- Change-Id: I35f2ce0e8c50f4167c783d5e4b9f60417e2b0aa1 Reviewed-on: https://cr.bazel.build/9312 PiperOrigin-RevId: 149647513 MOS_MIGRATED_REVID=149647513
* 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, 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: refactoringsGravatar Laszlo Csomor2017-01-19
| | | | | | | | | | | | | | | | | | | In this change: - rename //src/main/native:windows_jni_utils to //src/main/native:windows_jni_lib and make it visible to //src/main/cpp:__subpackages__ because we will use some methods there from this library - move AutoHandle into windows_util.h, we'll use it from blaze_util_windows.cc / file_windows.cc later See https://github.com/bazelbuild/bazel/issues/2107 -- PiperOrigin-RevId: 144946842 MOS_MIGRATED_REVID=144946842
* Tests: empty windows_util_test on other platformsGravatar Laszlo Csomor2017-01-18
| | | | | | | | | | | | //src/test/native:windows_util_test now has a dummy source file on platforms other than Windows. This allows continuous integration to run all tests in this package on any platform. -- PiperOrigin-RevId: 144834522 MOS_MIGRATED_REVID=144834522
* Windows, JNI: add tests for windows_utilGravatar Laszlo Csomor2017-01-18
Add tests for the AsExecutablePathForCreateProcess method, since its logic is pretty complex. Unfortunately testing it also requires complex logic, as we need to test what exactly happens when the input path is shorter than MAX_PATH or when it's longer than it. To test that reliably, we need a base path that we know will not get shortened. Creating that base path under the temp directory is a nightmare, we need to: (1) retrieve the temp dir, shorten it so we know that it won't be shortened further (2) keep creating subdirectories that have a short name so they also won't get shortened, but keep the entire path below MAX_PATH while leaving enough space for a file name in the end (3) append a file name such that the path is just below MAX_PATH, or is exactly that long, or is longer than it. Because of steps (1) and (2) we can be sure that no other component in the path will get shortened, so we can test exactly what's going on with the shortener logic and its error handling. But oh boy is it complicated. Side note, we need to use the Widechar WinAPI functions to create/delete the directories and files, because the POSIX API on Windows appears to be backed by the ASCII API functions, so attempting to `mkdir` with a path longer than CreateDirectoryA's limit is going to fail. But on the positive side, adding tests caught two bugs in the method, so we have that going for us which is nice. See https://github.com/bazelbuild/bazel/issues/2107 See https://github.com/bazelbuild/bazel/issues/2181 -- PiperOrigin-RevId: 144823029 MOS_MIGRATED_REVID=144823029