Skip to content

Commit

Permalink
Do not build tests for make all or make install (#365)
Browse files Browse the repository at this point in the history
This enables developers to iterate faster by not having to relink all the test binaries every time they make a change to a file. The tests can still be build and run with the new "check" target.

* Do not build tests for `make all` or `make install`

* Add `make check` command to README

* Change testing target in CI
  • Loading branch information
CyanoKobalamyne authored Jan 24, 2025
1 parent 0cf5a71 commit 7f911db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Test C++
run: |
cd build
make test
make check
- name: Install Python Bindings
run: python3 -m pip install -e ./build/python[test,pysmt]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Pono was awarded the Oski Award under its original name _cosa2_ at [HWMCC'19](ht
* if building with mathsat, also include `--with-msat` as an option to `configure.sh`
* Run `cd build`.
* Run `make`.
* [optional] Run `make check` to build and run the tests.

### Dependencies

Expand Down
8 changes: 6 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,22 @@ if (WITH_MSAT)
add_definitions(-DWITH_MSAT)
endif()

add_library(pono-test-lib "${PONO_LIB_TYPE}"
add_library(pono-test-lib EXCLUDE_FROM_ALL "${PONO_LIB_TYPE}"
"${CMAKE_CURRENT_SOURCE_DIR}/common_ts.cpp"
)

# INCLUDE_DIRS set in top-level CMakeLists.txt
target_include_directories(pono-test-lib PUBLIC "${INCLUDE_DIRS}")
target_link_libraries(pono-test-lib pono-lib)

# Create `make check` target that (re-)builds tests before trying to run them.
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})

macro(pono_add_test name)
add_executable(${name} "${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp")
add_executable(${name} EXCLUDE_FROM_ALL "${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp")
target_link_libraries(${name} gtest gtest_main)
target_link_libraries(${name} pono-test-lib) # also includes pono-lib because it's linked
add_dependencies(check ${name})
add_test(NAME ${name} COMMAND ${name})
endmacro()

Expand Down

0 comments on commit 7f911db

Please sign in to comment.