Bazel系列-bazel test 使用https(二)

xctestrunner rules
logic_test_util.py

RunLogicTestOnSim方法新增 is_use_https=False 參數(shù)`
然后代碼中, 指定架構(gòu)打開(kāi)模擬器

def RunLogicTestOnSim(sim_id,
                      test_bundle_path,
                      env_vars=None,
                      args=None,
                      tests_to_run=None,
                      is_use_https=False,
                      os_version=None,):

// 原實(shí)現(xiàn)

if is_use_https == "True":
    sim_list = os.popen('xcrun simctl list')
    content = sim_list.read()
    simulator_id_arr = re.findall(r"iPhone 13 [(](.*?)[)] [(].*?[)]",content)
    simulator_state_arr = re.findall(r"iPhone 13 [(].*?[)] [(](.*?)[)]",content)

    print("simulator_id_arr:",simulator_id_arr)
    print("simulator_state_arr:",simulator_state_arr)

    simulator_id = simulator_id_arr[0] if len(simulator_id_arr) else ""
    simulator_state = simulator_state_arr[0] if len(simulator_state_arr) else "unknow"

    print("simulator_state:",simulator_state)
    print("simulator_id",simulator_id)
    print("sim:",sim_id)
    if simulator_id == "":
      simulator_id = sim_id
    if simulator_state == "Shutdown":
      os.system("xcrun simctl boot %s"%(simulator_id))

    command = [
        'xcrun', 'simctl', 'spawn','-a','x86_64', simulator_id,
        xcode_info_util.GetXctestToolPath(ios_constants.SDK.IPHONESIMULATOR)]
    if args:
      command += args
    if not tests_to_run:
      tests_to_run_str = 'All'
    else:
      tests_to_run_str = ','.join(tests_to_run)

    return_code = subprocess.Popen(
        command + ['-XCTest', tests_to_run_str, test_bundle_path],
        env=simctl_env_vars, stdout=sys.stdout, stderr=subprocess.STDOUT).communicate()[0]

    if return_code != None:
      return runner_exit_codes.EXITCODE.FAILED
    return runner_exit_codes.EXITCODE.SUCCEEDED

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容