diff --git a/src/test/py/bazel/bazel_windows_cpp_test.py b/src/test/py/bazel/bazel_windows_cpp_test.py index 42a2ab75ca6739..c16ec9b7f47ecd 100644 --- a/src/test/py/bazel/bazel_windows_cpp_test.py +++ b/src/test/py/bazel/bazel_windows_cpp_test.py @@ -389,9 +389,9 @@ def testDynamicLinkingMSVCRT(self): paramfile = os.path.join(bazel_output, 'x64_windows-fastbuild/bin/A_0.dll-2.params') self.AssertExitCode(exit_code, 0, stderr) - self.assertIn('/MD', ''.join(stderr)) + self.AssertFileContentContains(paramfile, '/MD') self.AssertFileContentContains(paramfile, '/DEFAULTLIB:msvcrt.lib') - self.assertNotIn('/MT', ''.join(stderr)) + self.AssertFileContentNotContains(paramfile, '/MT') self.AssertFileContentNotContains(paramfile, '/DEFAULTLIB:libcmt.lib') # Test build in debug mode. @@ -400,9 +400,9 @@ def testDynamicLinkingMSVCRT(self): paramfile = os.path.join(bazel_output, 'x64_windows-dbg/bin/A_0.dll-2.params') self.AssertExitCode(exit_code, 0, stderr) - self.assertIn('/MDd', ''.join(stderr)) + self.AssertFileContentContains(paramfile, '/MDd') self.AssertFileContentContains(paramfile, '/DEFAULTLIB:msvcrtd.lib') - self.assertNotIn('/MTd', ''.join(stderr)) + self.AssertFileContentNotContains(paramfile, '/MTd') self.AssertFileContentNotContains(paramfile, '/DEFAULTLIB:libcmtd.lib') def testStaticLinkingMSVCRT(self): @@ -1071,6 +1071,22 @@ def testBuildArm64CppBinaryWithMsvcCLAndCpuArm64Windows(self): self.AssertExitCode(exit_code, 0, stderr) self.assertIn('arm64\\cl.exe', ''.join(stderr)) + def testLongCompileCommandLines(self): + self.CreateWorkspaceWithDefaultRepos('WORKSPACE') + self.ScratchFile('BUILD', [ + 'cc_library(', + ' name = "long",', + ' srcs = ["long.cc"],', + ' includes = 110 * [450 * "aa"]', + ')', + ]) + self.ScratchFile('long.cc') + + exit_code, _, stderr = self.RunBazel([ + 'build', '--verbose_failures', '//:long' + ]) + self.AssertExitCode(exit_code, 0, stderr) + if __name__ == '__main__': unittest.main() diff --git a/tools/cpp/windows_cc_toolchain_config.bzl b/tools/cpp/windows_cc_toolchain_config.bzl index d913692b7e05d7..3ac914a948ee72 100644 --- a/tools/cpp/windows_cc_toolchain_config.bzl +++ b/tools/cpp/windows_cc_toolchain_config.bzl @@ -377,6 +377,7 @@ def _impl(ctx): compiler_param_file_feature = feature( name = "compiler_param_file", + enabled = True, ) copy_dynamic_libraries_to_binary_feature = feature(