13af6ab5fSopenharmony_ci#!/usr/bin/env python3 23af6ab5fSopenharmony_ci# -*- coding: utf-8 -*- 33af6ab5fSopenharmony_ci 43af6ab5fSopenharmony_ci""" 53af6ab5fSopenharmony_ciCopyright (c) 2022 Huawei Device Co., Ltd. 63af6ab5fSopenharmony_ciLicensed under the Apache License, Version 2.0 (the "License"); 73af6ab5fSopenharmony_ciyou may not use this file except in compliance with the License. 83af6ab5fSopenharmony_ciYou may obtain a copy of the License at 93af6ab5fSopenharmony_ci 103af6ab5fSopenharmony_ci http://www.apache.org/licenses/LICENSE-2.0 113af6ab5fSopenharmony_ci 123af6ab5fSopenharmony_ciUnless required by applicable law or agreed to in writing, software 133af6ab5fSopenharmony_cidistributed under the License is distributed on an "AS IS" BASIS, 143af6ab5fSopenharmony_ciWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 153af6ab5fSopenharmony_ciSee the License for the specific language governing permissions and 163af6ab5fSopenharmony_cilimitations under the License. 173af6ab5fSopenharmony_ci 183af6ab5fSopenharmony_ciDescription: Use ark to execute test 262 test suite 193af6ab5fSopenharmony_ci""" 203af6ab5fSopenharmony_ci 213af6ab5fSopenharmony_ciimport os 223af6ab5fSopenharmony_ciimport subprocess 233af6ab5fSopenharmony_ciimport argparse 243af6ab5fSopenharmony_ciimport datetime 253af6ab5fSopenharmony_ciimport sys 263af6ab5fSopenharmony_ciimport shutil 273af6ab5fSopenharmony_ciimport json 283af6ab5fSopenharmony_cifrom glob import glob 293af6ab5fSopenharmony_cifrom utils import * 303af6ab5fSopenharmony_cifrom config import * 313af6ab5fSopenharmony_ci 323af6ab5fSopenharmony_ci 333af6ab5fSopenharmony_ciclass MyException(Exception): 343af6ab5fSopenharmony_ci def __init__(self, name): 353af6ab5fSopenharmony_ci self.name = name 363af6ab5fSopenharmony_ci 373af6ab5fSopenharmony_ci 383af6ab5fSopenharmony_cidef parse_args(): 393af6ab5fSopenharmony_ci parser = argparse.ArgumentParser() 403af6ab5fSopenharmony_ci parser.add_argument('--testinstype', action='store_true', dest='testinstype', default=False, help="ins type test") 413af6ab5fSopenharmony_ci parser.add_argument('--dir', metavar='DIR', help="Directory to test") 423af6ab5fSopenharmony_ci parser.add_argument('--file', metavar='FILE', help="File to test") 433af6ab5fSopenharmony_ci parser.add_argument( 443af6ab5fSopenharmony_ci '--ark_frontend_tool', 453af6ab5fSopenharmony_ci help="ark frontend conversion tool") 463af6ab5fSopenharmony_ci arguments = parser.parse_args() 473af6ab5fSopenharmony_ci return arguments 483af6ab5fSopenharmony_ci 493af6ab5fSopenharmony_ci 503af6ab5fSopenharmony_cidef skip(filepath, flag=False): 513af6ab5fSopenharmony_ci with open(SKIP_FILE_PATH, 'r') as read_skip: 523af6ab5fSopenharmony_ci sk_content = read_skip.read() 533af6ab5fSopenharmony_ci skip_test = json.loads(sk_content) 543af6ab5fSopenharmony_ci skip_test_list = skip_test['error.txt'] + skip_test['no2015'] + skip_test['tsc_error'] + \ 553af6ab5fSopenharmony_ci skip_test['import_skip'] + \ 563af6ab5fSopenharmony_ci skip_test['code_rule'] + skip_test['no_case'] + skip_test['not_supported_by_4.2.3'] 573af6ab5fSopenharmony_ci if os.path.isfile(filepath): 583af6ab5fSopenharmony_ci if filepath.endswith('.ts'): 593af6ab5fSopenharmony_ci if filepath not in skip_test_list: 603af6ab5fSopenharmony_ci return True 613af6ab5fSopenharmony_ci else: 623af6ab5fSopenharmony_ci if flag: 633af6ab5fSopenharmony_ci print( 643af6ab5fSopenharmony_ci f'This file is outside the scope of validation : {filepath}\n') 653af6ab5fSopenharmony_ci return False 663af6ab5fSopenharmony_ci 673af6ab5fSopenharmony_ci 683af6ab5fSopenharmony_cidef abc_judge(filepath): 693af6ab5fSopenharmony_ci if not os.path.getsize(filepath): 703af6ab5fSopenharmony_ci print(f'Error : {filepath}.The file is empty') 713af6ab5fSopenharmony_ci 723af6ab5fSopenharmony_ci 733af6ab5fSopenharmony_cidef run_test(file, tool, flag=False): 743af6ab5fSopenharmony_ci path_list = file.split(os.sep) 753af6ab5fSopenharmony_ci if path_list[0] != '.': 763af6ab5fSopenharmony_ci file = "." + os.sep + file 773af6ab5fSopenharmony_ci out_file_path = file.replace(TEST_PATH, OUT_PATH).replace(TS_EXT, TXT_EXT) 783af6ab5fSopenharmony_ci temp_out_file_path = file.replace(TS_EXT, TXT_EXT) 793af6ab5fSopenharmony_ci temp_abc_file_path = file.replace(TS_EXT, ABC_EXT) 803af6ab5fSopenharmony_ci ts_list = temp_out_file_path.split(os.sep) 813af6ab5fSopenharmony_ci ts_list.pop(-1) 823af6ab5fSopenharmony_ci ts_dir_path = os.sep.join(ts_list) 833af6ab5fSopenharmony_ci path_list = out_file_path.split(os.sep) 843af6ab5fSopenharmony_ci path_list.pop(-1) 853af6ab5fSopenharmony_ci out_dir_path = os.sep.join(path_list) 863af6ab5fSopenharmony_ci if not os.path.exists(out_dir_path): 873af6ab5fSopenharmony_ci os.makedirs(out_dir_path) 883af6ab5fSopenharmony_ci try: 893af6ab5fSopenharmony_ci if file in IMPORT_TEST['import'] + IMPORT_TEST['m_parameter']: 903af6ab5fSopenharmony_ci command_os(['node', '--expose-gc', tool, '-m', file, '--output-type']) 913af6ab5fSopenharmony_ci else: 923af6ab5fSopenharmony_ci command_os(['node', '--expose-gc', tool, file, '--output-type']) 933af6ab5fSopenharmony_ci except BaseException as e: 943af6ab5fSopenharmony_ci print(e) 953af6ab5fSopenharmony_ci if flag: 963af6ab5fSopenharmony_ci for root, dirs, files in os.walk(ts_dir_path): 973af6ab5fSopenharmony_ci for fi in files: 983af6ab5fSopenharmony_ci ts_file = f'{root}/{fi}' 993af6ab5fSopenharmony_ci if ABC_EXT in ts_file: 1003af6ab5fSopenharmony_ci remove_file(ts_file) 1013af6ab5fSopenharmony_ci elif TXT_EXT in ts_file: 1023af6ab5fSopenharmony_ci sj_path = ts_file.replace(TEST_PATH, OUT_PATH) 1033af6ab5fSopenharmony_ci move_file(ts_file, sj_path) 1043af6ab5fSopenharmony_ci else: 1053af6ab5fSopenharmony_ci if os.path.exists(temp_abc_file_path): 1063af6ab5fSopenharmony_ci abc_judge(temp_abc_file_path) 1073af6ab5fSopenharmony_ci remove_file(temp_abc_file_path) 1083af6ab5fSopenharmony_ci if os.path.exists(temp_out_file_path): 1093af6ab5fSopenharmony_ci move_file(temp_out_file_path, out_file_path) 1103af6ab5fSopenharmony_ci 1113af6ab5fSopenharmony_ci 1123af6ab5fSopenharmony_cidef run_test_machine(args): 1133af6ab5fSopenharmony_ci ark_frontend_tool = DEFAULT_ARK_FRONTEND_TOOL 1143af6ab5fSopenharmony_ci result_path = [] 1153af6ab5fSopenharmony_ci if args.ark_frontend_tool: 1163af6ab5fSopenharmony_ci ark_frontend_tool = args.ark_frontend_tool 1173af6ab5fSopenharmony_ci 1183af6ab5fSopenharmony_ci if args.file: 1193af6ab5fSopenharmony_ci if skip(args.file, True): 1203af6ab5fSopenharmony_ci if args.file in IMPORT_TEST['import']: 1213af6ab5fSopenharmony_ci run_test(args.file, ark_frontend_tool, True) 1223af6ab5fSopenharmony_ci result = compare(args.file, True) 1233af6ab5fSopenharmony_ci result_path.append(result) 1243af6ab5fSopenharmony_ci else: 1253af6ab5fSopenharmony_ci run_test(args.file, ark_frontend_tool) 1263af6ab5fSopenharmony_ci result = compare(args.file) 1273af6ab5fSopenharmony_ci result_path.append(result) 1283af6ab5fSopenharmony_ci 1293af6ab5fSopenharmony_ci elif args.dir: 1303af6ab5fSopenharmony_ci for root, dirs, files in os.walk(args.dir): 1313af6ab5fSopenharmony_ci for file in files: 1323af6ab5fSopenharmony_ci test_path = f'{root}/{file}' 1333af6ab5fSopenharmony_ci if skip(test_path, True): 1343af6ab5fSopenharmony_ci if test_path in IMPORT_TEST['import']: 1353af6ab5fSopenharmony_ci run_test(test_path, ark_frontend_tool, True) 1363af6ab5fSopenharmony_ci result = compare(test_path, True) 1373af6ab5fSopenharmony_ci result_path.append(result) 1383af6ab5fSopenharmony_ci else: 1393af6ab5fSopenharmony_ci run_test(test_path, ark_frontend_tool) 1403af6ab5fSopenharmony_ci result = compare(test_path) 1413af6ab5fSopenharmony_ci result_path.append(result) 1423af6ab5fSopenharmony_ci 1433af6ab5fSopenharmony_ci elif args.file is None and args.dir is None: 1443af6ab5fSopenharmony_ci for root, dirs, files in os.walk(TS_CASES_DIR): 1453af6ab5fSopenharmony_ci for file in files: 1463af6ab5fSopenharmony_ci test_path = f'{root}/{file}' 1473af6ab5fSopenharmony_ci if skip(test_path): 1483af6ab5fSopenharmony_ci if test_path in IMPORT_TEST['import']: 1493af6ab5fSopenharmony_ci run_test(test_path, ark_frontend_tool, True) 1503af6ab5fSopenharmony_ci result = compare(test_path, True) 1513af6ab5fSopenharmony_ci result_path.append(result) 1523af6ab5fSopenharmony_ci else: 1533af6ab5fSopenharmony_ci run_test(test_path, ark_frontend_tool) 1543af6ab5fSopenharmony_ci result = compare(test_path) 1553af6ab5fSopenharmony_ci result_path.append(result) 1563af6ab5fSopenharmony_ci with open(OUT_RESULT_FILE, 'w') as read_out_result: 1573af6ab5fSopenharmony_ci read_out_result.writelines(result_path) 1583af6ab5fSopenharmony_ci 1593af6ab5fSopenharmony_ci 1603af6ab5fSopenharmony_cidef read_out_file(file_path): 1613af6ab5fSopenharmony_ci with open(file_path, 'r') as read_file_path: 1623af6ab5fSopenharmony_ci out_content = read_file_path.read() 1633af6ab5fSopenharmony_ci if out_content: 1643af6ab5fSopenharmony_ci if '}\n{' in out_content: 1653af6ab5fSopenharmony_ci out_list = out_content.split('}\n{') 1663af6ab5fSopenharmony_ci else: 1673af6ab5fSopenharmony_ci out_list = [] 1683af6ab5fSopenharmony_ci out_list.append(''.join(out_content.split('\n'))) 1693af6ab5fSopenharmony_ci else: 1703af6ab5fSopenharmony_ci out_list = [] 1713af6ab5fSopenharmony_ci out_text_list = [] 1723af6ab5fSopenharmony_ci if len(out_list) > 1: 1733af6ab5fSopenharmony_ci for i in range(len(out_list)): 1743af6ab5fSopenharmony_ci if i == 0: 1753af6ab5fSopenharmony_ci out_do = ''.join(out_list[i].split('\n')).strip(' ') + '}' 1763af6ab5fSopenharmony_ci elif i == (len(out_list) - 1): 1773af6ab5fSopenharmony_ci out_do = '{' + ''.join(out_list[i].split('\n')).strip(' ') 1783af6ab5fSopenharmony_ci else: 1793af6ab5fSopenharmony_ci out_do = ( 1803af6ab5fSopenharmony_ci '{' + 1813af6ab5fSopenharmony_ci ''.join( 1823af6ab5fSopenharmony_ci out_list[i].split('\n')).strip(' ') + 1833af6ab5fSopenharmony_ci '}') 1843af6ab5fSopenharmony_ci out_txt = json.loads(out_do) 1853af6ab5fSopenharmony_ci out_text_list.append(out_txt) 1863af6ab5fSopenharmony_ci else: 1873af6ab5fSopenharmony_ci for i in range(len(out_list)): 1883af6ab5fSopenharmony_ci c = json.loads(out_list[i]) 1893af6ab5fSopenharmony_ci out_text_list.append(c) 1903af6ab5fSopenharmony_ci return out_text_list 1913af6ab5fSopenharmony_ci 1923af6ab5fSopenharmony_ci 1933af6ab5fSopenharmony_cidef compare(file, flag=False): 1943af6ab5fSopenharmony_ci result = "" 1953af6ab5fSopenharmony_ci path_list = file.split(os.sep) 1963af6ab5fSopenharmony_ci if path_list[0] != '.': 1973af6ab5fSopenharmony_ci file = "." + os.sep + file 1983af6ab5fSopenharmony_ci out_path = file.replace(TEST_PATH, OUT_PATH).replace(TS_EXT, TXT_EXT) 1993af6ab5fSopenharmony_ci expect_path = file.replace(TEST_PATH, EXPECT_PATH).replace(TS_EXT, TXT_EXT) 2003af6ab5fSopenharmony_ci if flag: 2013af6ab5fSopenharmony_ci path_list = out_path.split(os.sep) 2023af6ab5fSopenharmony_ci del path_list[-1] 2033af6ab5fSopenharmony_ci out_dir_path = os.sep.join(path_list) 2043af6ab5fSopenharmony_ci for root, dirs, files in os.walk(out_dir_path): 2053af6ab5fSopenharmony_ci for fi in files: 2063af6ab5fSopenharmony_ci fi = f'{root}/{fi}' 2073af6ab5fSopenharmony_ci if fi != out_path: 2083af6ab5fSopenharmony_ci with open(fi, 'r') as read_out_txt: 2093af6ab5fSopenharmony_ci el_file_txt = read_out_txt.read() 2103af6ab5fSopenharmony_ci write_append(out_path, el_file_txt) 2113af6ab5fSopenharmony_ci remove_file(fi) 2123af6ab5fSopenharmony_ci if (not os.path.exists(out_path) or not os.path.exists(expect_path)): 2133af6ab5fSopenharmony_ci print("There are no expected files or validation file generation: %s", file) 2143af6ab5fSopenharmony_ci result = f'FAIL {file}\n' 2153af6ab5fSopenharmony_ci else: 2163af6ab5fSopenharmony_ci outcont = read_out_file(out_path) 2173af6ab5fSopenharmony_ci expectcont = read_file(expect_path) 2183af6ab5fSopenharmony_ci expectcontlist = [] 2193af6ab5fSopenharmony_ci for i in expectcont: 2203af6ab5fSopenharmony_ci i = json.loads(i.replace("'", '"').replace('\n', '')) 2213af6ab5fSopenharmony_ci expectcontlist.append(i) 2223af6ab5fSopenharmony_ci if outcont == expectcontlist: 2233af6ab5fSopenharmony_ci result = f'PASS {file}\n' 2243af6ab5fSopenharmony_ci else: 2253af6ab5fSopenharmony_ci result = f'FAIL {file}\n' 2263af6ab5fSopenharmony_ci print(result) 2273af6ab5fSopenharmony_ci return result 2283af6ab5fSopenharmony_ci 2293af6ab5fSopenharmony_ci 2303af6ab5fSopenharmony_cidef summary(): 2313af6ab5fSopenharmony_ci if not os.path.exists(OUT_RESULT_FILE): 2323af6ab5fSopenharmony_ci return 1 2333af6ab5fSopenharmony_ci count = -1 2343af6ab5fSopenharmony_ci fail_count = 0 2353af6ab5fSopenharmony_ci with open(OUT_RESULT_FILE, 'r') as read_outfile: 2363af6ab5fSopenharmony_ci for count, line in enumerate(read_outfile): 2373af6ab5fSopenharmony_ci if line.startswith("FAIL"): 2383af6ab5fSopenharmony_ci fail_count += 1 2393af6ab5fSopenharmony_ci pass 2403af6ab5fSopenharmony_ci count += 1 2413af6ab5fSopenharmony_ci 2423af6ab5fSopenharmony_ci print("\n Regression summary") 2433af6ab5fSopenharmony_ci print("===============================") 2443af6ab5fSopenharmony_ci print(" Total %5d " % (count)) 2453af6ab5fSopenharmony_ci print("-------------------------------") 2463af6ab5fSopenharmony_ci print(" Passed tests: %5d " % (count - fail_count)) 2473af6ab5fSopenharmony_ci print(" Failed tests: %5d " % (fail_count)) 2483af6ab5fSopenharmony_ci print("===============================") 2493af6ab5fSopenharmony_ci 2503af6ab5fSopenharmony_ci return 0 if fail_count == 0 else 1 2513af6ab5fSopenharmony_ci 2523af6ab5fSopenharmony_ci 2533af6ab5fSopenharmony_cidef init_path(): 2543af6ab5fSopenharmony_ci remove_dir(OUT_TEST_DIR) 2553af6ab5fSopenharmony_ci mk_dir(OUT_TEST_DIR) 2563af6ab5fSopenharmony_ci 2573af6ab5fSopenharmony_ci 2583af6ab5fSopenharmony_cidef prepare_ts_code(): 2593af6ab5fSopenharmony_ci if (os.path.exists(TS_CASES_DIR)): 2603af6ab5fSopenharmony_ci return 2613af6ab5fSopenharmony_ci try: 2623af6ab5fSopenharmony_ci mk_dir(TS_CASES_DIR) 2633af6ab5fSopenharmony_ci os.chdir('./testTs/test') 2643af6ab5fSopenharmony_ci command_os(['git', 'init']) 2653af6ab5fSopenharmony_ci command_os(['git', 'remote', 'add', 'origin', TS_GIT_PATH]) 2663af6ab5fSopenharmony_ci command_os(['git', 'config', 'core.sparsecheckout', 'true']) 2673af6ab5fSopenharmony_ci with os.fdopen(os.open('.git/info/sparse-checkout', os.O_APPEND|os.O_CREAT|os.O_WRONLY)) as outf: 2683af6ab5fSopenharmony_ci subprocess.Popen(['echo', "tests/cases/conformance/"], stdout=outf) 2693af6ab5fSopenharmony_ci command_os(['git', 'pull', '--depth', '1', 'origin', TS_TAG]) 2703af6ab5fSopenharmony_ci if not os.path.exists("./tests/cases/conformance/"): 2713af6ab5fSopenharmony_ci remove_dir(TS_CASES_DIR) 2723af6ab5fSopenharmony_ci raise MyException( 2733af6ab5fSopenharmony_ci "Pull TypeScript Code Fail, Please Check The Network Request") 2743af6ab5fSopenharmony_ci command_os(['git', 'apply', '../test-case.patch']) 2753af6ab5fSopenharmony_ci command_os(['cp', '-r', './tests/cases/conformance/.', './']) 2763af6ab5fSopenharmony_ci command_os(['rm', '-rf', './tests']) 2773af6ab5fSopenharmony_ci command_os(['rm', '-rf', '.git']) 2783af6ab5fSopenharmony_ci os.chdir('../../') 2793af6ab5fSopenharmony_ci except BaseException: 2803af6ab5fSopenharmony_ci print("pull test code fail") 2813af6ab5fSopenharmony_ci 2823af6ab5fSopenharmony_ci 2833af6ab5fSopenharmony_cidef test_instype(args): 2843af6ab5fSopenharmony_ci # output path for abc file generation 2853af6ab5fSopenharmony_ci outpath = os.path.join(OUT_TEST_DIR, 'instype') 2863af6ab5fSopenharmony_ci mk_dir(outpath) 2873af6ab5fSopenharmony_ci 2883af6ab5fSopenharmony_ci # source ts files 2893af6ab5fSopenharmony_ci files = glob(os.path.join(CUR_FILE_DIR, './instype/*.ts')); 2903af6ab5fSopenharmony_ci ark_frontend_tool = DEFAULT_ARK_FRONTEND_TOOL 2913af6ab5fSopenharmony_ci if args.ark_frontend_tool: 2923af6ab5fSopenharmony_ci ark_frontend_tool = args.ark_frontend_tool 2933af6ab5fSopenharmony_ci 2943af6ab5fSopenharmony_ci fail_list = [] 2953af6ab5fSopenharmony_ci for file in files: 2963af6ab5fSopenharmony_ci abc_file = os.path.abspath(os.path.join(outpath, '%s.abc' % os.path.splitext(os.path.basename(file))[0])) 2973af6ab5fSopenharmony_ci cmd = ['node', '--expose-gc', ark_frontend_tool, os.path.abspath(file), 2983af6ab5fSopenharmony_ci '--modules', '--display-typeinfo', '-o', abc_file]; 2993af6ab5fSopenharmony_ci process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 3003af6ab5fSopenharmony_ci try: 3013af6ab5fSopenharmony_ci out, err = process.communicate(timeout=10) 3023af6ab5fSopenharmony_ci except subprocess.TimeoutExpired: 3033af6ab5fSopenharmony_ci process.kill() 3043af6ab5fSopenharmony_ci fail_list.append(file) 3053af6ab5fSopenharmony_ci print("TIMEOUT:", " ".join(cmd)) 3063af6ab5fSopenharmony_ci continue 3073af6ab5fSopenharmony_ci output = out.decode("utf-8", errors="ignore") + err.decode("utf-8", errors="ignore") 3083af6ab5fSopenharmony_ci 3093af6ab5fSopenharmony_ci expected_file = "%s-expected.txt" % (os.path.splitext(file)[0]) 3103af6ab5fSopenharmony_ci expected = "" 3113af6ab5fSopenharmony_ci try: 3123af6ab5fSopenharmony_ci with open(expected_file, 'r') as expected_fp: 3133af6ab5fSopenharmony_ci expected = expected_fp.read() 3143af6ab5fSopenharmony_ci passed = expected == output 3153af6ab5fSopenharmony_ci except Exception: 3163af6ab5fSopenharmony_ci passed = False 3173af6ab5fSopenharmony_ci if not passed: 3183af6ab5fSopenharmony_ci fail_list.append(file) 3193af6ab5fSopenharmony_ci print("FAILED:", " ".join(cmd)) 3203af6ab5fSopenharmony_ci print("output:") 3213af6ab5fSopenharmony_ci print(output) 3223af6ab5fSopenharmony_ci print("expected:") 3233af6ab5fSopenharmony_ci print(expected) 3243af6ab5fSopenharmony_ci 3253af6ab5fSopenharmony_ci print("Summary:") 3263af6ab5fSopenharmony_ci print("\033[37mTotal: %5d" % (len(files))) 3273af6ab5fSopenharmony_ci print("\033[92mPassed: %5d" % (len(files) - len(fail_list))) 3283af6ab5fSopenharmony_ci print("\033[91mFailed: %5d" % (len(fail_list))) 3293af6ab5fSopenharmony_ci print("\033[0m") 3303af6ab5fSopenharmony_ci 3313af6ab5fSopenharmony_ci return 0 if len(fail_list) == 0 else 1 3323af6ab5fSopenharmony_ci 3333af6ab5fSopenharmony_cidef main(args): 3343af6ab5fSopenharmony_ci try: 3353af6ab5fSopenharmony_ci init_path() 3363af6ab5fSopenharmony_ci if (args.testinstype): 3373af6ab5fSopenharmony_ci excuting_npm_install(args) 3383af6ab5fSopenharmony_ci return test_instype(args) 3393af6ab5fSopenharmony_ci else: 3403af6ab5fSopenharmony_ci excuting_npm_install(args) 3413af6ab5fSopenharmony_ci prepare_ts_code() 3423af6ab5fSopenharmony_ci run_test_machine(args) 3433af6ab5fSopenharmony_ci return summary() 3443af6ab5fSopenharmony_ci except BaseException: 3453af6ab5fSopenharmony_ci print("Run Python Script Fail") 3463af6ab5fSopenharmony_ci return 1 3473af6ab5fSopenharmony_ci 3483af6ab5fSopenharmony_ci 3493af6ab5fSopenharmony_ciif __name__ == "__main__": 3503af6ab5fSopenharmony_ci sys.exit(main(parse_args())) 351