Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ jobs:
name: ${{ matrix.os }}-appdir
path: AppDir

- name: Unit test (test_picker_utils)
- name: C++ unit tests
run: |
cmake --build build --target test_picker_utils -j"$(nproc)"
./build/bin/test_picker_utils
cmake --build build --parallel "$(nproc)"
ctest --test-dir build --output-on-failure --parallel "$(nproc)"

- name: Smoke tests
run: |
Expand Down
9 changes: 9 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
include_directories(../include)

# Picker's Release builds define NDEBUG, while these tests use standard
# assert() for their checks. Keep the optimized build but make test assertions
# evaluate in every configuration.
if(MSVC)
add_compile_options(/UNDEBUG)
else()
add_compile_options(-UNDEBUG)
endif()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

include(parser_internalcfg)
Expand Down
4 changes: 3 additions & 1 deletion test/test_codegen_filelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ int main()

assert(stderr_output.empty());
assert(incdirs3.size() == 1);
assert(incdirs3.front() == base.string());
// Some standard libraries preserve a trailing separator for "base/.", so
// compare the existing directories rather than their spellings.
assert(fs::equivalent(fs::path(incdirs3.front()), base));
assert(contains_line(ofilelist3, (base / "rtl1.sv").string()));
assert(!contains_line(ofilelist3, (cwd_base / "rtl1.sv").string()));

Expand Down
3 changes: 2 additions & 1 deletion test/test_parser_internalcfg_unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ int main()
assert(pins.size() == 3);

bool found_a = false, found_b = false, found_c = false;
// Mapping keys are hierarchy components, including a scalar leaf's key.
for (const auto &p : pins) {
if (p.logic_pin == "top.sub.a") {
found_a = true;
Expand All @@ -42,7 +43,7 @@ int main()
found_b = true;
assert(p.logic_pin_type == "output");
assert(p.logic_pin_hb == -1);
} else if (p.logic_pin == "top.sub2.c") {
} else if (p.logic_pin == "top.sub2.key.c") {
found_c = true;
assert(p.logic_pin_type == "inout");
assert(p.logic_pin_hb == 7);
Expand Down
4 changes: 4 additions & 0 deletions test/test_picker_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ static void write_text(const std::string &p, const std::string &t) {
o << t;
}

#ifdef NDEBUG
#error "Picker test targets must be compiled with assertions enabled"
#endif

int main() {
// trim/ltrim/rtrim and trim with custom pattern
assert(picker::ltrim(string(" hi")) == "hi");
Expand Down