File: task.yaml

package info (click to toggle)
snapd 2.71-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,536 kB
  • sloc: ansic: 16,114; sh: 16,105; python: 9,941; makefile: 1,890; exp: 190; awk: 40; xml: 22
file content (45 lines) | stat: -rw-r--r-- 1,879 bytes parent folder | download | duplicates (2)
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
summary: Check that snap model works

details: |
  Check that the information returned by `snap model` matches the device's
  model and serial assertions.

execute: |
  knownCmdAssertion=$(snap known model)
  modelCmdAssertion=$(snap model --assertion)
  echo "Check that model assertion from \"snap known\" matches \"snap model\""
  if [ "$modelCmdAssertion" != "$knownCmdAssertion" ]; then
    echo "model assertions not the same, difference is:"
    diff -u <(echo "$modelCmdAssertion") <(echo "$knownCmdAssertion")
    exit 1
  fi

  knownCmdAssertion=$(snap known serial)
  modelCmdAssertion=$(snap model --serial --assertion)
  echo "Check that serial assertion from \"snap known\" matches \"snap model\""
  if [ "$modelCmdAssertion" != "$knownCmdAssertion" ]; then
    echo "serial assertions not the same, difference is:"
    diff -u <(echo "$modelCmdAssertion") <(echo "$knownCmdAssertion")
    exit 1
  fi

  modelCmdSerial="$(snap model --serial | grep -Po "serial:\s+\K(.*)")"
  knownCmdSerial="$(snap known serial | grep -Po "serial:\s+\K(.*)")"
  echo "Check that serial from \"snap known\" matches \"snap model\""
  if [ "$modelCmdSerial" != "$knownCmdSerial" ]; then
    echo "serial numbers not the same, difference is:"
    diff -u <(echo "$modelCmdSerial") <(echo "$knownCmdSerial")
    exit 1
  fi

  # the model may have a display-name so `snap model` output will be different, 
  # so use `snap model --verbose` which will not show the display-name alongside
  # the model
  modelCmdModel="$(snap model --verbose | grep -Po "model:\s+\K(.*)")"
  knownCmdModel="$(snap known model | grep -Po "model:\s+\K(.*)")"
  echo "Check that model from \"snap known\" matches \"snap model\""
  if [ "$modelCmdModel" != "$knownCmdModel" ]; then
    echo "models not the same, difference is:"
    diff -u <(echo "$knownCmdModel") <(echo "$modelCmdModel")
    exit 1
  fi