feat(test): add basic testing suite along with user DSPQueue Test Cases - #376
feat(test): add basic testing suite along with user DSPQueue Test Cases#376Dhruv Menon (malto101) wants to merge 6 commits into
Conversation
Dhruv Menon (malto101)
commented
Aug 14, 2026
- Add base_test directory with a comprehensive CMake build system supporting Linux (aarch64) and Android (API 35) target platforms
- Integrate Unity test framework as a git submodule under test/base_test/vendor/unity for unit testing
- Include platform-specific CMake toolchain configurations for cross-compilation targeting linux and android
- Add XML stream writer utility for structured test reporting output
- Provide BASIC documentation in CMakeLists.txt covering quick start, running tests, and instructions for adding new test suites or individual test cases
|
Dhruv Menon (@malto101), can we split this single commit into multiple independent, incremental commits? It'll be easier to review. |
- Add root CMakeLists.txt with full quick-start, run, and extension docs - Register Unity test framework as a git submodule under vendor/unity - Add platform-specific CMake toolchain files for Linux (aarch64) and Android (API 35) cross-compilation - Add bin/CMakeLists.txt to produce deployable test binary artifacts - Add README.md with developer quick-start and contribution guide Signed-off-by: Dhruv Menon <dhrumeno@qti.qualcomm.com>
cbd0542 to
d36b713
Compare
updated it |
211b441 to
14507a4
Compare
| @@ -0,0 +1,114 @@ | |||
| # Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. | |||
There was a problem hiding this comment.
use year-less copyright
| # Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
| # | ||
| # bin/CMakeLists.txt |
There was a problem hiding this comment.
is this file really needed? Is it possible to stick with automake? Or do you think using cmake is better here?
There was a problem hiding this comment.
CMake is not strictly necessary, but it is genuinely the better tool for what base_test is doing. Migrating it to Automake is possible but would cost you real things.
- submodule integration: Cmake makes it a 1 liner
- CONFIGURE_DEPENDS auto-discovery -> makes it easier to create new test/auto discovers tests without hardcoding file source into build files for every new addition
- Each layer propagates include paths and compile definitions transitively via target_include_directories(... INTERFACE ...).
unity_dep → utils_dep → fastrpc_dep → common_test_dep → suite libs → test_fastrpc
In Automake, there is no equivalent — you would have to repeat _CFLAGS and _LDADD on every binary, or use a shared AM_CFLAGS that applies globally
- each platform file sets the full LLVM toolchain (clang, ld.lld, llvm-ar, etc.) and the right --target= triple. Under Automake this is done by ./configure --host=aarch64-linux-gnu or --host=aarch64-linux-android, which works but the Android NDK path resolution (ANDROID_NDK_HOME) and the NDK clang wrapper name (aarch64-linux-android35-clang) would need custom AC_ARG_WITH and AC_SUBST logic in configure.ac.
if i do move to automake, can we saperate it from top level automake build? because
the tests are architecturally a standalone consumer project, not part of the library build
| @@ -0,0 +1,73 @@ | |||
| # Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. | |||
There was a problem hiding this comment.
year-less copyright everywhere
| @@ -0,0 +1,91 @@ | |||
| #ifndef AEESTDDEF_IDL | |||
There was a problem hiding this comment.
there are plans to bring this IDL here: #356
can you use the same one?
| @@ -0,0 +1,32 @@ | |||
| interface remote_handle64 { | |||
| /** | |||
| * Opens the handle in the specified domain. If this is the first | |||
There was a problem hiding this comment.
same comment as above
14507a4 to
70f3ec1
Compare
| Every new `CMakeLists.txt` must begin with: | ||
|
|
||
| ```cmake | ||
| # Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. |
There was a problem hiding this comment.
needs correction here also
| ## Contributing — rules and policies | ||
|
|
||
| ### Code style | ||
|
|
There was a problem hiding this comment.
can you see if it matches the .clang-format added here:
055e3b1
There was a problem hiding this comment.
it matches everything except
TabWidth: 8
and SortIncludes: CaseSensitive combined with the IncludeCategories
can we reduce tabwidth to 4 as 8 takes up a lot of space, others file in reference use varying tab width ranging from 2 space to 2 tabs
ref:
1 tab: https://github.com/qualcomm/fastrpc/blob/development/src/adsp_default_listener.c
2 spaces: https://github.com/qualcomm/fastrpc/blob/development/src/fastrpc_mem.c
3 spaces: https://github.com/qualcomm/fastrpc/blob/development/src/adsp_listener1_stub.c
while we decide on this, i will add Sortincludes till then
| set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") | ||
|
|
||
| # ============================================================================ | ||
| # test_fastrpc — unified host binary |
There was a problem hiding this comment.
I believe you need to fix the naming to match the upstream guidelines. Use hyphen instead of underscore(test-fastrpc). Also if the scope of test is unit level then you can call it something more specifc(fastrpc-unit-test)
There was a problem hiding this comment.
got it!
changed it from _ to hypen
scope is unit/feature/end-to-end, which is why i had given a generic name
| "[%s] %s at %s:%d in %s()", | ||
| xml_error_code_to_string(error->code), | ||
| error->message, | ||
| error->file, |
There was a problem hiding this comment.
I see at many places the function arguments are kept 1 per line, is that really necessay? Can we stick with uniform coding style like the entire project?
There was a problem hiding this comment.
done
| const char* xml_error_code_to_string(xml_error_code_t code) { | ||
| switch (code) { | ||
| case XML_ERROR_NONE: return "No Error"; | ||
| case XML_ERROR_MEMORY: return "Memory Allocation Error"; |
There was a problem hiding this comment.
maybe follow kernel coding style for switch-case indentation:
https://docs.kernel.org/process/coding-style.html#indentation
Same for single lined if statements
There was a problem hiding this comment.
Done,
62233ce to
3ed4cc5
Compare
22d8457 to
90b7f3d
Compare
- Add streaming XML writer with layered architecture: streaming/ core writer, core/ data model, config/ configuration, error/ error handler, logging/ logger, facade/ public output API - Add utils/CMakeLists.txt to build xml_writer and future util targets - Utility is standalone with no dependency on test logic Signed-off-by: Dhruv Menon <dhrumeno@qti.qualcomm.com>
- Add Allure reporter (unity_allure_output) for structured test output - Add Unity fixture file reporter (unity_fixture_file_output) - Add shared fastrpc_utils (test_utils) with common test helpers - Add log_capture utility for capturing DSP/kernel log output - All utilities are consumed by both unit and feature test suites Signed-off-by: Dhruv Menon <dhrumeno@qti.qualcomm.com>
90b7f3d to
4a03a60
Compare
- Add fastrpc_test.idl defining the test RPC interface contract - Add AEEStdDef.idl and remote.idl as base IDL type dependencies - Add fastrpc_test_imp.c as the DSP-side stub implementation - Add idl/CMakeLists.txt to compile and link the IDL stub Signed-off-by: Dhruv Menon <dhrumeno@qti.qualcomm.com>
- Add root_all_tests.c as the top-level test runner entry point - Add unit tests for all DSPQueue API functions: create, close, write, read, peek, export, get_stat - Add feature tests covering end-to-end DSPQueue flows: echo flow, buffer management, data processing flow - Add dspqueue_feature_utils for shared feature test helpers - Add scripts/generate_report.sh for post-run report generation - Add CMakeLists.txt for both unit/ and feature/ test directories Signed-off-by: Dhruv Menon <dhrumeno@qti.qualcomm.com>
4a03a60 to
6c96087
Compare
Signed-off-by: Dhruv Menon <dhrumeno@qti.qualcomm.com>
6c96087 to
1fba7ff
Compare