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 (49 lines) | stat: -rw-r--r-- 1,628 bytes parent folder | download
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: Check that IIO device nodes are accessible through an interface

details: |
    This test makes sure that a snap using the IIO interface can access
    devices nodes exposed by a slot properly.

    It modifies the core snap to provide a iio slot. The actual iio device
    node is served as a plain file with static text content. The test expects
    that, after a snap declared a iio plug is installed and connected, it can
    access the node and read/write its content.

systems: [ubuntu-core-*-64]

prepare: |
    if [ "$TRUST_TEST_KEYS" = "false" ]; then
        echo "This test needs test keys to be trusted"
        exit
    fi

    # Mock IIO device node and give it some content we can verify
    # the test snap can read.
    echo "iio-0" > /dev/iio:device0

    echo "Given a snap declaring a plug on iio is installed"
    "$TESTSTOOLS"/snaps-state install-local iio-consumer

    echo "And the iio plug is connected"
    snap connect iio-consumer:iio core:iio0

restore: |
    if [ "$TRUST_TEST_KEYS" = "false" ]; then
        echo "This test needs test keys to be trusted"
        exit
    fi
    rm -f /dev/iio:device0

execute: |
    if [ "$TRUST_TEST_KEYS" = "false" ]; then
        echo "This test needs test keys to be trusted"
        exit
    fi

    echo "Checks the snap can read from the IIO device node"
    SNAP_MOUNT_DIR="$(os.paths snap-mount-dir)"
    test "$("$SNAP_MOUNT_DIR"/bin/iio-consumer.read)" = "iio-0"

    echo "Checks the snap can write to the IIO device node"
    "$SNAP_MOUNT_DIR"/bin/iio-consumer.write "hello"
    test "$("$SNAP_MOUNT_DIR"/bin/iio-consumer.read)" = "hello"