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): | ||||
juraj.linkes | 185e649 | 2018-11-28 14:30:34 +0100 | [diff] [blame] | 11 | """ Sanity test case - verify whether VPP is able to start """ |
Klement Sekera | 558ceab | 2021-04-08 19:37:41 +0200 | [diff] [blame] | 12 | cpus = [0] |
Klement Sekera | 3747c75 | 2017-04-10 06:30:17 +0200 | [diff] [blame] | 13 | |
Paul Vinciguerra | c701e57 | 2019-12-19 16:09:43 -0500 | [diff] [blame] | 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 | |||||
Klement Sekera | 45a95dd | 2019-11-05 11:18:25 +0000 | [diff] [blame] | 26 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame^] | 27 | def main(): |
Klement Sekera | 3747c75 | 2017-04-10 06:30:17 +0200 | [diff] [blame] | 28 | rc = 0 |
29 | tc = SanityTestCase | ||||
Klement Sekera | 909a6a1 | 2017-08-08 04:33:53 +0200 | [diff] [blame] | 30 | x, y = Pipe() |
31 | reporter = KeepAliveReporter() | ||||
32 | reporter.pipe = y | ||||
Klement Sekera | 3747c75 | 2017-04-10 06:30:17 +0200 | [diff] [blame] | 33 | try: |
34 | tc.setUpClass() | ||||
35 | except VppDiedError: | ||||
36 | rc = -1 | ||||
37 | else: | ||||
38 | try: | ||||
39 | tc.tearDownClass() | ||||
Paul Vinciguerra | c701e57 | 2019-12-19 16:09:43 -0500 | [diff] [blame] | 40 | except Exception: |
41 | rc = -1 | ||||
Klement Sekera | 909a6a1 | 2017-08-08 04:33:53 +0200 | [diff] [blame] | 42 | x.close() |
43 | y.close() | ||||
Klement Sekera | 3747c75 | 2017-04-10 06:30:17 +0200 | [diff] [blame] | 44 | |
juraj.linkes | abec012 | 2018-11-16 17:28:56 +0100 | [diff] [blame] | 45 | if rc == 0: |
Klement Sekera | e263685 | 2021-03-16 12:52:12 +0100 | [diff] [blame] | 46 | print('Sanity test case passed.') |
juraj.linkes | abec012 | 2018-11-16 17:28:56 +0100 | [diff] [blame] | 47 | else: |
Klement Sekera | e263685 | 2021-03-16 12:52:12 +0100 | [diff] [blame] | 48 | print('Sanity test case failed.') |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame^] | 49 | return rc |
juraj.linkes | abec012 | 2018-11-16 17:28:56 +0100 | [diff] [blame] | 50 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame^] | 51 | |
52 | if __name__ == '__main__': | ||||
53 | sys.exit(main()) |