1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-10 18:11:04 +09:00
Satori/eng/testing/AndroidRunnerTemplate.sh
Adeel Mujahid 6cc2d2e478
Fix a few syntax issues in shell scripts (#62102)
* Fix a few syntax issues in shell scripts

* Cleanup trailing whitespace in changed files
```sh
# git remote add dotnet https://github.com/dotnet/runtime && git pull --rebase dotnet main

if uname 2>/devnull | grep -q Darwin; then
    space=" "
fi

git show --name-only --pretty="" HEAD...dotnet/main |\
    xargs -I{} sh -c "test -f {} && sed -i$space'' 's/[[:space:]]*$//' {}"
```

* Address CR feedback
2021-11-30 17:32:39 -06:00

50 lines
1.1 KiB
Bash

#!/usr/bin/env bash
# NOTE: this script is only used locally, on CI we use the Helix SDK from arcade
EXECUTION_DIR=$(dirname $0)
ASSEMBLY_NAME=$1
TARGET_ARCH=$2
TARGET_OS=$3
TEST_NAME=$4
XHARNESS_OUT="$EXECUTION_DIR/xharness-output"
if [[ -n "$5" ]]; then
ADDITIONAL_ARGS=${@:5}
fi
cd $EXECUTION_DIR
# 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 test \
--instrumentation="net.dot.MonoRunner" \
--package-name="net.dot.$ASSEMBLY_NAME" \
--app="$EXECUTION_DIR/bin/$TEST_NAME.apk" \
--output-directory="$XHARNESS_OUT" \
--timeout=1800 \
$ADDITIONAL_ARGS
_exitCode=$?
echo "XHarness artifacts: $XHARNESS_OUT"
exit $_exitCode