diff options
| author | Kostya <mail@sartin.in> | 2026-08-18 06:52:47 +0000 |
|---|---|---|
| committer | Kostya <mail@sartin.in> | 2026-08-18 06:52:47 +0000 |
| commit | d2688a197bd680580699f05e8194f9180e4832fa (patch) | |
| tree | 0531ef505b0637c9c4bcc17ab6183a6089e26889 /tools/test.sh | |
| parent | 13a221ffaefc169d028c7eab6f21ac88052d1d40 (diff) | |
| download | guess-market-d2688a197bd680580699f05e8194f9180e4832fa.tar.gz guess-market-d2688a197bd680580699f05e8194f9180e4832fa.tar.xz guess-market-d2688a197bd680580699f05e8194f9180e4832fa.zip | |
Add XML schema validation, split build scripts by module, rename BuyMenuCommand to PlaceOrderMenuCommand
Introduces XMLValidatorV1 and deserializer/adapter classes for events, ledgers,
markets, users, and trading mechanisms. Replaces the monolithic build.bat/run.sh
scripts with per-module tools (_util.sh, build.sh, package.sh, test.sh) that
compile in dependency order.
Diffstat (limited to 'tools/test.sh')
| -rw-r--r-- | tools/test.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/test.sh b/tools/test.sh new file mode 100644 index 0000000..4eaeb82 --- /dev/null +++ b/tools/test.sh | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | set -e | ||
| 4 | cd "$(dirname "$0")/.." | ||
| 5 | . tools/_util.sh | ||
| 6 | |||
| 7 | [ -d build/classes ] || { | ||
| 8 | echo "No build/classes - run tools/build.sh first" | ||
| 9 | exit 1 | ||
| 10 | } | ||
| 11 | |||
| 12 | JUNIT_JAR=$(ls lib/junit/junit-platform-console-standalone-*.jar 2>/dev/null | head -n 1) | ||
| 13 | [ -n "$JUNIT_JAR" ] || { | ||
| 14 | echo "JUnit standalone jar missing from lib/junit/" | ||
| 15 | exit 1 | ||
| 16 | } | ||
| 17 | |||
| 18 | PROD_CP="$(module_cp $MODULES)" | ||
| 19 | |||
| 20 | echo "=== Compiling test sources ===" | ||
| 21 | : >"$TMP/tests.txt" | ||
| 22 | for m in $MODULES; do | ||
| 23 | [ -d "$m/src/test/java" ] && find "$m/src/test/java" -name '*.java' >>"$TMP/tests.txt" | ||
| 24 | done | ||
| 25 | if [ ! -s "$TMP/tests.txt" ]; then | ||
| 26 | echo " (no test sources)" | ||
| 27 | exit 0 | ||
| 28 | fi | ||
| 29 | |||
| 30 | mkdir -p build/test-classes | ||
| 31 | javac --release "$JAVA_RELEASE" -d build/test-classes \ | ||
| 32 | -cp "$PROD_CP$SEP$JUNIT_JAR$SEP$LIBCP" "@$TMP/tests.txt" | ||
| 33 | |||
| 34 | echo "=== Running tests ===" | ||
| 35 | |||
| 36 | TEST_CP="$PROD_CP${SEP}build/test-classes" | ||
| 37 | for j in lib/*/*.jar; do | ||
| 38 | case "$j" in *junit-platform-console-standalone*) continue ;; esac | ||
| 39 | TEST_CP="$TEST_CP$SEP$j" | ||
| 40 | done | ||
| 41 | |||
| 42 | AGENT_JAR=$(ls lib/mockito/byte-buddy-agent-*.jar 2>/dev/null | head -n 1) | ||
| 43 | AGENT_ARG="" | ||
| 44 | [ -n "$AGENT_JAR" ] && AGENT_ARG="-javaagent:$AGENT_JAR" | ||
| 45 | |||
| 46 | java $AGENT_ARG -jar "$JUNIT_JAR" execute \ | ||
| 47 | --class-path "$TEST_CP" --scan-class-path --details=summary | ||