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 (49 lines) | stat: -rw-r--r-- 1,613 bytes parent folder | download | duplicates (3)
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
summary: Ensure that the framebuffer interface works.

details: |
    The framebuffer interface allows to access the /dev/fb* buffer files.

    The test uses the test-snapd-framebuffer snap to write/read from /dev/fb0.

    The test also checks the interface connection and disconnection works properly.

prepare: |
    "$TESTSTOOLS"/snaps-state install-local test-snapd-framebuffer

execute: |
    echo "The plug is not connected by default"
    snap interfaces -i framebuffer | MATCH '^- +test-snapd-framebuffer:framebuffer'

    if [ ! -e /dev/fb0 ]; then
        # ensure this test runs on at least one system
        if [[ "$SPREAD_SYSTEM" = ubuntu-core-16-arm-* ]]; then
            echo "ubuntu-core-16-arm-32 must have a framebuffer"
            exit 1
        fi
        echo "SKIP: Framebuffer not available on /dev/fb0"
        exit 0
    fi

    echo "When the interface is connected"
    snap connect test-snapd-framebuffer:framebuffer

    echo "Then the snap is able to write in the framebuffer"
    test-snapd-framebuffer.write "123"
    MATCH "123" < /dev/fb0

    echo "Then the snap is able to read from the framebuffer"
    test-snapd-framebuffer.read

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

    echo "When the plug is disconnected"
    snap disconnect test-snapd-framebuffer:framebuffer

    echo "Then the snap is not able to access the framebuffer"
    if test-snapd-framebuffer.write "123" 2> call.error; then
        echo "Expected permission error trying to write the framebuffer"
        exit 1
    fi
    MATCH "Permission denied" < call.error