Skip to content

Commit

Permalink
WIP: test long command line
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Dec 22, 2022
1 parent 051c9a5 commit f74ef38
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/test/py/bazel/bazel_windows_cpp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,36 @@ 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",',
' includes = ["a" * 32768]',
')',
'cc_binary(',
' name = "long_bin",',
' srcs = ["main.cpp"],',
' deps = [',
' ":long"',
' ]',
')',
])
self.ScratchFile('main.cpp', ['int main() { return 0; }'])

# By default, the build should fail with a command line too long error.
exit_code, _, stderr = self.RunBazel([
'build', '--verbose_failures', '//:long_bin'
])
self.AssertNotExitCode(exit_code, 1, stderr)

# With the compiler_param_file feature, the build should pass.
exit_code, _, stderr = self.RunBazel([
'build', '--verbose_failures', '--features=compiler_param_file',
'//:long_bin'
])
self.AssertNotExitCode(exit_code, 1, stderr)


if __name__ == '__main__':
unittest.main()

0 comments on commit f74ef38

Please sign in to comment.