Bug 1873359 - Allow snap refresh failure r=jcristau
[gecko.git] / taskcluster / docker / snap-coreXX-build / snap-tests / tests.sh
blob8b509e15e87b89ad11c40bc4081522ed4c6d6eb4
1 #!/bin/bash
3 set -ex
5 pwd
7 ARTIFACT_DIR=$TASKCLUSTER_ROOT_DIR/builds/worker/artifacts/
8 mkdir -p "$ARTIFACT_DIR"
10 # There's a bug in snapd ~2.60.3-2.61 that will make "snap refresh" fail
11 # https://bugzilla.mozilla.org/show_bug.cgi?id=1873359
12 # https://bugs.launchpad.net/snapd/+bug/2048104/comments/13
14 # So we retrieve the version and we will allow the first "snap refresh" to
15 # fail for versions < 2.61.1
16 SNAP_VERSION=$(snap info snapd --color=never --unicode=never |grep "installed:" | awk '{ print $2 }')
17 SNAP_MAJOR=$(echo "${SNAP_VERSION}" | cut -d'.' -f1)
18 SNAP_MINOR=$(echo "${SNAP_VERSION}" | cut -d'.' -f2)
19 SNAP_RELEASE=$(echo "${SNAP_VERSION}" | cut -d'.' -f3)
21 REFRESH_CAN_FAIL=true
22 if [ "${SNAP_MAJOR}" -ge 2 ]; then
23 if [ "${SNAP_MAJOR}" -gt 2 ]; then
24 REFRESH_CAN_FAIL=false
25 else
26 if [ "${SNAP_MINOR}" -ge 61 ]; then
27 if [ "${SNAP_MINOR}" -gt 61 ]; then
28 REFRESH_CAN_FAIL=false
29 else
30 if [ "${SNAP_RELEASE}" -gt 0 ]; then
31 REFRESH_CAN_FAIL=false
38 if [ "${REFRESH_CAN_FAIL}" = "true" ]; then
39 sudo snap refresh || true
40 else
41 sudo snap refresh
42 fi;
44 sudo snap refresh --hold=24h firefox
46 sudo snap install --name firefox --dangerous ./firefox.snap
48 RUNTIME_VERSION=$(snap run firefox --version | awk '{ print $3 }')
50 python3 -m pip install --user -r requirements.txt
52 sed -e "s/#RUNTIME_VERSION#/${RUNTIME_VERSION}/#" < expectations.json.in > expectations.json
54 python3 basic_tests.py expectations.json
56 cp ./*.png "$ARTIFACT_DIR/"