Skip to content

[lldb] Add early CMake check for 'make' tool #111531

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

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lldb/packages/Python/lldbsuite/test/dotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ def parseOptionsAndInitTestdirs():
configuration.make_path = "gmake"
else:
configuration.make_path = "make"
if " " in configuration.make_path:
configuration.make_path = f'"{configuration.make_path}"'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default install path on Windows is C:\Program Files (x86)\GnuWin32\bin\make.exe unfortunately.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That may be fine, but I think this is the wrong place to quote it. I think it should happen somewhere around the place where this variable is concatenated into a string (or passed to whatever it is that requires it to be quoted).

That said, after tracing this variable, I'm a little unsure as to why is this needed. IIUC, this eventually makes its way to the subprocess.check_output call here, which should be able to handle quoting on its own.

Can you explain what the problem was without this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this because yesterday my tests failed with:

'C:/Program' is not recognized as an internal or external command,
operable program or batch file.

I double-checked again today and this doesn't happen anymore. I am not sure why, maybe I had an inconsistent configuration state. The parameter for dotest.py is --make C:/Program Files (x86)/GnuWin32/bin/make.exe and the command that lldbtest.py runs is starting with C:/Program Files (x86)/GnuWin32/bin/make.exe VPATH=.... I cleared the cached in lldb-test-build.noindex and checked sure the binaries are recreated successfully by the test suite. It works without the quotes.

I am attaching a log file TestBreakpointByLineAndColumn.log with the commands dumped for future reference. I will the quoting and assume it just keeps working.


if args.dsymutil:
configuration.dsymutil = args.dsymutil
Expand Down
1 change: 1 addition & 0 deletions lldb/test/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ endif()
set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb executable used for testing")
set(LLDB_TEST_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors")
set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil used for generating dSYM bundles")
set(LLDB_TEST_MAKE "${LLDB_DEFAULT_TEST_MAKE}" CACHE PATH "make tool used for building test executables")

if ("${LLDB_TEST_COMPILER}" STREQUAL "")
message(FATAL_ERROR "LLDB test compiler not specified. Tests will not run.")
Expand Down
3 changes: 3 additions & 0 deletions lldb/test/API/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ def delete_module_cache(path):
if is_configured("dsymutil"):
dotest_cmd += ["--dsymutil", config.dsymutil]

if is_configured("make"):
dotest_cmd += ["--make", config.make]

if is_configured("llvm_tools_dir"):
dotest_cmd += ["--llvm-tools-dir", config.llvm_tools_dir]

Expand Down
1 change: 1 addition & 0 deletions lldb/test/API/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ config.lldb_executable = lit_config.substitute('@LLDB_TEST_EXECUTABLE@')
config.test_arch = '@LLDB_TEST_ARCH@'
config.test_compiler = lit_config.substitute('@LLDB_TEST_COMPILER@')
config.dsymutil = lit_config.substitute('@LLDB_TEST_DSYMUTIL@')
config.make = lit_config.substitute('@LLDB_TEST_MAKE@')
config.has_libcxx = @LLDB_HAS_LIBCXX@
config.libcxx_libs_dir = "@LIBCXX_LIBRARY_DIR@"
config.libcxx_include_dir = "@LIBCXX_GENERATED_INCLUDE_DIR@"
Expand Down
16 changes: 16 additions & 0 deletions lldb/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ if(LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS)
"`LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=OFF`")
endif()
endforeach()

# On Windows make is not part of the MSYS tools that llvm-lit takes care of
if(LLDB_TEST_MAKE)
set(LLDB_DEFAULT_TEST_MAKE ${LLDB_TEST_MAKE})
else()
find_program(LLDB_DEFAULT_TEST_MAKE make)
if(LLDB_DEFAULT_TEST_MAKE)
message(STATUS "Found make: ${LLDB_DEFAULT_TEST_MAKE}")
else()
message(STATUS "Not found: make")
message(SEND_ERROR
"LLDB tests require 'make' tool. Please pass via `LLDB_TEST_MAKE` "
"(or otherwise disable strict testing requirements with "
"`LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=OFF`)")
endif()
endif()
endif()

if(LLDB_BUILT_STANDALONE)
Expand Down
Loading