Skip to content
Merged
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
5 changes: 4 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ Skip extraction: `./gradlew buildRelease -Pskip-debug-extraction=true`
### Container-based Testing (Recommended for ASan/Non-Local Environments)

For ASan testing, cross-architecture testing (aarch64), musl libc, or reproducing CI
environment issues. Defaults to Podman; use `--container=docker` for Docker.
environment issues. On macOS, run Docker through colima (`brew install colima docker &&
colima start`, then `--container=docker`): podman aborts every container command because its
credential-helper lookup for the Datadog registries (ddtool) cannot reach vault outside the
CI network. Linux CI may keep using podman; the script still defaults to it.

```bash
./utils/run-containers-tests.sh --arch=aarch64 --config=asan --libc=glibc --jdk=21
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ The project includes both Java and C++ unit tests. You can run them using:
`JAVA_TEST_HOME=<path to test JDK> ./gradlew testDebug`

### Container-Based Testing (musl/glibc)
Run tests in containers to test on different libc implementations. The script defaults to Podman; use `--container=docker` to use Docker instead. Uses two-level container image caching for fast subsequent runs:
Run tests in containers to test on different libc implementations. The script defaults to Podman; on macOS use Docker via colima (`--container=docker`) — podman's credential-helper lookup for the Datadog registries (ddtool) fails outside the CI network and aborts container commands. Uses two-level container image caching for fast subsequent runs:
1. **Base image** (`java-profiler-base:<libc>-<arch>`) - OS with all build tools + sanitizers
2. **JDK image** (`java-profiler-test:<libc>-jdk<version>-<arch>`) - Adds JDK + Gradle

Expand All @@ -180,7 +180,7 @@ By default, the script clones the repository at the current commit for clean bui
# Run one C++ gtest binary only
./utils/run-containers-tests.sh --libc=glibc --config=asan --gtest-task=elfparser_ut

# Use Docker instead of the default Podman runtime
# Use Docker via colima (recommended on macOS)
./utils/run-containers-tests.sh --container=docker --libc=glibc --jdk=21

# Force rebuild of all cached container images
Expand Down Expand Up @@ -210,7 +210,7 @@ Supported options:
- `--jdk=8|11|17|21|25|8-j9|11-j9|17-j9|21-j9|17-graal|21-graal|25-graal|regular|j9|graal|all[,..]` (default: 21)
- `--arch=x64|aarch64|all[,..]` (default: auto-detect)
- `--config=debug|release|asan|tsan|all[,..]` (default: debug)
- `--container=podman|docker` (default: podman)
- `--container=podman|docker` (default: podman; on macOS use `docker` backed by colima)
- `--tests="TestPattern"`
- `--gtest` (enable C++ gtests, disabled by default for faster runs)
- `--gtest-task=Task` (run one C++ gtest task; matrix runs require a short name like `elfparser_ut`, while single-cell runs also accept a full task path like `:ddprof-lib:gtestAsan_elfparser_ut`)
Expand Down
9 changes: 7 additions & 2 deletions ddprof-lib/src/test/cpp/thread_teardown_safety_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,14 @@ static void *t07_body(void *) {
pthread_testcancel();
usleep(100);
}
// The only runtime exit from the loop is cancellation: pthread_testcancel() (or the
// cancelled usleep()) calls pthread_exit(PTHREAD_CANCELED), which runs the registered
// cleanup handler and terminates the thread, so nothing after the loop is ever reached.
// pthread_cleanup_pop is still lexically required to pair with pthread_cleanup_push
// (both expand to an open/close of a do/while(0) block on musl); execute=0 because it
// is not a normal cleanup site — the handler already ran during cancellation.
pthread_cleanup_pop(0);
ProfiledThread::release();
return nullptr;
__builtin_unreachable();
}

#endif // __GLIBC__
Expand Down
4 changes: 2 additions & 2 deletions utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Also invoked interactively from `release.sh` when preparing a patch release.

### `run-containers-tests.sh`

Runs tests in containers across various OS/libc/JDK combinations, mirroring the CI matrix locally. Defaults to Podman; use `--container=docker` to use Docker.
Runs tests in containers across various OS/libc/JDK combinations, mirroring the CI matrix locally. Defaults to Podman; on macOS use Docker via colima (`--container=docker`) — podman's credential-helper lookup for the Datadog registries (ddtool) fails outside the CI network and aborts container commands.

**Usage:**
```bash
Expand All @@ -167,7 +167,7 @@ Examples:
# Run a single C++ gtest binary in ASan mode
./utils/run-containers-tests.sh --config=asan --gtest-task=elfparser_ut

# Use Docker instead of the default Podman runtime
# Use Docker via colima (recommended on macOS)
./utils/run-containers-tests.sh --container=docker --libc=glibc --jdk=21

# Preview selected JDKs across every supported libc/architecture pair
Expand Down
Loading