Renato Botelho do Couto | ead1e53 | 2019-10-31 13:31:07 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Klement Sekera | 3747c75 | 2017-04-10 06:30:17 +0200 | [diff] [blame] | 2 | |
3 | from __future__ import print_function | ||||
Klement Sekera | 909a6a1 | 2017-08-08 04:33:53 +0200 | [diff] [blame] | 4 | from multiprocessing import Pipe |
Paul Vinciguerra | c701e57 | 2019-12-19 16:09:43 -0500 | [diff] [blame] | 5 | import sys |
Klement Sekera | 45a95dd | 2019-11-05 11:18:25 +0000 | [diff] [blame] | 6 | import os |
Paul Vinciguerra | 496b0de | 2019-06-20 12:24:12 -0400 | [diff] [blame] | 7 | from framework import VppDiedError, VppTestCase, KeepAliveReporter |
Klement Sekera | 3747c75 | 2017-04-10 06:30:17 +0200 | [diff] [blame] | 8 | |
9 | |||||
10 | class SanityTestCase(VppTestCase): | ||||
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 11 | """Sanity test case - verify whether VPP is able to start""" |
12 | |||||
Klement Sekera | 558ceab | 2021-04-08 19:37:41 +0200 | [diff] [blame] | 13 | cpus = [0] |
Klement Sekera | 3747c75 | 2017-04-10 06:30:17 +0200 | [diff] [blame] | 14 | |
Paul Vinciguerra | c701e57 | 2019-12-19 16:09:43 -0500 | [diff] [blame] | 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 | |||||
Klement Sekera | 45a95dd | 2019-11-05 11:18:25 +0000 | [diff] [blame] | 27 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 28 | def main(): |
Klement Sekera | 3747c75 | 2017-04-10 06:30:17 +0200 | [diff] [blame] | 29 | rc = 0 |
30 | tc = SanityTestCase | ||||
Klement Sekera | 909a6a1 | 2017-08-08 04:33:53 +0200 | [diff] [blame] | 31 | x, y = Pipe() |
32 | reporter = KeepAliveReporter() | ||||
33 | reporter.pipe = y | ||||
Klement Sekera | 3747c75 | 2017-04-10 06:30:17 +0200 | [diff] [blame] | 34 | try: |
35 | tc.setUpClass() | ||||
36 | except VppDiedError: | ||||
37 | rc = -1 | ||||
38 | else: | ||||
39 | try: | ||||
40 | tc.tearDownClass() | ||||
Paul Vinciguerra | c701e57 | 2019-12-19 16:09:43 -0500 | [diff] [blame] | 41 | except Exception: |
42 | rc = -1 | ||||
Klement Sekera | 909a6a1 | 2017-08-08 04:33:53 +0200 | [diff] [blame] | 43 | x.close() |
44 | y.close() | ||||
Klement Sekera | 3747c75 | 2017-04-10 06:30:17 +0200 | [diff] [blame] | 45 | |
juraj.linkes | abec012 | 2018-11-16 17:28:56 +0100 | [diff] [blame] | 46 | if rc == 0: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 47 | print("Sanity test case passed.") |
juraj.linkes | abec012 | 2018-11-16 17:28:56 +0100 | [diff] [blame] | 48 | else: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 49 | print("Sanity test case failed.") |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 50 | return rc |
juraj.linkes | abec012 | 2018-11-16 17:28:56 +0100 | [diff] [blame] | 51 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 52 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 53 | if __name__ == "__main__": |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 54 | sys.exit(main()) |