File: concurrent.sh

package info (click to toggle)
incus 6.0.5-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,092 kB
  • sloc: sh: 16,313; ansic: 3,121; python: 457; makefile: 337; ruby: 51; sql: 50; lisp: 6
file content (33 lines) | stat: -rw-r--r-- 769 bytes parent folder | download | duplicates (5)
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
test_concurrent() {
    if [ -z "${INCUS_CONCURRENT:-}" ]; then
        echo "==> SKIP: INCUS_CONCURRENT isn't set"
        return
    fi

    ensure_import_testimage

    spawn_container() {
        set -e

        name=concurrent-${1}

        incus launch testimage "${name}"
        incus info "${name}" | grep RUNNING
        echo abc | incus exec "${name}" -- cat | grep abc
        incus stop "${name}" --force
        incus delete "${name}"
    }

    PIDS=""

    for id in $(seq $(($(find /sys/bus/cpu/devices/ -type l | wc -l) * 8))); do
        spawn_container "${id}" 2>&1 | tee "${INCUS_DIR}/incus-${id}.out" &
        PIDS="${PIDS} $!"
    done

    for pid in ${PIDS}; do
        wait "${pid}"
    done

    ! incus list | grep -q concurrent || false
}