summaryrefslogtreecommitdiffstats
path: root/taskcluster/docker/snap-coreXX-build/snap-tests/tests.sh
blob: 854ef2c9af9b7465c6b6ea68ba800b47522b9910 (plain)
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
63
64
65
66
67
68
#!/bin/bash

set -ex

pwd

SUITE=${1:-basic}
SUITE=${SUITE//--/}

export ARTIFACT_DIR=$TASKCLUSTER_ROOT_DIR/builds/worker/artifacts/
mkdir -p "$ARTIFACT_DIR"

# There's a bug in snapd ~2.60.3-2.61 that will make "snap refresh" fail
# https://bugzilla.mozilla.org/show_bug.cgi?id=1873359
# https://bugs.launchpad.net/snapd/+bug/2048104/comments/13
# 
# So we retrieve the version and we will allow the first "snap refresh" to
# fail for versions < 2.61.1
SNAP_VERSION=$(snap info snapd --color=never --unicode=never |grep "installed:" | awk '{ print $2 }')
SNAP_MAJOR=$(echo "${SNAP_VERSION}" | cut -d'.' -f1)
SNAP_MINOR=$(echo "${SNAP_VERSION}" | cut -d'.' -f2)
SNAP_RELEASE=$(echo "${SNAP_VERSION}" | cut -d'.' -f3)

REFRESH_CAN_FAIL=true
if [ "${SNAP_MAJOR}" -ge 2 ]; then
  if [ "${SNAP_MAJOR}" -gt 2 ]; then
    REFRESH_CAN_FAIL=false
  else
    if [ "${SNAP_MINOR}" -ge 61 ]; then
      if [ "${SNAP_MINOR}" -gt 61 ]; then
        REFRESH_CAN_FAIL=false
      else
        if [ "${SNAP_RELEASE}" -gt 0 ]; then
          REFRESH_CAN_FAIL=false
        fi
      fi
    fi
  fi
fi

if [ "${REFRESH_CAN_FAIL}" = "true" ]; then
  sudo snap refresh || true
else
  sudo snap refresh
fi;

sudo snap refresh --hold=24h firefox

sudo snap install --name firefox --dangerous ./firefox.snap

RUNTIME_VERSION=$(snap run firefox --version | awk '{ print $3 }')

python3 -m pip install --user -r requirements.txt

# Required otherwise copy/paste does not work
# Bug 1878643
export TEST_NO_HEADLESS=1

if [ -n "${MOZ_LOG}" ]; then
  export MOZ_LOG_FILE="${ARTIFACT_DIR}/gecko-log"
fi

if [ "${SUITE}" = "basic" ]; then
  sed -e "s/#RUNTIME_VERSION#/${RUNTIME_VERSION}/#" < basic_tests/expectations.json.in > basic_tests/expectations.json
  python3 basic_tests.py basic_tests/expectations.json
else
  python3 "${SUITE}"_tests.py
fi;