-
Notifications
You must be signed in to change notification settings - Fork 14
/
runTests.sh
executable file
·65 lines (54 loc) · 1.88 KB
/
runTests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# Stop the script if any command fails
set -e
# Function to run tests for a specific configuration
run_tests() {
local libBuildType="$1"
shift
local tasks=("$@")
if [ ${#tasks[@]} -eq 0 ]; then
echo "No specific tasks provided, running all default tests..."
# tasks=("jvmTest" "testDebugUnitTest" "testReleaseUnitTest" "jsTest" "wasmJsTest" "iosX64Test" "iosSimulatorArm64Test" "macosX64Test" "macosArm64Test" "tvosX64Test" "tvosSimulatorArm64Test")
tasks=("jvmTest" "jsTest" "wasmJsTest" "macosX64Test" "macosArm64Test")
fi
echo "Running tests with libBuildType=$libBuildType and tasks=${tasks[*]}..."
# Remove build directories if they exist
echo "clean build"
./gradlew :ksoup-test:clean -PlibBuildType="$libBuildType" --quiet --warning-mode=none
for task in "${tasks[@]}"; do
start_time=$(date +%s)
echo "Running $task... $libBuildType"
./gradlew "$task" -PlibBuildType="$libBuildType" --quiet --warning-mode=none
end_time=$(date +%s)
duration=$((end_time - start_time))
echo "Task $task completed in $duration seconds."
done
}
# Supported parameters
SUPPORTED_PARAMS=("core" "korlibs" "okio" "kotlinx")
# Function to check if the provided parameter is supported
is_supported_param() {
local param="$1"
for supported_param in "${SUPPORTED_PARAMS[@]}"; do
if [ "$supported_param" == "$param" ]; then
return 0
fi
done
return 1
}
# Main script logic
if [ "$#" -ge 1 ]; then
libBuildType="$1"
shift
if is_supported_param "$libBuildType"; then
run_tests "$libBuildType" "$@"
else
echo "Error: Unsupported parameter '$libBuildType'. Supported parameters are: ${SUPPORTED_PARAMS[*]}"
exit 1
fi
else
for param in "${SUPPORTED_PARAMS[@]}"; do
run_tests "$param"
done
fi
echo "All tests ran successfully!"