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,505 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 dvb interface works.

details: |
    The dvb interface allows access to all DVB (Digital Video Broadcasting) devices and APIs.

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

    "$TESTSTOOLS"/fs-state mock-dir /dev/dvb/adapter9
    "$TESTSTOOLS"/fs-state mock-file /dev/dvb/adapter9/video9
    "$TESTSTOOLS"/fs-state mock-file /run/udev/data/c212:9

restore: |
    # Delete the created device files and restore backed up files
    "$TESTSTOOLS"/fs-state restore-file /run/udev/data/c212:9
    "$TESTSTOOLS"/fs-state restore-file /dev/dvb/adapter9/video9
    "$TESTSTOOLS"/fs-state restore-dir /dev/dvb/adapter9

execute: |
    echo "The interface is not connected by default"
    snap interfaces -i dvb | MATCH -- '- +test-snapd-sh:dvb'

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

    echo "Then the snap is able to access the device input"
    test-snapd-sh.with-dvb-plug -c "echo test >> /dev/dvb/adapter9/video9"
    test-snapd-sh.with-dvb-plug -c "cat /run/udev/data/c212:9"

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

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

    echo "Then the snap is not able to read the input device"
    if test-snapd-sh.with-dvb-plug -c 'cat /dev/dvb/adapter9/video9' 2>call.error; then
        echo "Expected permission error accessing to input device"
        exit 1
    fi
    MATCH "Permission denied" < call.error