diff options
author | 2016-07-15 13:26:57 +0000 | |
---|---|---|
committer | 2016-07-15 13:32:47 +0000 | |
commit | 42d8290f21d5ae836ac2aa65166aa84afda8b872 (patch) | |
tree | 2a065375e444b81ee196d007ba874bc4964f20d2 | |
parent | a83ac07b6f367bbc6b271c79d748f69a712a3138 (diff) |
Fix Windows tests.
--
Change-Id: Ib480661ebbc522007edd77b374d6720d216b4508
Reviewed-on: https://bazel-review.googlesource.com/#/c/4050
MOS_MIGRATED_REVID=127534581
-rw-r--r-- | src/main/cpp/blaze_util_mingw.cc | 21 | ||||
-rw-r--r-- | src/main/native/windows_processes.cc | 5 | ||||
-rwxr-xr-x | src/test/shell/bazel/bazel_windows_cpp_test.sh | 3 | ||||
-rwxr-xr-x | src/test/shell/bazel/test-setup.sh | 5 | ||||
-rw-r--r-- | tools/cpp/cc_configure.bzl | 13 |
5 files changed, 27 insertions, 20 deletions
diff --git a/src/main/cpp/blaze_util_mingw.cc b/src/main/cpp/blaze_util_mingw.cc index c5ebbdba80..08d3ae705f 100644 --- a/src/main/cpp/blaze_util_mingw.cc +++ b/src/main/cpp/blaze_util_mingw.cc @@ -263,7 +263,9 @@ string RunProgram( &processInfo); // _Out_ LPPROCESS_INFORMATION lpProcessInformation if (!ok) { - pdie(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR, "CreateProcess"); + pdie(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR, + "RunProgram/CreateProcess: Error %d while executing %s", + GetLastError(), cmdline.cmdline); } CloseHandle(pipe_write); @@ -378,21 +380,23 @@ void ExecuteDaemon(const string& exe, const std::vector<string>& args_vector, SetEnvironmentVariable("BAZEL_SH", getenv("BAZEL_SH")); bool ok = CreateProcess( - NULL, // _In_opt_ LPCTSTR lpApplicationName, + NULL, // _In_opt_ LPCTSTR lpApplicationName, // _Inout_opt_ LPTSTR lpCommandLine, cmdline.cmdline, - NULL, // _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, - NULL, // _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, - TRUE, // _In_ BOOL bInheritHandles, + NULL, // _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, + NULL, // _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, + TRUE, // _In_ BOOL bInheritHandles, // _In_ DWORD dwCreationFlags, - DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP | CREATE_BREAKAWAY_FROM_JOB, + DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP, NULL, // _In_opt_ LPVOID lpEnvironment, NULL, // _In_opt_ LPCTSTR lpCurrentDirectory, &startupInfo, // _In_ LPSTARTUPINFO lpStartupInfo, &processInfo); // _Out_ LPPROCESS_INFORMATION lpProcessInformation if (!ok) { - pdie(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR, "CreateProcess"); + pdie(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR, + "ExecuteDaemon/CreateProcess: error %u executing: %s\n", + GetLastError(), cmdline.cmdline); } CloseHandle(output_file); @@ -478,7 +482,8 @@ void ExecuteProgram( &processInfo); // _Out_ LPPROCESS_INFORMATION lpProcessInformation if (!success) { - pdie(255, "Error %u executing: %s\n", GetLastError(), cmdline); + pdie(255, "ExecuteProgram/CreateProcess: error %u executing: %s\n", + GetLastError(), cmdline.cmdline); } if (!AssignProcessToJobObject(job, processInfo.hProcess)) { diff --git a/src/main/native/windows_processes.cc b/src/main/native/windows_processes.cc index b5a810eaac..c28d15110a 100644 --- a/src/main/native/windows_processes.cc +++ b/src/main/native/windows_processes.cc @@ -244,8 +244,9 @@ Java_com_google_devtools_build_lib_windows_WindowsProcesses_nativeCreateProcess( thread = process_info.hThread; if (!AssignProcessToJobObject(result->job_, result->process_)) { - result->error_ = GetLastErrorString("AssignProcessToJobObject()"); - goto cleanup; + // todo(lberki): Fix job control (GitHub issue #1527). + // result->error_ = GetLastErrorString("AssignProcessToJobObject()"); + // goto cleanup; } // Now that we put the process in a new job object, we can start executing it diff --git a/src/test/shell/bazel/bazel_windows_cpp_test.sh b/src/test/shell/bazel/bazel_windows_cpp_test.sh index 74cf9aba4b..e51f411433 100755 --- a/src/test/shell/bazel/bazel_windows_cpp_test.sh +++ b/src/test/shell/bazel/bazel_windows_cpp_test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x # # Copyright 2016 The Bazel Authors. All rights reserved. # @@ -33,6 +33,7 @@ fi function set_up() { copy_examples + export PATH=$PATH:/c/python_27_amd64/files } common_args="-s --verbose_failures --cpu=x64_windows_msvc" diff --git a/src/test/shell/bazel/test-setup.sh b/src/test/shell/bazel/test-setup.sh index 77b23bbf87..8d6d668159 100755 --- a/src/test/shell/bazel/test-setup.sh +++ b/src/test/shell/bazel/test-setup.sh @@ -33,12 +33,7 @@ echo "bazel binary is at $bazel" unset JAVA_RUNFILES function setup_bazelrc() { - # enable batch mode when running on windows - if is_windows; then - BATCH_MODE="startup --batch" - fi cat >$TEST_TMPDIR/bazelrc <<EOF -${BATCH_MODE:-} startup --output_user_root=${bazel_root} startup --host_javabase=${bazel_javabase} build -j 8 diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl index feb15834e7..3081fcc60c 100644 --- a/tools/cpp/cc_configure.bzl +++ b/tools/cpp/cc_configure.bzl @@ -335,9 +335,10 @@ def _find_cc(repository_ctx): def _find_vs_path(repository_ctx): """Find Visual Studio install path.""" bash_bin = _which_cmd(repository_ctx, "bash.exe") - program_files_dir = repository_ctx.os.environ["ProgramFiles(x86)"] - if not program_files_dir: - fail("'ProgramFiles(x86)' environment variable is not set") + if "ProgramFiles(x86)" in repository_ctx.os.environ: + program_files_dir = repository_ctx.os.environ["ProgramFiles(x86)"] + else: + program_files_dir="C:\\Program Files (x86)" vs_version = repository_ctx.execute([bash_bin, "-c", "ls '%s' | grep -E 'Microsoft Visual Studio [0-9]+' | sort | tail -n 1" % program_files_dir]).stdout.strip() return program_files_dir + "/" + vs_version @@ -405,8 +406,12 @@ def _impl(repository_ctx): python_dir = python_binary[0:-10].replace("\\", "\\\\") include_paths = env["INCLUDE"] + (python_dir + "include") lib_paths = env["LIB"] + (python_dir + "libs") + if "TMP" in repository_ctx.os.environ: + tmp_dir = repository_ctx.os.environ["TMP"] + else: + tmp_dir = "c:\\Windows\\Temp" _tpl(repository_ctx, "wrapper/bin/pydir/msvc_tools.py", { - "%{tmp}": repository_ctx.os.environ["TMP"].replace("\\", "\\\\"), + "%{tmp}": tmp_dir.replace("\\", "\\\\"), "%{path}": env["PATH"], "%{include}": include_paths, "%{lib}": lib_paths, |