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 (46 lines) | stat: -rw-r--r-- 1,716 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
summary: Ensure that the nvidia-drivers-support interface works.

details: |
    The nvidia-drivers-support interface allows a snap to create character devices

    A snap which has access to the nvidia-drivers-support must be shown
    in the interfaces list. The plug must not be connected on install
    and, as usual, must be able to be reconnected.

    A snap declaring a plug on this interface must be able to create
    /dev/nvidiactl.

prepare: |
    echo "Given a snap declaring a plug on the nvidia-drivers-support interface is installed"
    "$TESTSTOOLS"/snaps-state install-local test-snapd-nvidia-drivers-support

execute: |
    echo "The interface is not connected by default"
    snap interfaces -i nvidia-drivers-support | MATCH '^- +test-snapd-nvidia-drivers-support:nvidia-drivers-support'

    echo "When the plug is connected"
    snap connect test-snapd-nvidia-drivers-support:nvidia-drivers-support

    echo "Then the snap is able to create chardevice"
    test-snapd-nvidia-drivers-support.check 2>hw.error
    if MATCH "Permission denied" < hw.error; then
        echo "Permission error when using mknod"
        exit 1
    fi

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

    echo "When the plug is disconnected"
    snap disconnect test-snapd-nvidia-drivers-support:nvidia-drivers-support

    echo "Then the snap is not able to create chardevice"
    if test-snapd-nvidia-drivers-support.check 2>hw.error; then
        echo "Expected permission error when using mknod"
        exit 1
    fi
    MATCH "Permission denied" < hw.error

    echo "And the snap is able to reconnect"
    snap connect test-snapd-nvidia-drivers-support:nvidia-drivers-support