Skip to content

Commit f19342e

Browse files
authored
Add fast smoke script for core unit tests (#4190)
1 parent 71d22a6 commit f19342e

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

AGENTS.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Agent Instructions
2+
3+
## Scope
4+
These instructions apply to the entire repository. They are aimed at helping Codex agents build and run the core unit tests that live under `maven/core-unittests`.
5+
6+
## Java runtime
7+
- Use Java 8 when running the Maven build. This matches the CI configuration in `.github/workflows/pr.yml` and avoids JaCoCo instrumentation errors with newer JDKs.
8+
- Set `JAVA_HOME` and update `PATH` before invoking Maven:
9+
```bash
10+
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
11+
export PATH="$JAVA_HOME/bin:$PATH"
12+
```
13+
14+
## Building and testing `maven/core-unittests`
15+
- From the repository root, run the same Maven goal the PR CI uses for the core unit tests:
16+
```bash
17+
cd maven
18+
mvn clean verify -DunitTests=true -pl core-unittests -am -Dmaven.javadoc.skip=true -Plocal-dev-javase
19+
```
20+
- This command will compile the dependencies, run the `core-unittests` test suite, and generate quality reports (SpotBugs/PMD/Checkstyle/JaCoCo) in `maven/core-unittests/target`.
21+
- For a quicker edit/build cycle while iterating on tests, you can skip the clean step and run just the module’s tests:
22+
```bash
23+
cd maven
24+
mvn -pl core-unittests -am -DunitTests=true -Dmaven.javadoc.skip=true -Plocal-dev-javase test
25+
```
26+
- For the fastest smoke check Codex can run while editing tests, use the helper script to execute a single lightweight test with the CI flags:
27+
```bash
28+
./scripts/fast-core-unit-smoke.sh
29+
```
30+
This keeps the Java 8 toolchain, skips the top-level clean, and targets `ButtonGroupTest` for a sub-minute feedback loop.
31+
32+
## Artifacts to check
33+
- Test reports: `maven/core-unittests/target/surefire-reports/`
34+
- Coverage: `maven/core-unittests/target/site/jacoco/`
35+
- Static analysis: `maven/core-unittests/target/spotbugs*.xml`, `maven/core-unittests/target/pmd.xml`, `maven/core-unittests/target/checkstyle-result.xml`

scripts/fast-core-unit-smoke.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Quick smoke test for the core-unittests module. Runs a single fast test with
5+
# the same flags the CI workflow uses, but skips the global clean to keep the
6+
# feedback loop short.
7+
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
8+
9+
# Match the CI JDK to avoid JaCoCo instrumentation issues.
10+
export JAVA_HOME="${JAVA_HOME:-/usr/lib/jvm/java-8-openjdk-amd64}"
11+
export PATH="$JAVA_HOME/bin:$PATH"
12+
13+
cd "$REPO_ROOT/maven"
14+
15+
mvn -pl core-unittests -am \
16+
-DunitTests=true \
17+
-Dmaven.javadoc.skip=true \
18+
-Dtest=ButtonGroupTest \
19+
-DfailIfNoTests=false \
20+
-Plocal-dev-javase \
21+
test

0 commit comments

Comments
 (0)