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 (28 lines) | stat: -rw-r--r-- 1,029 bytes parent folder | download | duplicates (4)
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
summary: The media directory propagates events outwards

details: |
    The /media directory is special in that mount events propagate outward from
    the mount namespace used by snap applications into the main mount namespace.
    Fedora and other systems that build udisks without --enable-fhs-media flag
    use /run/media path instead.

prepare: |
    "$TESTSTOOLS"/snaps-state install-local test-snapd-tools --devmode
    MEDIA_DIR="$(os.paths media-dir)"
    mkdir -p "${MEDIA_DIR}/src"
    mkdir -p "${MEDIA_DIR}/dst"
    touch "${MEDIA_DIR}/src/canary"

restore: |
    # If this doesn't work maybe it is because the test didn't execute correctly
    MEDIA_DIR="$(os.paths media-dir)"
    umount "${MEDIA_DIR}/dst" || true
    rm -f "${MEDIA_DIR}/src/canary"
    rmdir "${MEDIA_DIR}/src"
    rmdir "${MEDIA_DIR}/dst"

execute: |
    MEDIA_DIR="$(os.paths media-dir)"
    test ! -e "${MEDIA_DIR}/dst/canary"
    test-snapd-tools.cmd mount --bind "${MEDIA_DIR}/src" "${MEDIA_DIR}/dst"
    test -e "${MEDIA_DIR}/dst/canary"