]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
test-013: add support for newer cpu.* output
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Mon, 25 Apr 2022 06:50:55 +0000 (12:20 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 29 Apr 2022 15:16:11 +0000 (09:16 -0600)
With Ubuntu 5.17.4-051704-generic kernel, there are a few changes to the
the output of cgget -g cpu:<cgroup> provides for both cgroup V1 and V2:
cgroup V1:
----------
- new stat files cpu.cfs_burst_us. cpu.idle
- addition of nr_bursts, burst_time to cpu.stat file

cgroup V2:
----------
- new stat files cpu.idle, cpu.max.burst
- addition of nr_bursts, burst_time to cpu.stat file

adopt these changes while looking for expected out based on the cgroup
version.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/013-cgget-multiple_g_flags.py

index 4d1b69fad589c6ba62d133f288c9855efe462cf6..2117e051f0490d12be3dece01fd23ebc424a39ec 100755 (executable)
@@ -31,6 +31,24 @@ cpu.uclamp.min: 0.00
 cpu.uclamp.max: max
 '''
 
+EXPECTED_OUT_V1_CFS_BANDWIDTH = '''013cgget:
+pids.current: 0
+pids.events: max 0
+pids.max: max
+cpu.cfs_burst_us: 0
+cpu.cfs_period_us: 100000
+cpu.stat: nr_periods 0
+        nr_throttled 0
+        throttled_time 0
+        nr_bursts 0
+        burst_time 0
+cpu.shares: 1024
+cpu.idle: 0
+cpu.cfs_quota_us: -1
+cpu.uclamp.min: 0.00
+cpu.uclamp.max: max
+'''
+
 EXPECTED_OUT_V2 = '''013cgget:
 pids.current: 0
 pids.events: max 0
@@ -68,6 +86,29 @@ cpu.uclamp.min: 0.00
 cpu.uclamp.max: max
 '''
 
+EXPECTED_OUT_V2_PSI_CFS_BANDWIDTH = '''013cgget:
+pids.current: 0
+pids.events: max 0
+pids.max: max
+cpu.weight: 100
+cpu.stat: usage_usec 0
+        user_usec 0
+        system_usec 0
+        nr_periods 0
+        nr_throttled 0
+        throttled_usec 0
+        nr_bursts 0
+        burst_usec 0
+cpu.weight.nice: 0
+cpu.pressure: some avg10=0.00 avg60=0.00 avg300=0.00 total=0
+        full avg10=0.00 avg60=0.00 avg300=0.00 total=0
+cpu.idle: 0
+cpu.max.burst: 0
+cpu.max: max 100000
+cpu.uclamp.min: 0.00
+cpu.uclamp.max: max
+'''
+
 
 def prereqs(config):
     result = consts.TEST_PASSED
@@ -92,11 +133,18 @@ def test(config):
 
     if version == CgroupVersion.CGROUP_V1:
         expected_out = EXPECTED_OUT_V1
+
+        if len(out.splitlines()) != len(expected_out.splitlines()):
+            expected_out = EXPECTED_OUT_V1_CFS_BANDWIDTH
     elif version == CgroupVersion.CGROUP_V2:
         expected_out = EXPECTED_OUT_V2
+
         if len(out.splitlines()) != len(expected_out.splitlines()):
             expected_out = EXPECTED_OUT_V2_PSI
 
+            if len(out.splitlines()) != len(expected_out.splitlines()):
+                expected_out = EXPECTED_OUT_V2_PSI_CFS_BANDWIDTH
+
     if len(out.splitlines()) != len(expected_out.splitlines()):
         result = consts.TEST_FAILED
         cause = (