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 (42 lines) | stat: -rw-r--r-- 1,337 bytes parent folder | download | duplicates (5)
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
summary: Ensure that the uhid interface works.

details: |
    The uhid interface allows accessing the UHID to create kernel hid devices

    The test-snapd-uhid snap is able to create and destroy a device on /dev/uhid.

    The test checks the snap is able to manage devices on /dev/uhid, the
    interface is not connected by default and it can be connected and disconnected.

prepare: |
    echo "Given the uhid snap is installed"
    snap install test-snapd-uhid

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

    echo "When the plug is connected"
    snap connect test-snapd-uhid:uhid

    echo "Exit when uhid is not supported, specially on cloud images"
    if [ ! -d /dev/uhid ]; then
        exit 0
    fi

    echo "Then the snap is able to create/destroy a device in /dev/uhid"
    test-snapd-uhid.test-device

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

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

    echo "Then the snap is not able to create/destroy a device on /dev/uhid"
    if test-snapd-uhid.test-device 2> call.error; then
        echo "Expected permission error calling uhid with disconnected plug"
        exit 1
    fi
    MATCH "Permission denied" < call.error