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,551 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
summary: Ensure systemd environment generator works

details: Test that the snapd-env-generator works as expected

# systemd environment generators are only supported on 17.10+
systems: [ubuntu-18.04-*, ubuntu-19*, ubuntu-2*]

execute: |
    # integration test to ensure it works on the real system

    # FIXME: we can avoid the reboot once issue:
    #   https://github.com/systemd/systemd/issues/9972
    # is fixed
    echo "Ensure to reboot at least once"
    if [ "$SPREAD_REBOOT" = 0 ]; then
        REBOOT
    fi

    echo "Ensure PATH is correct in systemd system units"
    . /etc/os-release
    # ensure /usr/local/{,s}bin is still part of the PATH, LP: 1814355
    systemd-run --pty --wait '/usr/bin/env' | MATCH 'PATH=.*/local/.*'
    systemd-run --pty --wait '/usr/bin/env' > env.out
    # ensure PATH is updated (and check full PATH, see LP: #1814355)

    if os.query is-ubuntu-ge 24.04; then
      MATCH 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin' < env.out
    else
      MATCH 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin' < env.out
    fi

    # some unit tests
    SENV=/usr/lib/systemd/system-environment-generators/snapd-env-generator

    PATH=/bin:/sbin $SENV         | MATCH /bin:/sbin:/snap/bin
    PATH=/bin:/snap/bin/bar $SENV | MATCH /bin:/snap/bin/bar:/snap/bin

    echo "/snap/bin already part of the PATH should not generate output"
    [ -z "$(PATH=/bin:/snap/bin:/sbin $SENV)" ] || exit 1

    # regression test for LP: #1791691
    PATH="" $SENV | MATCH '^$'