mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-05 19:28:25 +00:00
The Kotlin Multiplatform plugin registers no plain `test` task - it creates one per target (jvmTest, androidUnitTest, linuxX64Test, ...) plus `allTests`. A root `./gradlew test` runs `test` only in projects that own one and silently skips the rest; Gradle errors only when no project at all has the task, and the Java/Android modules do, so it exited 0 looking healthy while never running quartz, commons, commonsUI, quic, nestsClient or marmotQuic - about 8k of the ~11.7k tests here. - Root build registers a `test` alias onto `jvmTest` for every KMP subproject. `./gradlew test` now runs 11,690 tests across 11 modules instead of 3,567 across 5. It maps to jvmTest rather than allTests deliberately: allTests also pulls androidUnitTest and native targets that cannot run on a given host. - CI (build.yml) gains :quic:jvmTest and :marmotQuic:jvmTest. Neither appeared in any workflow - `grep -rn quic .github/workflows/` returned nothing - so quic's 495 RFC-vector and adversarial tests for the hand-rolled QUIC/TLS stack were running in no CI job at all. - The pre-push hook gains :commonsUI:jvmTest and :marmotQuic:jvmTest, which it had never listed. It stays an explicit list rather than calling `./gradlew test`: a bare `test` would pull in :desktopApp:test, which needs a display server and is skipped on CLAUDE_CODE_REMOTE. - CLAUDE.md documented `./gradlew test` as the way to run tests; it now says what that covers and how to name a single KMP module's suite. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nxd2uiYajDGuymQK93txzG
55 lines
1.8 KiB
Bash
Executable File
55 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
||
|
||
GREEN='\033[0;32m'
|
||
NO_COLOR='\033[0m'
|
||
|
||
echo "*********************************************************"
|
||
echo "Running git pre-push hook."
|
||
echo "*********************************************************"
|
||
echo ""
|
||
echo "Java Version: "
|
||
echo "$JAVA_HOME"
|
||
echo "$(java -version)"
|
||
echo "Running test... "
|
||
|
||
# Single-variant pre-push tests. `./gradlew test` would compile six Android
|
||
# variants of :amethyst (play/fdroid × debug/release/benchmark) plus full
|
||
# native-libs merging per variant — ~6× the work of one variant. CI runs the
|
||
# multi-flavor matrix on push to main; pre-push only needs one happy path.
|
||
#
|
||
# Every KMP module's tests live under <module>:jvmTest - the Kotlin Multiplatform
|
||
# plugin registers no plain `test` task - so a module missing from this list is a
|
||
# module nobody runs before pushing. Add new KMP modules here when they gain tests.
|
||
#
|
||
# `./gradlew test` now reaches the KMP modules too (see the `test` alias in the root
|
||
# build), but this hook stays explicit: a bare `test` would also pull in :desktopApp:test,
|
||
# which needs a display server and is deliberately skipped on CLAUDE_CODE_REMOTE below.
|
||
TASKS=(
|
||
:quartz:jvmTest
|
||
:commons:jvmTest
|
||
:commonsUI:jvmTest
|
||
:nestsClient:jvmTest
|
||
:quic:jvmTest
|
||
:marmotQuic:jvmTest
|
||
:amethyst:testPlayDebugUnitTest
|
||
:cli:test
|
||
)
|
||
|
||
if [ "${CLAUDE_CODE_REMOTE:-}" = "true" ]; then
|
||
./gradlew "${TASKS[@]}" --quiet
|
||
else
|
||
./gradlew "${TASKS[@]}" :desktopApp:test --quiet
|
||
fi
|
||
status=$?
|
||
|
||
if [ "$status" = 0 ] ; then
|
||
echo "All test passed."
|
||
exit 0
|
||
else
|
||
echo "*********************************************************"
|
||
echo 1>&2 "Failing test"
|
||
printf "Run ${GREEN}./gradlew test${NO_COLOR} to make sure you have all tests green before pushing...\n"
|
||
echo "*********************************************************"
|
||
exit 1
|
||
fi
|