File: run_tests.sh

package info (click to toggle)
pytorch-cuda 2.6.0%2Bdfsg-7
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid, trixie
  • size: 161,620 kB
  • sloc: python: 1,278,832; cpp: 900,322; ansic: 82,710; asm: 7,754; java: 3,363; sh: 2,811; javascript: 2,443; makefile: 597; ruby: 195; xml: 84; objc: 68
file content (57 lines) | stat: -rwxr-xr-x 1,658 bytes parent folder | download | duplicates (3)
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
set -eux

PYTORCH_DIR="$(cd $(dirname $0)/..; pwd -P)"
PYTORCH_ANDROID_DIR=$PYTORCH_DIR/android

source "$PYTORCH_ANDROID_DIR/common.sh"

check_android_sdk
check_gradle

# Run android instrumented tests on x86 emulator

ADB_PATH=$ANDROID_HOME/platform-tools/adb

echo "Expecting running emulator"
$ADB_PATH devices

DEVICES_COUNT=$($ADB_PATH devices | awk 'NF' | wc -l)
echo "DEVICES_COUNT:$DEVICES_COUNT"

if [ "$DEVICES_COUNT" -eq 1 ]; then
  echo "Unable to found connected android emulators"
cat <<- EOF
  To start android emulator:
  1. Install android sdkmanager packages
  $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-25;google_apis;x86"

  to specify proxy add params: --proxy=http --proxy_host=fwdproxy --proxy_port=8080

  2. Create android virtual device
  $ANDROID_HOME/tools/bin/avdmanager create avd --name "x86_android25" --package "system-images;android-25;google_apis;x86"

  3. Start emulator in headless mode without audio
  $ANDROID_HOME/tools/emulator -avd x86_android25 -no-audio -no-window

  4. Check that emulator is running
  $ANDROID_HOME/platform-tools/adb devices

  If everything is ok the output will be:

  List of devices attached
  emulator-5554   device
EOF
  exit 1
fi

echo "Waiting for emulator boot completed"
$ADB_PATH wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;'

{
  # The test currently takes about 10 minutes
  retry $GRADLE_PATH -PABI_FILTERS=x86 -p $PYTORCH_ANDROID_DIR connectedAndroidTest
} || {
  echo "::error::Check https://github.com/pytorch/pytorch/tree/master/test/mobile/model_test to see how to fix the failed mobile test"
  exit 1
}