4 ## Copyright (c) 2020 Intel Corporation
6 ## Licensed under the Apache License, Version 2.0 (the "License");
7 ## you may not use this file except in compliance with the License.
8 ## You may obtain a copy of the License at
10 ## http://www.apache.org/licenses/LICENSE-2.0
12 ## Unless required by applicable law or agreed to in writing, software
13 ## distributed under the License is distributed on an "AS IS" BASIS,
14 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ## See the License for the specific language governing permissions and
16 ## limitations under the License.
19 # pylint: disable=missing-docstring
26 from xtesting.core import testcase
27 from runrapid import RapidTestManager
28 from rapid_cli import RapidCli
29 from rapid_log import RapidLog
31 class RapidXt(testcase.TestCase):
33 def run(self, **kwargs):
35 test_params = RapidTestManager.get_defaults()
37 test_params[key] = kwargs[key]
38 os.makedirs(self.res_dir, exist_ok=True)
39 log_file = '{}/RUN{}.{}.log'.format(self.res_dir,
40 test_params['environment_file'], test_params['test_file'])
41 RapidLog.log_init(log_file, test_params['loglevel'],
42 test_params['screenloglevel'] , test_params['version'] )
43 test_manager = RapidTestManager()
44 self.start_time = time.time()
45 self.result, self.details = test_manager.run_tests(test_params)
46 self.result = 100 * self.result
47 RapidLog.info('Test result is : {}'.format(self.result))
48 self.stop_time = time.time()
49 except Exception: # pylint: disable=broad-except
50 print("Unexpected error:", sys.exc_info()[0])
52 self.stop_time = time.time()