blob: 47431021db58d88d94608c322fdf979edf48f469 [file] [log] [blame]
Renato Botelho do Coutoead1e532019-10-31 13:31:07 -05001#!/usr/bin/env python3
Klement Sekera3747c752017-04-10 06:30:17 +02002
3from __future__ import print_function
Klement Sekera909a6a12017-08-08 04:33:53 +02004from multiprocessing import Pipe
Paul Vinciguerrac701e572019-12-19 16:09:43 -05005import sys
Dave Wallace8800f732023-08-31 00:47:44 -04006from asfframework import VppDiedError, VppAsfTestCase, KeepAliveReporter
Klement Sekera3747c752017-04-10 06:30:17 +02007
8
Dave Wallace8800f732023-08-31 00:47:44 -04009class SanityTestCase(VppAsfTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020010 """Sanity test case - verify whether VPP is able to start"""
11
Klement Sekera558ceab2021-04-08 19:37:41 +020012 cpus = [0]
Klement Sekera3747c752017-04-10 06:30:17 +020013
Paul Vinciguerrac701e572019-12-19 16:09:43 -050014 # 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
Klement Sekera45a95dd2019-11-05 11:18:25 +000026
Klement Sekerab23ffd72021-05-31 16:08:53 +020027def main():
Klement Sekera3747c752017-04-10 06:30:17 +020028 rc = 0
29 tc = SanityTestCase
Klement Sekera909a6a12017-08-08 04:33:53 +020030 x, y = Pipe()
31 reporter = KeepAliveReporter()
32 reporter.pipe = y
Klement Sekera3747c752017-04-10 06:30:17 +020033 try:
34 tc.setUpClass()
35 except VppDiedError:
36 rc = -1
37 else:
38 try:
39 tc.tearDownClass()
Paul Vinciguerrac701e572019-12-19 16:09:43 -050040 except Exception:
41 rc = -1
Klement Sekera909a6a12017-08-08 04:33:53 +020042 x.close()
43 y.close()
Klement Sekera3747c752017-04-10 06:30:17 +020044
juraj.linkesabec0122018-11-16 17:28:56 +010045 if rc == 0:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020046 print("Sanity test case passed.")
juraj.linkesabec0122018-11-16 17:28:56 +010047 else:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020048 print("Sanity test case failed.")
Klement Sekerab23ffd72021-05-31 16:08:53 +020049 return rc
juraj.linkesabec0122018-11-16 17:28:56 +010050
Klement Sekerab23ffd72021-05-31 16:08:53 +020051
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020052if __name__ == "__main__":
Klement Sekerab23ffd72021-05-31 16:08:53 +020053 sys.exit(main())