Skip to content
Snippets Groups Projects
Commit f9522b30 authored by lantz's avatar lantz
Browse files

Merge pull request #394 from cdburkard/patches/cpu_test

continue to test cfs if rt is not enabled in kernel
parents ec26c749 54bd9e61
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
from mininet.node import CPULimitedHost from mininet.node import CPULimitedHost
from mininet.topolib import TreeTopo from mininet.topolib import TreeTopo
from mininet.util import custom from mininet.util import custom
from mininet.log import setLogLevel, output from mininet.log import setLogLevel, output, info
from time import sleep from time import sleep
...@@ -38,7 +38,11 @@ def bwtest( cpuLimits, period_us=100000, seconds=5 ): ...@@ -38,7 +38,11 @@ def bwtest( cpuLimits, period_us=100000, seconds=5 ):
host = custom( CPULimitedHost, sched=sched, host = custom( CPULimitedHost, sched=sched,
period_us=period_us, period_us=period_us,
cpu=cpu ) cpu=cpu )
net = Mininet( topo=topo, host=host ) try:
net = Mininet( topo=topo, host=host )
except:
info( '*** Skipping host %s\n' % sched )
break
net.start() net.start()
net.pingAll() net.pingAll()
hosts = [ net.getNodeByName( h ) for h in topo.hosts() ] hosts = [ net.getNodeByName( h ) for h in topo.hosts() ]
......
...@@ -2,6 +2,17 @@ ...@@ -2,6 +2,17 @@
""" """
Test for cpu.py Test for cpu.py
results format:
sched cpu client MB/s
cfs 45.00% 13254.669841
cfs 40.00% 11822.441399
cfs 30.00% 5112.963009
cfs 20.00% 3449.090009
cfs 10.00% 2271.741564
""" """
import unittest import unittest
...@@ -16,8 +27,9 @@ class testCPU( unittest.TestCase ): ...@@ -16,8 +27,9 @@ class testCPU( unittest.TestCase ):
def testCPU( self ): def testCPU( self ):
"Verify that CPU utilization is monotonically decreasing for each scheduler" "Verify that CPU utilization is monotonically decreasing for each scheduler"
p = pexpect.spawn( 'python -m mininet.examples.cpu' ) p = pexpect.spawn( 'python -m mininet.examples.cpu' )
# matches each line from results( shown above )
opts = [ '([a-z]+)\t([\d\.]+)%\t([\d\.]+)', opts = [ '([a-z]+)\t([\d\.]+)%\t([\d\.]+)',
'please enable RT_GROUP_SCHED', pexpect.EOF ] pexpect.EOF ]
scheds = [] scheds = []
while True: while True:
index = p.expect( opts, timeout=600 ) index = p.expect( opts, timeout=600 )
...@@ -27,11 +39,9 @@ def testCPU( self ): ...@@ -27,11 +39,9 @@ def testCPU( self ):
bw = float( p.match.group( 3 ) ) bw = float( p.match.group( 3 ) )
if sched not in scheds: if sched not in scheds:
scheds.append( sched ) scheds.append( sched )
previous_bw = 10 ** 4 # 10 GB/s else:
self.assertTrue( bw < previous_bw ) self.assertTrue( bw < previous_bw )
previous_bw = bw previous_bw = bw
elif index == 1:
self.skipTest( 'please enable RT_GROUP_SCHED' )
else: else:
break break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment