forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBionicRunnerTemplate.sh
More file actions
62 lines (49 loc) · 1.47 KB
/
BionicRunnerTemplate.sh
File metadata and controls
62 lines (49 loc) · 1.47 KB
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
#!/usr/bin/env bash
EXECUTION_DIR="$(realpath "$(dirname "$0")")"
. "$EXECUTION_DIR/TestEnv.txt"
RUNTIME_PATH="$2"
TEST_SCRIPT="$(basename "$ASSEMBLY_NAME" .dll).sh"
if [[ -z "$HELIX_WORKITEM_UPLOAD_ROOT" ]]; then
XHARNESS_OUT="$EXECUTION_DIR/xharness-output"
else
XHARNESS_OUT="$HELIX_WORKITEM_UPLOAD_ROOT/xharness-output"
fi
if [[ -n "$3" ]]; then
ADDITIONAL_ARGS=${*:5}
fi
if [[ "x$1" != "x--runtime-path" ]]; then
echo "You must specify the runtime path with --runtime-path /path/to/runtime"
exit 1
fi
RUNTIME_PATH="$(realpath "$RUNTIME_PATH")"
cd "$EXECUTION_DIR" || exit 1
# it doesn't support parallel execution yet, so, here is a hand-made semaphore:
LOCKDIR=/tmp/androidtests.lock
while true; do
if mkdir "$LOCKDIR"
then
trap 'rm -rf "$LOCKDIR"' 0
break
else
sleep 5
fi
done
if [[ -n "$XHARNESS_CLI_PATH" ]]; then
# Allow overriding the path to the XHarness CLI DLL,
# we need to call it directly via dotnet exec
HARNESS_RUNNER="dotnet exec $XHARNESS_CLI_PATH"
else
HARNESS_RUNNER="dotnet xharness"
fi
$HARNESS_RUNNER android-headless test \
--test-path="$EXECUTION_DIR" \
--runtime-folder="$RUNTIME_PATH" \
--test-assembly="$ASSEMBLY_NAME" \
--device-arch="$TEST_ARCH" \
--test-script="$TEST_SCRIPT" \
--output-directory="$XHARNESS_OUT" \
--timeout=1800 -v \
$ADDITIONAL_ARGS
_exitCode=$?
echo "XHarness artifacts: $XHARNESS_OUT"
exit $_exitCode