def test_build_commands(tmpdir, get_osp): testdir = tmpdir.mkdir("test") with cd(testdir.strpath): runcmd(["new", "--quick"]) app_path = os.path.join(getcwd(), "helloworld") runcmd(["build", "--path", app_path, "--toolchain", "gnu"]) runcmd([ "build", "--path", app_path, "--board", "emsk", "--bd_ver", "22", "--core", "arcem7d", "--toolchain", "gnu" ]) runcmd([ "build", "--path", app_path, "BOARD=emsk", "BD_VER=23", "CUR_CORE=arcem9d", "TOOLCHAIN=gnu", "elf" ]) runcmd([ "build", "--path", app_path, "-j", "4", "BOARD=emsk", "BD_VER=23", "CUR_CORE=arcem9d", "TOOLCHAIN=gnu", "elf" ]) app_path = "example/baremetal/secureshield/secret_normal" osp_class = osp.OSP() embarc_root = osp_class.get_path("new_osp") app_path = os.path.join(embarc_root, "example/baremetal/secureshield/secret_normal") runcmd([ "build", "--path", app_path, "--board", "iotdk", "--bd_ver", "10", "--core", "arcem9d", "--toolchain", "gnu" ])
def test_appconfig_commands(tmpdir, get_osp): testdir = tmpdir.mkdir("test") with cd(testdir.strpath): runcmd(["new", "--quick"]) app_path = os.path.join(getcwd(), "helloworld") runcmd(["appconfig", "--path", app_path]) runcmd(["appconfig", "--path", app_path, "--toolchain", "gnu"])
def result_excel_artifacts(osp_path): cache_path = get_cache(osp_path) files = os.listdir(cache_path) datas = dict() failed_summarize = None for file in files: filename, filesuffix = os.path.splitext(file) if not filesuffix == ".json" or filename == "results": continue file_path = os.path.join(cache_path, file) with open(file_path, "r") as f: results = json.load(f) for app, build_status in results.items(): for build_result in build_status: config = build_result.get("config", None) if config: toolchain_config = config["TOOLCHAIN"] + "_" + config[ "TOOLCHAIN_VER"] if not datas.get(toolchain_config, None): datas[toolchain_config] = [build_result] else: datas[toolchain_config].append(build_result) else: continue f.close() result_json_artifacts(osp_path, datas, file="results") with cd(cache_path): failed_summarize = dict_to_excel(datas) result_json_artifacts(osp_path, failed_summarize, file="failed_results")
def test_new_commands(tmpdir, get_osp): testdir = tmpdir.mkdir("test") with cd(testdir.strpath): runcmd([ "new", "--board", "emsk", "--bd_ver", "22", "--core", "arcem7d", "--toolchain", "gnu", "hello" ]) runcmd(["new", "--quick"])
def main(): options = parse_arguments() patches_required_roots = list() EMBARC_ROOT = os.path.abspath(options.embarc_root) if not os.path.exists(EMBARC_ROOT): print( "Please Specify the embARC_osp directory with --embarc-root option" ) return # sys.path.insert(0, os.path.join(EMBARC_ROOT, "scripts/")) for patch_root in options.patch_roots: patch_root = os.path.join(EMBARC_ROOT, patch_root) patch_root_list = get_patch_root(patch_root) if patch_root_list: patches_required_roots.extend(patch_root_list) for patch_root in patches_required_roots: with cd(patch_root): patch = Patch(patch_root) patch.patch()
def test_toolchain_commands(tmpdir): testdir = tmpdir.mkdir("test") with cd(testdir.strpath): runcmd(["config", "toolchain", "--version", "gnu"]) runcmd(["config", "toolchain", "--set", "gnu"])
expected_different[app_path]) print("There are {} projects, and they are compiled for {} times".format( len(examples), build_count)) all_results_list = copy.deepcopy(build_result_combine_tail(all_results)) show_results(all_results_list) expected_differents_list = build_result_combine_tail( apps_expected_different) show_results(expected_differents_list, expected=True) print("Generate JSON for every job") result_json_artifacts(BuildConfigs["osp_root"], apps_build_status) if not len(apps_expected_different) > 0: print("All the applications build as expected") else: print("these applications failed with some configuration: ") print(apps_expected_different.keys()) comment = "applications failed with some configuration: \n" + "\n".join( apps_expected_different.keys()) comment_on_pull_request(comment) sys.exit(1) if __name__ == '__main__': cwd_path = os.getcwd() osp_path = os.path.dirname(cwd_path) make_config = get_config(sys.argv[1:]) with cd(osp_path): main(make_config) print("The end")