blob: 5e2b3c1f92becc8cf2b4874ab0129231442b9df9 [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
Klement Sekera45a95dd2019-11-05 11:18:25 +00006import os
Paul Vinciguerra496b0de2019-06-20 12:24:12 -04007from framework import VppDiedError, VppTestCase, KeepAliveReporter
Klement Sekera3747c752017-04-10 06:30:17 +02008
9
10class SanityTestCase(VppTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020011 """Sanity test case - verify whether VPP is able to start"""
12
Klement Sekera558ceab2021-04-08 19:37:41 +020013 cpus = [0]
Klement Sekera3747c752017-04-10 06:30:17 +020014
Paul Vinciguerrac701e572019-12-19 16:09:43 -050015 # 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
Klement Sekera45a95dd2019-11-05 11:18:25 +000027
Klement Sekerab23ffd72021-05-31 16:08:53 +020028def main():
Klement Sekera3747c752017-04-10 06:30:17 +020029 rc = 0
30 tc = SanityTestCase
Klement Sekera909a6a12017-08-08 04:33:53 +020031 x, y = Pipe()
32 reporter = KeepAliveReporter()
33 reporter.pipe = y
Klement Sekera3747c752017-04-10 06:30:17 +020034 try:
35 tc.setUpClass()
36 except VppDiedError:
37 rc = -1
38 else:
39 try:
40 tc.tearDownClass()
Paul Vinciguerrac701e572019-12-19 16:09:43 -050041 except Exception:
42 rc = -1
Klement Sekera909a6a12017-08-08 04:33:53 +020043 x.close()
44 y.close()
Klement Sekera3747c752017-04-10 06:30:17 +020045
juraj.linkesabec0122018-11-16 17:28:56 +010046 if rc == 0:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020047 print("Sanity test case passed.")
juraj.linkesabec0122018-11-16 17:28:56 +010048 else:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020049 print("Sanity test case failed.")
Klement Sekerab23ffd72021-05-31 16:08:53 +020050 return rc
juraj.linkesabec0122018-11-16 17:28:56 +010051
Klement Sekerab23ffd72021-05-31 16:08:53 +020052
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020053if __name__ == "__main__":
Klement Sekerab23ffd72021-05-31 16:08:53 +020054 sys.exit(main())