diff --git a/test/testsuite/android_maple.py b/test/testsuite/android_maple.py new file mode 100644 index 0000000000000000000000000000000000000000..476d579c063633ec3f442c940cd6deae1c8111bd --- /dev/null +++ b/test/testsuite/android_maple.py @@ -0,0 +1,384 @@ +#!/usr/bin/python3 +# -*- coding:utf-8 -*- +# +# Copyright (c) [2020] Huawei Technologies Co.,Ltd.All rights reserved. +# +# OpenArkCompiler is licensed under Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: +# +# http://license.coscl.org.cn/MulanPSL2 +# +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR +# FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. +# + +import argparse +import collections +import logging +import os +import subprocess +import time +import re +from functools import wraps + + +limitation = 0 +output_name = "" +input_name = "" +logger = logging.getLogger("COMPILE") +logger.setLevel(logging.DEBUG) +ch = logging.StreamHandler() +ch.setLevel(logging.DEBUG) +# create formatter and add it to the handlers +formatter = logging.Formatter("%(asctime)-18s - %(name)s - %(levelname)s - %(message)s") +ch.setFormatter(formatter) +# add the handlers to the logger +logger.addHandler(ch) + + +def timing(func): + # Decorator that reports the execution time. + @wraps(func) + def wrapper(*args, **kwargs): + start = time.time() + result = func(*args, **kwargs) + end = time.time() + logger.info("Time Consuming:" + str(end - start) + "s") + return result + + return wrapper + + +# exec the compile command +@timing +def build(cmd): + global limitation + run_cmd = " ".join(cmd) + logger.info(run_cmd) + com = subprocess.Popen(run_cmd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + shell=True, + cwd="./", + universal_newlines=True) + com_out, com_err = "", "" + try: + com_out, com_err = com.communicate(timeout=limitation) + if com_out is not None: + logger.debug(com_out) + if not com.returncode == 0: + logger.error(com_err) + exit(1) + except subprocess.TimeoutExpired as e: + com.kill() + logger.error(e) + exit(3) + except Exception as ee: + com.kill() + logger.error(ee) + exit(1) + return com_out, com_err, com.returncode + + +class MultiCompiler: + def __init__(self, name, in_suffix, out_suffix, options): + self._in_files_name = "" + self._out_file_name = "" + self._is_skipped = True + self._name = name + self._in_suffix = in_suffix + self._out_suffix = out_suffix + self._options = options + + def get_in_suffix(self): + return self._in_suffix + + def update_info(self, path, options): + if path is not None: + self._name = path + self._name + if options is not None: + self._options = self._options + " " + options + + def prepare(self, file_list): + temp_list = file_list.copy() + for in_file in temp_list: + name = in_file[0:-len(self._in_suffix)] + if in_file == name + self._in_suffix: + self._is_skipped = False + file_list.remove(in_file) + self._in_files_name = self._in_files_name + in_file + " " + self._out_file_name = name + self._out_suffix + file_list.append(self._out_file_name) + else: + continue + + def build(self): + if not self._is_skipped: + return build(self._gen_cmd()) + + def _gen_cmd(self): + cmd = [self._name] + cmd.extend(self._make_opts()) + cmd.extend(re.sub(r"\s+", " ", self._in_files_name).strip().split(" ")) + return cmd + + def _make_opts(self): + options = self._options.strip() + opts = [] + opts.append(options) + return opts + + +class Javac(MultiCompiler): + def prepare(self, file_list): + temp_list = file_list.copy() + for in_file in temp_list: + name = in_file[0:-len(self._in_suffix)] + if in_file == name + self._in_suffix: + self._is_skipped = False + file_list.remove(in_file) + self._in_files_name = self._in_files_name + in_file + " " + else: + continue + if not self._is_skipped: + self._out_file_name = "*.class" + file_list.append(self._out_file_name) + + +class Jar(MultiCompiler): + def prepare(self, file_list): + global output_name + temp_list = file_list.copy() + for in_file in temp_list: + name = in_file[0:-len(self._in_suffix)] + if in_file == name + self._in_suffix: + self._is_skipped = False + file_list.remove(in_file) + self._in_files_name = self._in_files_name + in_file + " " + else: + continue + # Use the first input file name as the output file name + if not self._is_skipped: + self._out_file_name = output_name.split("/")[-1].split(".")[0] + self._out_suffix + file_list.append(self._out_file_name) + + def _gen_cmd(self): + # Specify the output file name + cmd = [self._name] + cmd.extend(self._make_opts()) + cmd.extend(re.sub(r"\s+", " ", self._out_file_name).strip().split(" ")) + cmd.extend(re.sub(r"\s+", " ", self._in_files_name).strip().split(" ")) + return cmd + + +class SingleCompiler(MultiCompiler): + def prepare(self, file_list): + is_single = 0 + temp_list = file_list.copy() + for in_file in temp_list: + name = in_file[0:-len(self._in_suffix)] + if in_file == name + self._in_suffix: + self._is_skipped = False + is_single = is_single + 1 + if is_single > 1: + logger.error("Not support multi .jar") + exit(1) + file_list.remove(in_file) + self._in_files_name = in_file + self._out_file_name = name + self._out_suffix + file_list.append(self._out_file_name) + else: + continue + + +class Ld(MultiCompiler): + def _gen_cmd(self): + # Specify the output file name + cmd = [self._name] + cmd.extend(re.sub(r"\s+", " ", self._in_files_name).strip().split(" ")) + cmd.extend(self._make_opts()) + return cmd + + +# ------------------------------------------------------------------------ +# +# initial parser and parse the args +# Add parser arguments by tool chain components name +# +# ------------------------------------------------------------------------ +def do_init(components): + parser = argparse.ArgumentParser(prog="maple", usage="maple [options] ") + # choose toolchain target + parser.add_argument("-p", "--platform", dest="target", choices=["aarch64"], default="aarch64", + help="choose toolchain target, default is aarch64") + # Select compile phase + parser.add_argument("-s", "--stage", dest="stage", choices=["java2d8", "dex2mpl", "maple", "as", "ld"], default="ld", + help="Select the compiler stage, default is ld") + # set timeout limitation + parser.add_argument("--timeout", metavar="TIMEOUT", dest="timeout", default=None, type=int, + help="set the timeout limitation") + # set the output name + parser.add_argument("-o", metavar="OUTPUT", dest="output", default="", + help="set the output file name") + suffixes = set() + for name in components.keys(): + parser.add_argument("--" + name, metavar=name.upper(), + help="set the options for component " + name) + suffixes.add(components[name].get_in_suffix()) + # check the legal inputs + parser.add_argument("filename", metavar="", nargs="+", + help="legal input files include: " + str(suffixes)) + args = parser.parse_args() + return vars(args) + + +# ------------------------------------------------------------------------ +# +# set the tool path and compile options +# +# ----------------------------------------------------------------------- +def do_prepare(components, info, maple_root): + global output_name + maple_out_path = maple_root + "/output" + maple_out_lib_path = maple_out_path + "/ops" + maple_out_bin_path = maple_out_path + "/bin/" + maple_android_path = maple_root + "/android" + gnu_bin_path = maple_root + "/tools/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64/bin/" + + # 编译选项 java2d8和dex2mpl没有 + # javac_options = "-g -d . " + # jar_options = "-cvf " + + as_options = "-g3 -O2 -x assembler-with-cpp -march=armv8-a -target aarch64-linux-android -c " + cc_options = "-g3 -O2 -c -march=armv8-a -target aarch64-linux-android" + cxx_options = "-g3 -O2 -c -fPIC -march=armv8-a -target aarch64-linux-android" + linker_options_head = "-march=armv8-a -target aarch64-linux-android -shared -o "\ + + output_name + " " + maple_android_path + "/out/soong/.intermediates/bionic/libc/crtbegin_so/android_arm64_armv8-a/crtbegin_so.o "\ + + maple_out_lib_path + "/mrt_module_init.o "\ + + maple_root + "/tools/clang-r353983c/lib64/clang/9.0.3/lib/linux/libclang_rt.builtins-aarch64-android.a "\ + + maple_root + "/tools/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/lib64/libatomic.a "\ + + maple_root + "/tools/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/lib/gcc/aarch64-linux-android/4.9.x/libgcc.a "\ + + maple_android_path + "/out/soong/.intermediates/bionic/libc/crtend_so/android_arm64_armv8-a/obj/bionic/libc/arch-common/bionic/crtend_so.o "\ + + "-fuse-ld=lld -lcore-all -lc -ldl -lcommon_bridge -lc++ -lm -Wl,-T "\ + + maple_out_lib_path + "/linker/maplelld.so.lds "\ + + maple_root + "/tools/clang-r353983c/lib64/clang/9.0.3/lib/linux/libclang_rt.ubsan_minimal-aarch64-android.a "\ + + "-Wl,--exclude-libs,libclang_rt.ubsan_minimal-aarch64-android.a -nostdlib" + + + components["java2d8"].update_info(maple_out_bin_path, info["java2d8"]) + components["dex2mpl"].update_info(maple_out_bin_path, info["dex2mpl"]) + components["maple"].update_info(maple_out_bin_path, info["maple"]) + components["as"].update_info(gnu_bin_path, info["as"]) + components["cc"].update_info(gnu_bin_path, info["cc"]) + components["cxx"].update_info(gnu_bin_path, info["cxx"]) + components["ld"].update_info(gnu_bin_path, info["ld"]) + + components["as"].update_info(None, as_options) + components["cc"].update_info(None, cc_options) + components["cxx"].update_info(None, cxx_options) + components["ld"].update_info(None, linker_options_head) + + + +# ------------------------------------------------------------------------ +# +# Select compile phase: "javac", "jar", "maple", "as", "ld" +# +# ----------------------------------------------------------------------- +def do_update(components, file_type): + + if file_type == "java2de": + components.pop("dex2mpl") + components.pop("maple") + components.pop("as") + components.pop("cc") + components.pop("cxx") + components.pop("ld") + elif file_type == "dex2mpl": + components.pop("maple") + components.pop("as") + components.pop("cc") + components.pop("cxx") + components.pop("ld") + elif file_type == "maple": + components.pop("as") + components.pop("cc") + components.pop("cxx") + components.pop("ld") + elif file_type == "as": + components.pop("ld") + + +# ------------------------------------------------------------------------ +# +# compile files one by one +# +# ----------------------------------------------------------------------- +def do_check(components, file_list): + # del the repeat input files + for in_file in file_list: + while file_list.count(in_file) > 1: + file_list.remove(in_file) + if not os.path.isfile(in_file): + logger.error("No such file or directory: " + in_file) + exit(1) + # compile accord with pre-install phases + for phase in list(components.keys()): + components[phase].prepare(file_list) + + +# ------------------------------------------------------------------------ +# +# Main entry for maple java driver +# +# ------------------------------------------------------------------------ +def main(): + maple_root = os.environ.get("MAPLE_ROOT") + if maple_root is None: + logger.error("Not found system environment: MAPLE_ROOT") + exit(1) + # initial all tool chain components: + # set the default name, input suffix, output suffix, and if it support multi-inputs + components = collections.OrderedDict() + # components["javac"] = Javac("/usr/bin/javac", ".java", ".class", "") + # components["jar"] = Jar("/usr/bin/jar", ".class", ".jar", "") + # components["jbc2mpl"] = SingleCompiler("jbc2mpl", ".jar", ".mpl", "") + + components["java2d8"] = SingleCompiler("java2d8", ".java", ".dex", "") + components["dex2mpl"] = SingleCompiler("dex2mpl", ".dex", ".mpl", "") + + components["maple"] = SingleCompiler("maple", ".mpl", ".VtableImpl.s", "") + components["as"] = MultiCompiler("clang++", ".s", ".o", "") + components["cc"] = MultiCompiler("clang", ".c", ".o", "") + components["cxx"] = MultiCompiler("clang++", ".cpp", ".o", "") + components["ld"] = Ld("clang++", ".o", ".so", "") + + # set the parser and collect the args + info = do_init(components) + # set the limitation and output file name + global limitation, output_name, input_name + limitation = info["timeout"] + output_name = info["output"] + file_list = info["filename"] + file_type = info["stage"] + input_name = file_list[0] + input_name = input_name.split("/")[-1].split(".")[0] + if output_name == "": + output_name = input_name + ".so" + # set the compile options and tool path + do_prepare(components, info, maple_root) + # Select compile phase + do_update(components, file_type) + # check files one by one + do_check(components, file_list) + # compile accord with pre-install phases + for phase in list(components.keys()): + components[phase].build() + logger.info("Compile Finished!") + +if __name__ == "__main__": + main() + diff --git a/test/testsuite/android_run.py b/test/testsuite/android_run.py new file mode 100644 index 0000000000000000000000000000000000000000..d377e3bd30f5b0f6ed386a2976e35a9d1534984c --- /dev/null +++ b/test/testsuite/android_run.py @@ -0,0 +1,293 @@ +# +# Copyright (c) [2020] Huawei Technologies Co.,Ltd.All rights reserved. +# +# OpenArkCompiler is licensed under Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: +# +# http://license.coscl.org.cn/MulanPSL2 +# +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR +# FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. +# + +import argparse +import logging +import os +import shlex +import subprocess +import sys +import time +import uuid + +# from assistant.SSH import SSH +from collections import OrderedDict +from textwrap import indent + +sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) +from maple_test.utils import ENCODING, complete_path, add_run_path + +EXIT_CODE = 0 + + +class MapleRunError(Exception): + pass + + +def run(cmd, work_dir, timeout): + process_command = subprocess.Popen( + cmd, + shell=True, + cwd=str(work_dir), + env=add_run_path(str(work_dir)), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + close_fds=True, + ) + try: + com_out, com_err = process_command.communicate(timeout=timeout) + except subprocess.CalledProcessError as err: + raise err + else: + return_code = process_command.returncode + com_out = com_out.decode(ENCODING, errors="ignore") + com_err = com_err.decode(ENCODING, errors="ignore") + return return_code, com_out, com_err + finally: + process_command.terminate() + +def pre_path(execute_cmd, execute_option): + SSH_USER = execute_option["ssh_user"] + SSH_IP = execute_option["ssh_ip"] + SN = execute_option["sn"] + remote_path = execute_option["remote_path"] + android_path = execute_option["android_path"] + args = "mkdir -p {remote_path}; adb -s {SN} shell mkdir -p {android_path}".format(SN=SN, + remote_path=remote_path, android_path=android_path) + execute_cmd["run_case"] = ( + '/usr/bin/ssh ' + '-o ControlMaster=auto -o ControlPath=~/.ssh/ssh-control-sock-%r@%h:%p -o ControlPersist=1h -o ' + 'User={SSH_USER} -o StrictHostKeyChecking=no ' + '{SSH_IP} "{args}"' + .format( + SSH_USER=SSH_USER, SSH_IP=SSH_IP, args=args + ) + ) + logging.debug("pre_path "+execute_cmd["run_case"]) + +def scp_so_cmd(execute_cmd, execute_option): + SSH_USER = execute_option["ssh_user"] + SSH_IP = execute_option["ssh_ip"] + remote_path = execute_option["remote_path"] + android_path = execute_option["android_path"] + execute_option["source_files"] = ":".join( + [str(file) for file in execute_option["source_files"]] + ) + execute_cmd["run_case"] = ( + "/usr/bin/scp " + "-o ControlMaster=auto -o ControlPath=~/.ssh/ssh-control-sock-%r@%h:%p -o ControlPersist=1h -o " + "User={SSH_USER} -o StrictHostKeyChecking=no {source_files} " + "{SSH_IP}:{remote_path} >/dev/null".format( + SSH_USER=SSH_USER, SSH_IP=SSH_IP, **execute_option + ) + ) + logging.debug("scp_so_cmd "+execute_cmd["run_case"]) + +def push_so_cmd(execute_cmd, execute_option): + SSH_USER = execute_option["ssh_user"] + SSH_IP = execute_option["ssh_ip"] + SN = execute_option["sn"] + remote_path = execute_option["remote_path"] + android_path = execute_option["android_path"] + execute_file = execute_option["execute_file"] + args = "adb -s {SN} push {remote_path}{execute_file} {android_path};".format(SN=SN, + execute_file=execute_file, remote_path=remote_path, android_path=android_path) + execute_cmd["run_case"] = ( + '/usr/bin/ssh ' + '-o ControlMaster=auto -o ControlPath=~/.ssh/ssh-control-sock-%r@%h:%p -o ControlPersist=1h -o ' + 'User={SSH_USER} -o StrictHostKeyChecking=no ' + '{SSH_IP} "{args}"' + .format( + SSH_USER=SSH_USER, SSH_IP=SSH_IP, args=args + ) + ) + logging.debug("push_so_cmd "+execute_cmd["run_case"]) + + +def run_so_cmd(execute_cmd, execute_option): + SSH_USER = execute_option["ssh_user"] + SSH_IP = execute_option["ssh_ip"] + SN = execute_option["sn"] + remote_path = execute_option["remote_path"] + android_path = execute_option["android_path"] + execute_file = execute_option["execute_file"] + execute_class = execute_option["execute_class"] + args = "adb -s {SN} shell ' timeout 300 /system/bin/mplsh_arm64 -XX:HeapMaxFree=8m \ + -XX:HeapTargetUtilization=0.75 -Xbootclasspath:libcore-all.so \ + -cp {android_path}{execute_file} {execute_class}'".format(SN=SN, execute_file=execute_file, + execute_class=execute_class, android_path=android_path) + execute_cmd["run_case"] = ( + '/usr/bin/ssh ' + '-o ControlMaster=auto -o ControlPath=~/.ssh/ssh-control-sock-%r@%h:%p -o ControlPersist=1h -o ' + 'User={SSH_USER} -o StrictHostKeyChecking=no ' + '{SSH_IP} "{args}"' + .format( + SSH_USER=SSH_USER, SSH_IP=SSH_IP, remote_path=remote_path, args=args + ) + ) + logging.debug("run_so_cmd "+execute_cmd["run_case"]) + + +def parse_cli(): + parser = argparse.ArgumentParser(prog="android_run") + parser.add_argument( + "--run_type", + default="aarch64", + choices=["aarch64"], + help="run type", + ) + + parser.add_argument( + "execute_file", metavar="[:file2:file3...]", help="execute file, ", + ) + parser.add_argument("execute_class", help="execute class") + + parser.add_argument("--execute_args", dest="execute_args", default="", help="execute args") + parser.add_argument( + "--timeout", help="run test case timeout", type=float, default=None + ) + parser.add_argument( + "--mrt_type", + dest="mrt_type", + default="O2", + choices=["O0", "O2"], + help="Add mrt type to the extra option", + ) + + parser.add_argument( + "--ssh_user", + dest="ssh_user", + help="your ssh user" + ) + + parser.add_argument( + "--ssh_ip", + dest="ssh_ip", + help="your ssh ip" + ) + + parser.add_argument( + "--sn", + dest="sn", + help="your phone sn" + ) + + connection_options = parser.add_argument_group("Script options") + connection_options.add_argument( + "--verbose", action="store_true", dest="verbose", help="enable verbose output", + ) + + opts = parser.parse_args() + return opts + + +def main(): + opts = parse_cli() + run_type = opts.run_type + + parser = shlex.shlex(opts.execute_file) + parser.whitespace = ":" + parser.whitespace_split = True + source_files = [complete_path(file) for file in parser] + + execute_file = opts.execute_file + execute_class = opts.execute_class + execute_args = opts.execute_args + mrt_type = opts.mrt_type + timeout = opts.timeout + ssh_user = opts.ssh_user + ssh_ip = opts.ssh_ip + sn = opts.sn + + tmp_id = str(uuid.uuid1()) + remote_path = "~/ndk_test/tmp/" + execute_class + "_" + tmp_id + "/" + android_path = "/data/local/ndk_test/tmp/" + execute_class + "_" + tmp_id + "/" + + execute_option = { + "source_files": source_files, + "execute_file" : execute_file, + "execute_class" : execute_class, + "execute_args": execute_args, + "mrt_type": mrt_type, + "timeout": timeout, + "ssh_user": ssh_user, + "ssh_ip": ssh_ip, + "sn": sn, + "remote_path": remote_path, + "android_path": android_path, + } + + logging.basicConfig( + format="\t%(asctime)s %(message)s", + datefmt="%H:%M:%S", + level=logging.DEBUG if opts.verbose else logging.INFO, + stream=sys.stderr, + ) + + execute_cmd = OrderedDict() + execute_cmd["run_case"] = None + + # check_env_cmd(execute_cmd, execute_option) + # isInit = run_case(execute_cmd, ".", timeout) + # if isInit != 'yes': + # print(1234) + # init_env_cmd(execute_cmd, execute_option) + # run_case(execute_cmd, ".", timeout) + + pre_path(execute_cmd, execute_option) + run_case(execute_cmd, ".", timeout) + scp_so_cmd(execute_cmd, execute_option) + run_case(execute_cmd, ".", timeout) + push_so_cmd(execute_cmd, execute_option) + run_case(execute_cmd, ".", timeout) + run_so_cmd(execute_cmd, execute_option) + run_case(execute_cmd, ".", timeout) + + +def run_case(execute_cmd, work_dir, timeout): + for stage, cmd in execute_cmd.items(): + ret = run_cmd(stage, cmd, work_dir, timeout) + return ret + + +def run_cmd(stage, cmd, work_dir, timeout): + return_code, com_out, com_err = run(cmd, work_dir, timeout) + logging.debug("execute command: %s", cmd) + logging.debug("execute return code: %d", return_code) + logging.debug("execute out: \n%s", indent(com_out, "\t", lambda line: True)) + logging.debug("execute error: \n%s", indent(com_err, "\t", lambda line: True)) + global EXIT_CODE + EXIT_CODE = return_code + print(com_out, end="") + print(com_err, file=sys.stderr, end="") + if return_code != 0: + logging.error("execute command: %s", cmd) + logging.error("execute return code: %d", return_code) + logging.error("execute out: \n%s", indent(com_out, "\t", lambda line: True)) + logging.error( + "execute error: \n%s", indent(com_err, "\t", lambda line: True) + ) + reason = "Maple run stage: {} failed at command: {}, reason: {}".format( + "run_case".upper(), cmd, com_err + ) + raise MapleRunError(reason) + return com_out + +if __name__ == "__main__": + try: + main() + except MapleRunError as e: + sys.exit(EXIT_CODE) + diff --git a/test/testsuite/ouroboros/test.cfg b/test/testsuite/ouroboros/test.cfg index 95b70c9ad3bf761644733017bb024690fc051e66..9fc0522ae09464e771d5d375894927c2c1db653e 100644 --- a/test/testsuite/ouroboros/test.cfg +++ b/test/testsuite/ouroboros/test.cfg @@ -3,10 +3,9 @@ java = // [internal-var] maple = python3 ${MAPLE_ROOT}/test/testsuite/maple.py -run = # -build_option = --javac="-bootclasspath ${MAPLE_ROOT}/libjava-core/java-core.jar" --maple="-O0 --mplt=${MAPLE_ROOT}/libjava-core/java-core.mplt --option=\"-use-string-factory::: \"" -s maple +run = python3 ${MAPLE_ROOT}/test/testsuite/run.py +build_option = --javac="-bootclasspath ${MAPLE_ROOT}/output/ops/third_party/JAVA_LIBRARIES/core-oj.com.android.art_intermediates/classes.jar:${MAPLE_ROOT}/output/ops/third_party/JAVA_LIBRARIES/core-libart.com.android.art_intermediates/classes.jar:${MAPLE_ROOT}/output/ops/third_party/JAVA_LIBRARIES/services_intermediates/classes.jar:." --jbc2mpl="-mplt ${MAPLE_ROOT}/libjava-core/libcore-all.mplt -dumpPragma -use-string-factory" --maple="-O0" --ld="-L${MAPLE_ROOT}/output/ops/host-x86_64-O2" --cxx="-I${MAPLE_ROOT}/output/ops/libnativehelper/include_jni" run_option = [description] title = Maple Ouroboros Test - diff --git a/test/testsuite/ouroboros/test_android.cfg b/test/testsuite/ouroboros/test_android.cfg new file mode 100644 index 0000000000000000000000000000000000000000..5cd796fbe2ed17a6d513a1838d6dee79305db9fe --- /dev/null +++ b/test/testsuite/ouroboros/test_android.cfg @@ -0,0 +1,16 @@ +[suffix] +java = // + +[internal-var] +maple = python3 ${MAPLE_ROOT}/test/testsuite/android_maple.py + +# please set your ssh and sn +run = python3 ${MAPLE_ROOT}/test/testsuite/android_run.py --ssh_user=c00520302 --ssh_ip=10.175.96.96 --sn=66J5T19401008041 + +build_option = --dex2mpl="-mplt $MAPLE_ROOT/libjava-core/libcore-all.mplt -litprofile=${MAPLE_ROOT}/src/mrt/codetricks/profile.pv/meta.list" --maple="-O0" --ld=" -L${MAPLE_ROOT}/android/out/target/product/generic_arm64/apex/com.android.runtime/lib64 -L${MAPLE_ROOT}/android/out/target/product/generic_arm64/apex/com.android.runtime/lib64/bionic -L${MAPLE_ROOT}/src/mrt/deplibs -L${MAPLE_ROOT}/tools/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/27 -L${MAPLE_ROOT}/output/ops/host-x86_64-O2" --cxx="-I${MAPLE_ROOT}/output/ops/libnativehelper/include_jni" + +run_option = + +[description] +title = Maple Ouroboros Test + diff --git a/test/testsuite/qemu_run.py b/test/testsuite/run.py similarity index 93% rename from test/testsuite/qemu_run.py rename to test/testsuite/run.py index fab40c065698d66aaee08561acaa1f2fa9d19b51..d8ae9db8e0d52203a124f202759e920afe815b61 100644 --- a/test/testsuite/qemu_run.py +++ b/test/testsuite/run.py @@ -1,16 +1,16 @@ # # Copyright (c) [2020] Huawei Technologies Co.,Ltd.All rights reserved. # -# OpenArkCompiler is licensed under the Mulan PSL v1. -# You can use this software according to the terms and conditions of the Mulan PSL v1. -# You may obtain a copy of Mulan PSL v1 at: +# OpenArkCompiler is licensed under Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: # -# http://license.coscl.org.cn/MulanPSL +# http://license.coscl.org.cn/MulanPSL2 # # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR # FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v1 for more details. +# See the Mulan PSL v2 for more details. # import argparse @@ -64,7 +64,7 @@ def construct_qemu_cmd(execute_cmd, execute_option): execute_option["execute_files"] = ":".join( [str(file) for file in execute_option["execute_files"]] ) - LIBZ_SO = maple_root + "/output/ops/third-party" + LIBZ_SO = maple_root + "/output/ops/third_party" RUNTIME_SO = maple_root + "/output/ops/host-x86_64-" + execute_option["mrt_type"] APP_SO = os.getcwd() MPLSH = maple_root + "/output/ops/mplsh" @@ -80,7 +80,7 @@ def construct_qemu_cmd(execute_cmd, execute_option): def parse_cli(): - parser = argparse.ArgumentParser(prog="qemu_run") + parser = argparse.ArgumentParser(prog="run") parser.add_argument( "--run_type", default="aarch64", @@ -99,8 +99,8 @@ def parse_cli(): parser.add_argument( "--mrt_type", dest="mrt_type", - default="OPS_O0", - choices=["OPS_O0", "OPS_O2"], + default="O2", + choices=["O0", "O2"], help="Add mrt type to the extra option", )