File: datasource_cgroup-name-mid.sh

package info (click to toggle)
snoopy 2.5.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,016 kB
  • sloc: ansic: 7,169; sh: 4,514; makefile: 1,095
file content (31 lines) | stat: -rwxr-xr-x 764 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
#!/bin/bash



### Configure shell and bootstrap
#
set -e
set -u
. `dirname $BASH_SOURCE`/_bootstrap.sh



### Verify the environment
#
if [ ! -f /proc/self/cgroup ]; then
    snoopy_testResult_skip "File /proc/self/cgroup does not exist"
fi

if ! grep -E '^[0-9]:[^,:]+,[^,:]+,[^:]+:' /proc/self/cgroup > /dev/null; then
    snoopy_testResult_skip "Cgroup with more than two controllers does not exist"
fi



### Evaluate
#
CONTROLLER_NAME=`cat /proc/self/cgroup | grep -E '^[0-9]:[^,:]+,[^,:]+,[^:]+:' | head -n1 | cut -d: -f2 | cut -d, -f2`
VAL_EXPECTED=`cat /proc/self/cgroup | grep -E "^[0-9]:[^,:]+,$CONTROLLER_NAME," | head -n1`
VAL_SNOOPY=`$SNOOPY_TEST_CLI run datasource cgroup "$CONTROLLER_NAME"`

snoopy_test_compareValues "$VAL_SNOOPY" "$VAL_EXPECTED"