
Introduce MAX_CPUS parameters to control maximum number of CPUs used by VPP(s) during testing, with default value 'auto' corresponding to all CPUs available. Calculate test CPU requirements by taking into account the number of workers, so a test requires 1 (main thread) + # of worker CPUs. When running tests, keep track of both running test jobs (controlled by TEST_JOBS parameter) and free CPUs. This then causes two limits in the system - to not exceed number of jobs in parallel but also to not exceed number of CPUs available. Skip tests which require more CPUs than are available in system (or more than MAX_CPUS) and print a warning message. Type: improvement Change-Id: Ib8fda54e4c6a36179d64160bb87fbd3a0011762d Signed-off-by: Klement Sekera <ksekera@cisco.com>
51 lines
1011 B
Python
51 lines
1011 B
Python
#!/usr/bin/env python3
|
|
|
|
from __future__ import print_function
|
|
from multiprocessing import Pipe
|
|
import sys
|
|
import os
|
|
from framework import VppDiedError, VppTestCase, KeepAliveReporter
|
|
|
|
|
|
class SanityTestCase(VppTestCase):
|
|
""" Sanity test case - verify whether VPP is able to start """
|
|
cpus = [0]
|
|
|
|
# don't ask to debug SanityTestCase
|
|
@classmethod
|
|
def wait_for_enter(cls, pid=0):
|
|
pass
|
|
|
|
@classmethod
|
|
def _debug_quit(cls):
|
|
try:
|
|
cls.vpp.poll()
|
|
except AttributeError:
|
|
pass
|
|
|
|
|
|
if __name__ == '__main__':
|
|
rc = 0
|
|
tc = SanityTestCase
|
|
x, y = Pipe()
|
|
reporter = KeepAliveReporter()
|
|
reporter.pipe = y
|
|
try:
|
|
tc.setUpClass()
|
|
except VppDiedError:
|
|
rc = -1
|
|
else:
|
|
try:
|
|
tc.tearDownClass()
|
|
except Exception:
|
|
rc = -1
|
|
x.close()
|
|
y.close()
|
|
|
|
if rc == 0:
|
|
print('Sanity test case passed.')
|
|
else:
|
|
print('Sanity test case failed.')
|
|
|
|
sys.exit(rc)
|