[WIP] Add unit test framework with C++ (GoogleTest) and Python (pytest) test suites#341
[WIP] Add unit test framework with C++ (GoogleTest) and Python (pytest) test suites#341chenshengxin2026 wants to merge 2 commits intohw-native-sys:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the project's testing infrastructure by integrating dedicated unit test frameworks for both C++ and Python components. This initiative aims to provide faster development feedback loops and enable more efficient continuous integration by validating individual modules in isolation, thereby reducing reliance on slower, environment-dependent end-to-end device tests. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive unit test framework for both C++ and Python components, which is a significant improvement for code quality and development velocity. The tests are well-structured and cover a wide range of scenarios, including core data structures, binary parsing, and toolchain configuration. My feedback focuses on a few areas to enhance maintainability and test robustness: improving the CMake helper function for consistency, cleaning up test code, and strengthening the logic in a concurrent stress test to ensure it's more effective.
32b5caa to
05f2fa7
Compare
…structure Introduce two unit test suites (12 C++ GoogleTest, 5 Python pytest) that validate core runtime data structures and the Python compilation pipeline without requiring hardware or simulation. Integrate both into ci.sh as a pre-integration-test stage.
05f2fa7 to
098248f
Compare
- Add test_coupling.cpp with 27 tests across 5 suites (ComponentIsolation, InitializationOrder, CrossComponentContract, StateLeakage, CompileTimeCoupling) using full TMR runtime linkage to detect and document coupling defects - Add test_coupling_stub.cpp with 20 tests across 5 suites (DepPoolStubIsolation, SchedulerWithoutOrchestrator, TensorMapLinkDecoupling, CompileTimeIncludeCoupling, ProfilingBehaviorCoupling) using selective linking to prove isolation boundaries - Update CMakeLists.txt with two new test targets: test_coupling (full linkage) and test_coupling_stub (orchestrator excluded to verify link-time isolation)
Summary
construction (host_build_graph), ring buffers (HeapRing, TaskRing),
dependency pool, tensor overlap detection, TensorMap hash table,
ReadyQueue (lock-free MPMC), shared memory layout, task state machine,
scope mechanism, and handshake protocol macros
parsing (elf_parser), toolchain flag generation (toolchain), kernel
compilation pipeline (kernel_compiler), CMake-based runtime compilation
(runtime_compiler), and ctypes bindings (bindings)
auto-fetch fallback and stub library for host-side testing
integration tests, requiring no hardware or simulation environment
Motivation
The existing test infrastructure relies on end-to-end device tests or simulation
(
ci.sh -p a2a3 / a2a3sim), which are slow and require specific environments. Theseunit tests validate individual data structures and Python modules in isolation, enabling
faster development feedback loops and CI gating without hardware dependencies.