|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
3 | | -# Provide suite names which you want to execute as a parameter or nothing if you want to execute all |
| 3 | +# Provide suite names which you want to execute as a parameter |
| 4 | +# Example: |
| 5 | +# no parameters or 'ALL' - execute all test suites |
| 6 | +# '-' (dash) - just compile - no suites executed |
| 7 | +# 'junit' - execute just unit tests |
4 | 8 |
|
5 | 9 | SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" |
6 | 10 | PROJECT_DIR=$(realpath "$SCRIPT_DIR/../") |
7 | 11 |
|
8 | | -echo "Starting KScript test suite..." |
9 | | - |
10 | | -REQUESTED_SUITES=${1:-ALL} |
11 | | -echo "Requested test suites: $REQUESTED_SUITES" |
12 | | - |
13 | | -# $1 - suite name; $2 - requested suites |
14 | | -start_suite() { |
15 | | - if [[ "${2}" =~ "${1}" ]] || [[ "${2}" == "ALL" ]]; then |
16 | | - echo |
17 | | - echo "Starting $1 tests:" |
18 | | - return 0 |
19 | | - fi |
20 | | - |
21 | | - echo "Skipping $1 tests..." |
22 | | - return 1 |
23 | | -} |
| 12 | +REQUESTED_SUITES="${@:-ALL}" |
| 13 | +echo "Starting KScript test suites: $REQUESTED_SUITES" |
| 14 | +echo |
24 | 15 |
|
25 | 16 | kscript --clear-cache |
| 17 | +echo |
26 | 18 |
|
27 | 19 | ######################################################################################################################## |
28 | | -SUITE="JUnit" |
29 | | -echo |
30 | | -echo "Starting $SUITE test suite... Compiling... Please wait..." |
| 20 | +echo "Compiling KScript... Please wait..." |
31 | 21 |
|
32 | 22 | cd $PROJECT_DIR |
33 | | -./gradlew clean build |
34 | | -status=$? |
| 23 | +./gradlew clean assemble |
| 24 | +EXIT_CODE="$?" |
35 | 25 | cd - |
36 | 26 |
|
37 | | -if [[ "$status" -ne "0" ]]; then |
| 27 | +if [[ "$EXIT_CODE" -ne "0" ]]; then |
38 | 28 | echo |
39 | | - echo "KScript build terminated with invalid exit code $status..." |
| 29 | + echo "KScript build terminated with invalid exit code $EXIT_CODE..." |
40 | 30 | exit 1 |
41 | 31 | fi |
42 | 32 |
|
43 | | -echo "$SUITE test suite successfully accomplished." |
44 | | - |
45 | 33 | ######################################################################################################################## |
46 | 34 |
|
47 | 35 | source "$SCRIPT_DIR/setup_environment.sh" |
| 36 | +echo |
| 37 | + |
| 38 | +######################################################################################################################## |
| 39 | +SUITE="junit" |
| 40 | +if start_suite $SUITE $REQUESTED_SUITES; then |
| 41 | + cd $PROJECT_DIR |
| 42 | + ./gradlew test |
| 43 | + EXIT_CODE="$?" |
| 44 | + cd - |
| 45 | + |
| 46 | + assert "echo $EXIT_CODE" "0" |
| 47 | + |
| 48 | + assert_end "$SUITE" |
| 49 | +fi |
48 | 50 |
|
49 | 51 | ######################################################################################################################## |
50 | 52 | SUITE="script_input_modes" |
|
0 commit comments