PengZheng commented on code in PR #820:
URL: https://github.com/apache/celix/pull/820#discussion_r2847000793


##########
documents/building/testing.md:
##########
@@ -22,44 +22,53 @@ limitations under the License.
 # Testing Apache Celix
 
 This document describes how to build and run tests for Apache Celix.
+Building and testing can be done with Conan 2 (recommended) or with system 
CMake (manual dependencies. 
 
-## Building Tests
+## Build & test using Conan 2 (recommended)
 
-Celix uses CMake and Google Test for its unit and integration tests. To build 
the tests, ensure you have all dependencies installed, then run:
+If the [building](README.md) instructions for conan where followed, there 
should be a `build/Debug` build directory
+and a `conan-debug` cmake preset. This preset can be used to run the tests 
using ctest:
 
-```sh
-cmake -B build -DENABLE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
-cmake --build build
+```bash
+ctest --preset conan-debug --output-on-failure -j1
 ```
 
-```sh
-#conan
+Notes:
+  - `-j1` is needed because the Apache Celix tests are using cache directories 
and are not prepared for parallel testing.
+  - Use `-o "celix/*:enable_address_sanitizer=True"` during `conan install` to 
enable AddressSanitizer (ASAN).
+  - Use `-o "celix/*:enable_undefined_sanitizer"` during `conan install` to 
enable UndefinedBehaviorSanitizer (UBSAN).
 
-To enable AddressSanitizer (ASAN) when building tests, configure CMake with 
the `ENABLE_ASAN` option:
+## Running specific tests
 
-```sh
-cmake -B build -DENABLE_TESTING=ON -DENABLE_ADDRESS_SANITIZER=ON 
-DCMAKE_BUILD_TYPE=Debug
-cmake --build build
-```
-
-This will build Apache Celix and its tests with ASAN enabled, helping to 
detect memory errors during test execution.
+- Run tests matching a regex (useful to run a single test case or test binary):
 
-## Running Tests
+```bash
+# Run tests whose names match "MyTestName"
+ctest --preset conan-debug --test-dir build/Debug -R shell --output-on-failure 
-j1

Review Comment:
   Is `--test-dir build/Debug` unnecessary?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to