-
Notifications
You must be signed in to change notification settings - Fork 0
/
android.test
executable file
·57 lines (49 loc) · 1.32 KB
/
android.test
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
#!/bin/bash
echo "Running unit tests."
# Validating Android Studio is installed/
if [ -z "${JAVA_HOME}" ]
then
echo 'ERROR: Failed to locate $JAVA_HOME'
echo "Install it with: yum search java | grep openjdk"
echo "Check it here: /usr/lib/jvm/"
exit 1299
fi
# Validating Android Studio is installed/
if [ -z "${ANDROID_SDK_ROOT}" ]
then
echo 'ERROR: Failed to locate $ANDROID_SDK_ROOT'
echo "Downoad it from: https://developer.android.com/studio#downloads"
exit 1289
fi
# Validating Android Studio tools are installed.
if [ ! -d "${ANDROID_SDK_ROOT}/tools/bin" ]
then
echo 'ERROR: Failed to locate $ANDROID_SDK_ROOT tools'
echo "Downoad it from: https://developer.android.com/studio#downloads"
exit 1290
fi
# Accpeting Android Studio license.
yes | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager --licenses
if [ $? != 0 ]
then
echo 'ERROR: Failed to accept License.'
exit 8312
fi
# Locating the gradlew script.
GRADLEW="./gradlew"
if [[ ! -f "${GRADLEW}" ]]
then
echo 'ERROR: Not at an Android directory.'
exit 1381
fi
# Changing permissions of the gradlew executable file.
chmod 755 "${GRADLEW}"
# Executing Unit Tests.
${GRADLEW} test
LAST_COMMAND_EXIT_CODE=$?
if [ ${LAST_COMMAND_EXIT_CODE} != 0 ]
then
echo 'ERROR: Failed to run unit tests.'
exit 8123
fi
echo "Unit tests passed!"