vlib: improvement to automatic core pinning
[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 from asfframework import VppDiedError, VppAsfTestCase, KeepAliveReporter
7
8
9 class SanityTestCase(VppAsfTestCase):
10     """Sanity test case - verify whether VPP is able to start"""
11
12     cpus = [0]
13
14     # don't ask to debug SanityTestCase
15     @classmethod
16     def wait_for_enter(cls, pid=0):
17         pass
18
19     @classmethod
20     def _debug_quit(cls):
21         try:
22             cls.vpp.poll()
23         except AttributeError:
24             pass
25
26
27 def main():
28     rc = 0
29     tc = SanityTestCase
30     x, y = Pipe()
31     reporter = KeepAliveReporter()
32     reporter.pipe = y
33     try:
34         tc.setUpClass()
35     except VppDiedError:
36         rc = -1
37     else:
38         try:
39             tc.tearDownClass()
40         except Exception:
41             rc = -1
42     x.close()
43     y.close()
44
45     if rc == 0:
46         print("Sanity test case passed.")
47     else:
48         print("Sanity test case failed.")
49     return rc
50
51
52 if __name__ == "__main__":
53     sys.exit(main())