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 (40 lines) | stat: -rw-r--r-- 1,382 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
summary: Ensure that the gpio physical memory control interface works.

details: |
    The gpio-memory-control interface allows read/write access to all gpio memory.

systems: [ubuntu-core-18-arm-32*]

prepare: |
    echo "Given the test-snapd-gpio-memory-control snap is installed"
    snap install test-snapd-gpio-memory-control

execute: |
    if ! [ -c /dev/gpiomem ]; then
        echo "The /dev/gpiomem device does not exist in current system"
        exit 0
    fi

    echo "The interface is not connected by default"
    #shellcheck disable=SC1117
    snap interfaces -i gpio-memory-control | MATCH '^- +test-snapd-gpio-memory-control:gpio-memory-control'

    echo "When the interface is connected"
    snap connect test-snapd-gpio-memory-control:gpio-memory-control

    echo "Then the snap is able read and write the physical memory"
    test-snapd-gpio-memory-control.gpiomem

    if [ "$(snap debug confinement)" = partial ] ; then
        exit 0
    fi

    echo "When the plug is disconnected"
    snap disconnect test-snapd-gpio-memory-control:gpio-memory-control

    echo "Then the snap is not able to access the gpio physical memory"
    if test-snapd-gpio-memory-control.gpiomem 2> call.error; then
        echo "Expected permission error reading the gpio physical memory with disconnected plug"
        exit 1
    fi
    MATCH "Permission denied" < call.error