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 test_params['resultsdir'] = self.res_dir
40 _, test_file_name = os.path.split(test_params['test_file'])
41 _, environment_file_name = os.path.split(
42 test_params['environment_file'])
43 log_file = '{}/RUN{}.{}.log'.format(self.res_dir,
44 environment_file_name, test_file)
45 RapidLog.log_init(log_file, test_params['loglevel'],
46 test_params['screenloglevel'] , test_params['version'] )
47 test_manager = RapidTestManager()
48 self.start_time = time.time()
49 self.result, self.details = test_manager.run_tests(test_params)
50 self.stop_time = time.time()
53 except Exception: # pylint: disable=broad-except
54 print("Unexpected error:", sys.exc_info()[0])
56 self.stop_time = time.time()