44 lines
1.4 KiB
Bash
44 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|||
|
|
# Standalone test runner for PortalSrp and security mechanisms on Android/JVM
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
cd "$(dirname "$0")"
|
||
|
|
|
||
|
|
# Locate kotlinc
|
||
|
|
if [ -x "/Applications/Android Studio.app/Contents/plugins/Kotlin/kotlinc/bin/kotlinc" ]; then
|
||
|
|
KOTLIN="/Applications/Android Studio.app/Contents/plugins/Kotlin/kotlinc/bin/kotlinc"
|
||
|
|
KOTLIN_LIB="/Applications/Android Studio.app/Contents/plugins/Kotlin/kotlinc/lib"
|
||
|
|
elif command -v kotlinc >/dev/null 2>&1; then
|
||
|
|
KOTLIN="$(command -v kotlinc)"
|
||
|
|
KOTLIN_LIB="$(dirname "$KOTLIN")/../lib"
|
||
|
|
else
|
||
|
|
echo "Error: kotlinc compiler not found" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
KOTLIN_STDLIB="$KOTLIN_LIB/kotlin-stdlib.jar"
|
||
|
|
KOTLIN_STDLIB_JDK8="$KOTLIN_LIB/kotlin-stdlib-jdk8.jar"
|
||
|
|
|
||
|
|
BUILD_DIR="build/test-classes"
|
||
|
|
rm -rf "$BUILD_DIR"
|
||
|
|
mkdir -p "$BUILD_DIR"
|
||
|
|
|
||
|
|
echo "== [1/3] Compiling JVM Base64 adapter =="
|
||
|
|
javac -d "$BUILD_DIR" test/android/util/Base64.java
|
||
|
|
|
||
|
|
echo "== [2/3] Compiling PortalSrp, PortalSrpClient, and test suites with kotlinc =="
|
||
|
|
"$KOTLIN" \
|
||
|
|
-cp "$BUILD_DIR" \
|
||
|
|
-d "$BUILD_DIR" \
|
||
|
|
src/com/portaltv/capability/PortalSrp.kt \
|
||
|
|
src/com/portaltv/capability/PortalSrpClient.kt \
|
||
|
|
$(find test -name '*.kt')
|
||
|
|
|
||
|
|
echo "== [3/3] Running Portal SRP-6a Unit & Integration Test Suites =="
|
||
|
|
CP="$BUILD_DIR:$KOTLIN_STDLIB"
|
||
|
|
if [ -f "$KOTLIN_STDLIB_JDK8" ]; then
|
||
|
|
CP="$CP:$KOTLIN_STDLIB_JDK8"
|
||
|
|
fi
|
||
|
|
|
||
|
|
java -cp "$CP" com.portaltv.capability.test.TestRunnerKt "$@"
|