The-OpenROAD-Project / The-OpenROAD-Project/OpenROAD

drt: -no-tests configure fails — src/drt/test references build_and_test, a target that only exists when ENABLE_TESTS=ON

Open
#11,427 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Verilog
Stars
3.1k
Forks
1k
Avg merge
2d 23h
Merged PRs (30d)
136

Description

./etc/Build.sh -no-gui -no-tests no longer configures on master. At 766c85a4dde5f80a30dba7526f221a3953ef70a3:

CMake Error at src/drt/test/CMakeLists.txt:36 (add_dependencies):
  Cannot add target-level dependencies to non-existent target
  "build_and_test".

  The add_dependencies works for top-level logical targets created by the
  add_executable, add_library, or add_custom_target commands.
...
--  Tests Enabled  : OFF
-- Configuring incomplete, errors occurred!

Reading the source: -no-tests sets -DENABLE_TESTS=OFF (etc/Build.sh:121), and the top-level CMakeLists.txt creates build_and_test only inside if(ENABLE_TESTS) (lines 224-229). src/drt/CMakeLists.txt ends with an unguarded add_subdirectory(test), so the gtest block appended to src/drt/test/CMakeLists.txt in #11160 is reached with that target absent:

include(GoogleTest)
add_executable(WatermarkCostTest WatermarkCostTest.cpp)
target_include_directories(WatermarkCostTest PRIVATE ../src)
target_link_libraries(WatermarkCostTest PRIVATE drt_lib GTest::gtest_main)
gtest_discover_tests(WatermarkCostTest)
add_dependencies(build_and_test WatermarkCostTest)

Every other module with C++ tests keeps that block behind the ENABLE_TESTS guard, in one of two places:

  • src/odb, src/mpl and src/rsz guard add_subdirectory(test) in the module CMakeLists.txt
  • src/grt guards add_subdirectory(cpp) inside src/grt/test/CMakeLists.txt

src/drt does neither, which is why the new block is the first one to reach add_dependencies with tests off. c751cdc78e74 (2026-09-15) still configured; the first failure we see is after #11160 merged.

Reproduce, from a clean checkout of master:

./etc/Build.sh -no-gui -no-tests

Three questions:

  1. Is a CMake -no-tests build still a configuration you intend to support? Now that Bazel is the default build system, it would be reasonable if it were not, and we would rather know than paper over it.
  2. If it is, which placement would you prefer for drt — guarding add_subdirectory(test) in src/drt/CMakeLists.txt, the way odb/mpl/rsz do it, or guarding the gtest block inside src/drt/test/CMakeLists.txt, the way grt does? The first is a one-line change; the second keeps the integration tests registered with tests off, which is what drt does today.
  3. Would you like a PR for it, or would you rather take it yourselves? Happy either way — just say which and we will stay out of the way if you are already on it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with ./etc/Build.sh -no-gui -no-tests from a clean checkout. Read etc/Build.sh, src/drt/CMakeLists.txt, src/drt/test/CMakeLists.txt, and the comparable guards in src/odb, src/mpl, src/rsz, and src/grt. Confirm the chosen guard follows the project convention and that configuration completes with ENABLE_TESTS=OFF.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.