Skip to content

Commit f46d282

Browse files
jbachorikclaude
andcommitted
Document -Ptests syntax for Exec-based test tasks
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent cafd6a5 commit f46d282

4 files changed

Lines changed: 18 additions & 8 deletions

File tree

AGENTS.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,16 @@ Release builds automatically extract debug symbols:
242242
## Development Workflow
243243

244244
### Running Single Tests
245-
Use standard Gradle syntax:
245+
Use project properties to filter tests (config-specific test tasks use Exec, not Test):
246246
```bash
247-
./gradlew :ddprof-test:test --tests "ClassName.methodName"
247+
./gradlew :ddprof-test:testdebug -Ptests=ClassName.methodName # Single method
248+
./gradlew :ddprof-test:testdebug -Ptests=ClassName # Entire class
248249
```
249250

251+
**Note**: Use `-Ptests` (not `--tests`) because config-specific test tasks (testdebug, testrelease)
252+
use Gradle's Exec task type to bypass toolchain issues on musl systems. The `--tests` flag only
253+
works with Gradle's Test task type.
254+
250255
### Working with Native Code
251256
Native compilation is automatic during build. C++ code changes require:
252257
1. Full rebuild: `/build-and-summarize clean build`
@@ -639,11 +644,11 @@ The CI caches JDKs via `.github/workflows/cache_java.yml`. When adding a new JDK
639644
```
640645
- Instead of:
641646
```bash
642-
./gradlew :prof-utils:test --tests "UpscaledMethodSampleEventSinkTest"
647+
./gradlew :ddprof-test:testdebug -Ptests=MuslDetectionTest
643648
```
644649
use:
645650
```bash
646-
./.claude/commands/build-and-summarize :prof-utils:test --tests "UpscaledMethodSampleEventSinkTest"
651+
./.claude/commands/build-and-summarize :ddprof-test:testdebug -Ptests=MuslDetectionTest
647652
```
648653

649654
- This ensures the full build log is captured to a file and only a summary is shown in the main session.

ddprof-stresstest/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,11 @@ Use reduced iterations:
230230
### Profiler fails to start
231231
Verify profiler library loads:
232232
```bash
233-
./gradlew :ddprof-test:test --tests "JavaProfilerTest.testGetInstance"
233+
./gradlew :ddprof-test:testdebug -Ptests=JavaProfilerTest.testGetInstance
234234
```
235235

236+
**Note**: Use `-Ptests` (not `--tests`) with config-specific test tasks like `testdebug`.
237+
236238
### Out of memory errors
237239
- Reduce concurrent thread counts
238240
- Use smaller parameter values

doc/build/GradleTasks.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ testTsan # Java tests with TSAN library (Linux)
6262
**Examples:**
6363
```bash
6464
./gradlew :ddprof-test:testRelease
65-
./gradlew :ddprof-test:testDebug --tests "*.ProfilerTest"
65+
./gradlew :ddprof-test:testDebug -Ptests=ProfilerTest
6666
```
6767

68+
**Note**: Use `-Ptests` (not `--tests`) with config-specific test tasks. The `--tests` flag only works with Gradle's Test task type, but config-specific tasks (testDebug, testRelease) use Exec task type to bypass toolchain issues on musl systems.
69+
6870
### C++ Unit Tests (Google Test)
6971

7072
```
@@ -178,7 +180,7 @@ linkFuzz_{TargetName} # Link fuzz target
178180

179181
### Quick Development Cycle
180182
```bash
181-
./gradlew assembleDebug :ddprof-test:testDebug --tests "*.MyTest"
183+
./gradlew assembleDebug :ddprof-test:testDebug -Ptests=MyTest
182184
```
183185

184186
### Pre-commit Checks

utils/run-docker-tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,10 @@ fi
414414
# ========== Run Tests ==========
415415

416416
# Build gradle test command
417+
# Note: Use -Ptests (not --tests) because config-specific tasks use Exec, not Test
417418
GRADLE_CMD="./gradlew -PCI -PkeepJFRs :ddprof-test:test${CONFIG}"
418419
if [[ -n "$TESTS" ]]; then
419-
GRADLE_CMD="$GRADLE_CMD --tests \"$TESTS\""
420+
GRADLE_CMD="$GRADLE_CMD -Ptests=\"$TESTS\""
420421
fi
421422
if ! $GTEST_ENABLED; then
422423
GRADLE_CMD="$GRADLE_CMD -Pskip-gtest"

0 commit comments

Comments
 (0)