|
12 | 12 | # ./mvn-test-no-boilerplate.sh -pl json-java21-api-tracker -Dtest=CompilerApiLearningTest |
13 | 13 | # |
14 | 14 | # The script automatically detects if mvnd is available, otherwise falls back to mvn |
| 15 | +# Presets: pass a first arg token to run a curated flow. Currently supported: |
| 16 | +# run_schema_check_with_clean |
| 17 | +# - Cleans and then verifies only the json-java21-schema IT |
| 18 | +# - Runs JsonSchemaCheckIT in strict mode with CSV metrics |
| 19 | +# - Uses mvnd -q when available, prints DONE/FAILED based on exit status |
15 | 20 |
|
16 | 21 | # Detect if mvnd is available, otherwise use mvn |
17 | 22 | if command -v mvnd &> /dev/null; then |
|
20 | 25 | MVN_CMD="mvn" |
21 | 26 | fi |
22 | 27 |
|
23 | | -echo "[INFO] Running: $MVN_CMD verify $@" |
| 28 | +PRESET="$1" |
| 29 | +QUIET_FLAG="" |
| 30 | +DO_CLEAN=false |
| 31 | +MVN_ARGS="" |
24 | 32 |
|
25 | | -timeout 120 $MVN_CMD verify "$@" 2>&1 | awk ' |
| 33 | +if [ "$PRESET" = "run_schema_check_with_clean" ]; then |
| 34 | + DO_CLEAN=true |
| 35 | + QUIET_FLAG="-q" |
| 36 | + # Ignore all user-supplied args for preset; use curated defaults |
| 37 | + echo "[INFO] Preset detected: run_schema_check_with_clean" |
| 38 | + echo "[INFO] Ignoring passed parameters; running curated schema IT flow" |
| 39 | + MVN_ARGS="-pl json-java21-schema -Dit.test=JsonSchemaCheckIT -Djson.schema.strict=true -Djson.schema.metrics=csv -Djava.util.logging.ConsoleHandler.level=INFO -DfailIfNoTests=false -e -DtrimStackTrace=false -Dorg.slf4j.simpleLogger.log.org.apache.maven.plugins.failsafe=debug" |
| 40 | + shift # consume preset token |
| 41 | +else |
| 42 | + # No preset: forward all args as-is |
| 43 | + MVN_ARGS="$@" |
| 44 | +fi |
| 45 | + |
| 46 | +echo "[INFO] Running: $MVN_CMD ${QUIET_FLAG} generate-test-resources failsafe:integration-test failsafe:verify ${MVN_ARGS}" |
| 47 | + |
| 48 | +set -o pipefail |
| 49 | + |
| 50 | +if $DO_CLEAN; then |
| 51 | + timeout 120 $MVN_CMD ${QUIET_FLAG} clean || exit $? |
| 52 | +fi |
| 53 | + |
| 54 | +timeout 120 $MVN_CMD ${QUIET_FLAG} generate-test-resources failsafe:integration-test failsafe:verify ${MVN_ARGS} 2>&1 | awk ' |
26 | 55 | BEGIN { |
27 | 56 | scanning_started = 0 |
28 | 57 | compilation_section = 0 |
@@ -71,3 +100,11 @@ test_section { |
71 | 100 | } |
72 | 101 | } |
73 | 102 | ' |
| 103 | + |
| 104 | +STATUS=${PIPESTATUS[0]} |
| 105 | +if [ $STATUS -eq 0 ]; then |
| 106 | + echo DONE |
| 107 | +else |
| 108 | + echo FAILED |
| 109 | +fi |
| 110 | +exit $STATUS |
0 commit comments