File: task.yaml

package info (click to toggle)
snapd 2.72-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,412 kB
  • sloc: sh: 16,506; ansic: 16,211; python: 11,213; makefile: 1,919; exp: 190; awk: 58; xml: 22
file content (50 lines) | stat: -rw-r--r-- 2,045 bytes parent folder | download
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
summary: Check that snap model works

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

execute: |
  echo "Wait for device initialization to be done"
  #shellcheck source=tests/lib/core-config.sh
  . "$TESTSLIB"/core-config.sh
  wait_for_device_initialized_change

  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