]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
ftests/009: Use the controller list from consts
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Sun, 2 Jun 2024 15:11:48 +0000 (20:41 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Tue, 11 Jun 2024 14:58:16 +0000 (08:58 -0600)
Use consts.EXPECTED_CPU_OUT_* lists, instead of local EXPECTED_OUT_*
lists. This removes maintaining of duplicate controller output lists.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Jun 02 15:20:50
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        --------------------------------------------------
        setup                                         0.00
        009-cgget-g_flag_controller_only.py           0.04
        teardown                                      0.00
        --------------------------------------------------
        Total Run Time                                0.04

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

index e734b745c72764aa8d6024d9d150cdc5bd3543ce..5301e77da01d968d59437042d523a23595605a2e 100755 (executable)
@@ -15,131 +15,7 @@ import os
 
 CONTROLLER = 'cpu'
 CGNAME = '009cgget'
-
-EXPECTED_OUT_V1 = [
-    '''009cgget:
-    cpu.cfs_period_us: 100000
-    cpu.stat: nr_periods 0
-            nr_throttled 0
-            throttled_time 0
-    cpu.shares: 1024
-    cpu.cfs_quota_us: -1
-    cpu.uclamp.min: 0.00
-    cpu.uclamp.max: max''',
-    # cfs_bandwidth without cpu.stat nr_busts, burst_time
-    '''009cgget:
-    cpu.cfs_burst_us: 0
-    cpu.cfs_period_us: 100000
-    cpu.stat: nr_periods 0
-            nr_throttled 0
-            throttled_time 0
-    cpu.shares: 1024
-    cpu.idle: 0
-    cpu.cfs_quota_us: -1
-    cpu.uclamp.min: 0.00
-    cpu.uclamp.max: max''',
-    # cfs_bandwidth with cpu.stat nr_busts, burst_time
-    '''009cgget:
-    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 = [
-    '''009cgget:
-    cpu.weight: 100
-    cpu.stat: usage_usec 0
-            user_usec 0
-            system_usec 0
-            nr_periods 0
-            nr_throttled 0
-            throttled_usec 0
-    cpu.weight.nice: 0
-    cpu.pressure: some avg10=0.00 avg60=0.00 avg300=0.00 total=0
-    cpu.max: max 100000
-    cpu.uclamp.min: 0.00
-    cpu.uclamp.max: max''',
-    # with PSI
-    '''009cgget:
-    cpu.weight: 100
-    cpu.stat: usage_usec 0
-            user_usec 0
-            system_usec 0
-            nr_periods 0
-            nr_throttled 0
-            throttled_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.max: max 100000
-    cpu.uclamp.min: 0.00
-    cpu.uclamp.max: max''',
-    # with PSI, cfs_bandwidth without cpu.stat nr_busts, burst_time
-    '''009cgget:
-    cpu.weight: 100
-    cpu.stat: usage_usec 0
-            user_usec 0
-            system_usec 0
-            nr_periods 0
-            nr_throttled 0
-            throttled_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''',
-    # with PSI, cfs_bandwidth with cpu.stat nr_busts, burst_time
-    '''009cgget:
-    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''',
-    # with PSI, cfs_bandwidth with cpu.stat nr_busts, burst_time, force_idle
-    '''009cgget:
-    cpu.weight: 100
-    cpu.stat: usage_usec 0
-            user_usec 0
-            system_usec 0
-            core_sched.force_idle_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'''
-]
+OUT_PREFIX = '009cgget:\n'
 
 
 def prereqs(config):
@@ -154,8 +30,10 @@ def test(config):
     result = consts.TEST_PASSED
     cause = None
 
-    out = Cgroup.get(config, controller=CONTROLLER, cgname=CGNAME)
+    EXPECTED_OUT_V1 = [OUT_PREFIX + expected_out for expected_out in consts.EXPECTED_CPU_OUT_V1]
+    EXPECTED_OUT_V2 = [OUT_PREFIX + expected_out for expected_out in consts.EXPECTED_CPU_OUT_V2]
 
+    out = Cgroup.get(config, controller=CONTROLLER, cgname=CGNAME)
     version = CgroupVersion.get_version(CONTROLLER)
 
     if version == CgroupVersion.CGROUP_V1: