File: task.yaml

package info (click to toggle)
snapd 2.71-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,536 kB
  • sloc: ansic: 16,114; sh: 16,105; python: 9,941; makefile: 1,890; exp: 190; awk: 40; xml: 22
file content (50 lines) | stat: -rw-r--r-- 1,681 bytes parent folder | download | duplicates (2)
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
50
summary: Check that the tmp.size settings work

details: |
  Check that snapd allows to modify the size of /tmp through the 'tmp.size'
  config. Verify also the unset of the config gets things back to defaults  

environment:
  MOUNTCFG_FILE: /etc/systemd/system/tmp.mount.d/override.conf

prepare: |
  if [ -f "$MOUNTCFG_FILE" ]; then
      echo "tmpfs configuration file already present, testbed not clean"
      exit 1
  fi

restore: |
    rm -f "$MOUNTCFG_FILE"

execute: |
  echo "Ensure tmp.size is not set initially"
  test ! -f "$MOUNTCFG_FILE"
  if snap get system tmp.size; then
      echo "Error: tmp.size is unexpectedly set"
      exit 1
  fi
  def_size=$(df --output=size /tmp | tail -1)
  
  echo "Ensure setting tmp.size works"
  for size in 100 200; do
      snap set system tmp.size="$size"M
      snap get system tmp.size | MATCH "$size"M
      df -h --output=size /tmp | MATCH "$size"M
      grep '^tmpfs /tmp' /proc/mounts | MATCH nosuid,nodev
      MATCH "Options=mode=1777,strictatime,nosuid,nodev,size=${size}M" "$MOUNTCFG_FILE"
      # Check that systemd is happy with the generated override.conf
      systemctl daemon-reload
  done

  echo "Unsetting gets things back to defaults"
  snap unset system tmp.size
  if snap get system tmp.size; then
      echo "Error: tmp.size is unexpectedly set"
      exit 1
  fi
  test ! -f "$MOUNTCFG_FILE"
  cur_size=$(df --output=size /tmp | tail -1)
  # For some odd reason, resizing to the default can have a difference with the
  # old one of one page (4k), at least in GCE, so we take that into account.
  test "$cur_size" -le $((def_size + 4)) && test "$cur_size" -ge $((def_size - 4))
  systemctl daemon-reload