File: task.yaml

package info (click to toggle)
snapd 2.74.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 81,428 kB
  • sloc: sh: 16,966; ansic: 16,788; python: 11,332; makefile: 1,897; exp: 190; awk: 58; xml: 22
file content (40 lines) | stat: -rw-r--r-- 1,377 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
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]

skip:
    - reason: This test needs test keys to be trusted
      if: |
        [ "$TRUST_TEST_KEYS" = "false" ]

prepare: |
    # 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: |
    rm -f /dev/iio:device0

execute: |
    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"