tests: replace pycodestyle with black
[vpp.git] / test / sanity_run_vpp.py
1 #!/usr/bin/env python3
2
3 from __future__ import print_function
4 from multiprocessing import Pipe
5 import sys
6 import os
7 from framework import VppDiedError, VppTestCase, KeepAliveReporter
8
9
10 class SanityTestCase(VppTestCase):
11     """Sanity test case - verify whether VPP is able to start"""
12
13     cpus = [0]
14
15     # don't ask to debug SanityTestCase
16     @classmethod
17     def wait_for_enter(cls, pid=0):
18         pass
19
20     @classmethod
21     def _debug_quit(cls):
22         try:
23             cls.vpp.poll()
24         except AttributeError:
25             pass
26
27
28 def main():
29     rc = 0
30     tc = SanityTestCase
31     x, y = Pipe()
32     reporter = KeepAliveReporter()
33     reporter.pipe = y
34     try:
35         tc.setUpClass()
36     except VppDiedError:
37         rc = -1
38     else:
39         try:
40             tc.tearDownClass()
41         except Exception:
42             rc = -1
43     x.close()
44     y.close()
45
46     if rc == 0:
47         print("Sanity test case passed.")
48     else:
49         print("Sanity test case failed.")
50     return rc
51
52
53 if __name__ == "__main__":
54     sys.exit(main())