MCPcopy Create free account
hub / github.com/FDio/vpp / setUpClass

Method setUpClass

test/asf/asfframework.py:632–736  ·  view source on GitHub ↗

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

(cls)

Source from the content-addressed store, hash-verified

630
631 @classmethod
632 def setUpClass(cls):
633 """
634 Perform class setup before running the testcase
635 Remove shared memory files, start vpp and connect the vpp-api
636 """
637 super(VppAsfTestCase, cls).setUpClass()
638 cls.logger = get_logger(cls.__name__)
639 cls.logger.debug(f"--- START setUpClass() {cls.__name__} ---")
640 random.seed(config.rnd_seed)
641 if hasattr(cls, "parallel_handler"):
642 cls.logger.addHandler(cls.parallel_handler)
643 cls.logger.propagate = False
644 cls.set_debug_flags(config.debug)
645 cls.tempdir = cls.get_tempdir()
646 cls.create_file_handler()
647 cls.file_handler.setFormatter(
648 Formatter(fmt="%(asctime)s,%(msecs)03d %(message)s", datefmt="%H:%M:%S")
649 )
650 cls.file_handler.setLevel(DEBUG)
651 cls.logger.addHandler(cls.file_handler)
652 cls.logger.debug("--- setUpClass() for %s called ---" % cls.__name__)
653 os.chdir(cls.tempdir)
654 cls.logger.info(
655 "Temporary dir is %s, api socket is %s",
656 cls.tempdir,
657 cls.get_api_sock_path(),
658 )
659 cls.logger.debug("Random seed is %s", config.rnd_seed)
660 cls.setUpConstants()
661 cls.verbose = 0
662 cls.vpp_dead = False
663 cls.registry = VppObjectRegistry()
664 cls.vpp_startup_failed = False
665 cls.reporter = KeepAliveReporter()
666 # need to catch exceptions here because if we raise, then the cleanup
667 # doesn't get called and we might end with a zombie vpp
668 try:
669 if cls.debug_attach:
670 cls.attach_vpp()
671 else:
672 cls.run_vpp()
673 cls.reporter.send_keep_alive(cls, "setUpClass")
674 VppTestResult.current_test_case_info = TestCaseInfo(
675 cls.logger, cls.tempdir, cls.vpp.pid, config.vpp
676 )
677 cls.vpp_stdout_deque = deque()
678 cls.vpp_stderr_deque = deque()
679 if not cls.debug_attach:
680 cls.pump_thread_stop_flag = Event()
681 cls.pump_thread_wakeup_pipe = os.pipe()
682 cls.pump_thread = Thread(target=pump_output, args=(cls,))
683 cls.pump_thread.daemon = True
684 cls.pump_thread.start()
685 if cls.debug_gdb or cls.debug_gdbserver or cls.debug_attach:
686 cls.vapi_response_timeout = 0
687 cls.vapi = VppPapiProvider(cls.__name__, cls, cls.vapi_response_timeout)
688 if cls.step:
689 hook = hookmodule.StepHook(cls)

Callers

nothing calls this directly

Calls 15

poll_vppMethod · 0.95
get_loggerFunction · 0.90
VppObjectRegistryClass · 0.90
VppPapiProviderClass · 0.90
VPPStatsClass · 0.90
colorizeFunction · 0.90
EventClass · 0.85
printFunction · 0.85
register_hookMethod · 0.80
KeepAliveReporterClass · 0.70
TestCaseInfoClass · 0.70
set_debug_flagsMethod · 0.45

Tested by

no test coverage detected