Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMP: gtest doesn't work without --test_env TMP=/tmp on Windows #1590

Closed
rokstrnisa opened this issue Aug 1, 2016 · 8 comments
Closed

TMP: gtest doesn't work without --test_env TMP=/tmp on Windows #1590

rokstrnisa opened this issue Aug 1, 2016 · 8 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) platform: windows type: bug
Milestone

Comments

@rokstrnisa
Copy link

Running bazel test --cpu='x64_windows_msvc' --verbose_failures with gtest given the following error

...
[ FATAL ] C:\tools\msys64\var\tmp\Bazel\$KNt4ZiP\execroot\everything\external\gtest\src\gtest-port.cc(526):: Condition success != 0 failed. Unable to create a temporary file in C:\Windows\
...

However, adding --test_env TMP=/tmp to the command fixes the problem.

Context: Bazel 0.3.0.

@dslomov
Copy link
Contributor

dslomov commented Aug 2, 2016

There is nothing to investigate, we should figure out how to provide a sensible TMP location to rlues

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Aug 18, 2016

@dslomov: We can implement a native mktemp -d utility using GetTempPath and GetTempFileName. Do you see any problems with that?

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Aug 24, 2016

I also ran into problems lately with handling $TMP. See #1589 (comment)

EDIT: ...meaning the real problem isn't mktemp, it's something deeper about $TMP-handling

@laszlocsomor
Copy link
Contributor

@rokstrnisa : What target were you testing? Can you repro with bazel built at HEAD (say, ff122f3)?

@dslomov dslomov removed this from the 0.4 milestone Sep 21, 2016
@rokstrnisa
Copy link
Author

On ff122f3, it fails due to a different issue, both with or without the --text_env argument.

$ /home/rok/bazel/output/bazel.exe version
Build label: 0.3.1-2016-09-22 (@ff122f3)
$ /home/rok/bazel/output/bazel.exe test --verbose_failures --cpu='x64_windows_msvc' --host_cpu='x64_windows_msvc' --test_env TMP=/tmp cpp/protocgenfabric/...
INFO: Found 2 targets and 1 test target...
ERROR: C:/tools/msys64/var/tmp/Bazel/$KNt4ZiP/external/protobuf/BUILD:29:1: C++ compilation of rule '@protobuf//:protobuf_lite' failed: msvc_cl.bat failed: error executing command
  cd C:/tools/msys64/var/tmp/Bazel/$KNt4ZiP/execroot/everything
  SET PATH=external/local_config_cc/wrapper/bin
  external/local_config_cc/wrapper/bin/msvc_cl.bat -m64 /D__inline__=__inline /DOS_WINDOWS=OS_WINDOWS /DCOMPILER_MSVC /DNOGDI /DNOMINMAX /DPRAGMA_SUPPORTED /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS /D_USE_MATH_DEFINES /nologo /bigobj /Zm500 /J /Gy /GF /W3 /EHsc /wd4351 /wd4291 /wd4250 /wd4996 /DNDEBUG /Od -Xcompilation-mode=fastbuild /Iexternal/protobuf /Ibazel-out/vc_14_0_x64-fastbuild/genfiles/external/protobuf /Iexternal/bazel_tools /Ibazel-out/vc_14_0_x64-fastbuild/genfiles/external/bazel_tools /Iexternal/protobuf/src /Ibazel-out/vc_14_0_x64-fastbuild/genfiles/external/protobuf/src /Iexternal/bazel_tools/tools/cpp/gcc3 /DEPENDENCY_FILE bazel-out/vc_14_0_x64-fastbuild/bin/external/protobuf/_objs/protobuf_lite/external/protobuf/src/google/protobuf/io/coded_stream.d /c external/protobuf/src/google/protobuf/io/coded_stream.cc /Fobazel-out/vc_14_0_x64-fastbuild/bin/external/protobuf/_objs/protobuf_lite/external/protobuf/src/google/protobuf/io/coded_stream.o -DHAVE_PTHREAD -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Wno-error=unused-function: com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
The system cannot find the path specified.

@dslomov dslomov added this to the 0.5 milestone Dec 8, 2016
@dslomov dslomov removed their assignment Feb 14, 2017
@dslomov dslomov modified the milestones: 0.6, 0.5 Apr 4, 2017
@dslomov dslomov modified the milestones: 0.7, 0.6 Jul 24, 2017
@dslomov dslomov modified the milestones: 0.6, 0.7 Aug 3, 2017
@laszlocsomor laszlocsomor changed the title gtest doesn't work without --test_env TMP=/tmp on Windows TMP: gtest doesn't work without --test_env TMP=/tmp on Windows Sep 4, 2017
@laszlocsomor
Copy link
Contributor

laszlocsomor commented Sep 6, 2017

Duplicate of #2870.
Duplicate of #2349.

@petemounce
Copy link
Contributor

I'm affected by this on bazel 0.5.3.

bazel-io pushed a commit that referenced this issue Oct 16, 2017
Every build and test action that creates a Spawn
will now have platform-specific environment
variables for temp directories:
- on Windows: TMP and TEMP
- on Linux/Darwin: TMPDIR

This is particularly important on Windows where
e.g. Java programs cannot create temp directories
unless there's a valid TMP or TEMP environment
variable set.

Fixes:
- #1590
- #2349
- #2870

Change-Id: Ib758307daf6b3a51b0f71ae5e65e5bb564dad643
PiperOrigin-RevId: 172326371
@laszlocsomor
Copy link
Contributor

Closing because actions now always have a temp directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) platform: windows type: bug
Projects
None yet
Development

No branches or pull requests

5 participants