Run spec test for classic/fast-interp in NuttX CI (#2817)

This commit is contained in:
Huang Qi
2023-11-27 15:24:02 +08:00
committed by GitHub
parent 5377e18623
commit d7608690c0
5 changed files with 155 additions and 95 deletions

View File

@ -50,26 +50,23 @@ SPEC_TEST_DIR = "spec/test/core"
WAST2WASM_CMD = exe_file_path("./wabt/out/gcc/Release/wat2wasm")
SPEC_INTERPRETER_CMD = "spec/interpreter/wasm"
WAMRC_CMD = "../../../wamr-compiler/build/wamrc"
class TargetAction(argparse.Action):
TARGET_MAP = {
"ARMV7_VFP": "armv7",
"RISCV32": "riscv32_ilp32",
"RISCV32_ILP32": "riscv32_ilp32",
"RISCV32_ILP32D": "riscv32_ilp32d",
"RISCV64": "riscv64_lp64",
"RISCV64_LP64": "riscv64_lp64",
"RISCV64_LP64D": "riscv64_lp64",
"THUMBV7_VFP": "thumbv7",
"X86_32": "i386",
"X86_64": "x86_64",
"AARCH64": "arm64"
}
def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, self.dest, self.TARGET_MAP.get(values, "x86_64"))
AVAILABLE_TARGETS = [
"I386",
"X86_32",
"X86_64",
"AARCH64",
"AARCH64_VFP",
"ARMV7",
"ARMV7_VFP",
"RISCV32",
"RISCV32_ILP32F",
"RISCV32_ILP32D",
"RISCV64",
"RISCV64_LP64F",
"RISCV64_LP64D",
"THUMBV7",
"THUMBV7_VFP",
]
def ignore_the_case(
case_name,
@ -404,8 +401,7 @@ def main():
)
parser.add_argument(
"-m",
action=TargetAction,
choices=list(TargetAction.TARGET_MAP.keys()),
choices=AVAILABLE_TARGETS,
type=str,
dest="target",
default="X86_64",
@ -505,6 +501,13 @@ def main():
options = parser.parse_args()
# Convert target to lower case for internal use, e.g. X86_64 -> x86_64
# target is always exist, so no need to check it
options.target = options.target.lower()
if options.target == "x86_32":
options.target = "i386"
if not preflight_check(options.aot_flag):
return False

View File

@ -27,7 +27,9 @@ else:
IS_PY_3 = True
test_aot = False
# "x86_64", "i386", "aarch64", "armv7", "thumbv7", "riscv32_ilp32", "riscv32_ilp32d", "riscv32_lp64", "riscv64_lp64d"
# Available targets:
# "aarch64" "aarch64_vfp" "armv7" "armv7_vfp" "thumbv7" "thumbv7_vfp"
# "riscv32" "riscv32_ilp32f" "riscv32_ilp32d" "riscv64" "riscv64_lp64f" "riscv64_lp64d"
test_target = "x86_64"
debug_file = None
@ -39,6 +41,25 @@ temp_file_repo = []
# to save the mapping of module files in /tmp by name
temp_module_table = {}
# AOT compilation options mapping
aot_target_options_map = {
"i386": ["--target=i386"],
"x86_32": ["--target=i386"],
"x86_64": ["--target=x86_64", "--cpu=skylake"],
"aarch64": ["--target=aarch64", "--target-abi=eabi", "--cpu=cortex-a53"],
"aarch64_vfp": ["--target=aarch64", "--target-abi=gnueabihf", "--cpu=cortex-a53"],
"armv7": ["--target=armv7", "--target-abi=eabi", "--cpu=cortex-a9", "--cpu-features=-neon"],
"armv7_vfp": ["--target=armv7", "--target-abi=gnueabihf", "--cpu=cortex-a9"],
"thumbv7": ["--target=thumbv7", "--target-abi=eabi", "--cpu=cortex-a9", "--cpu-features=-neon,-vfpv3"],
"thumbv7_vfp": ["--target=thumbv7", "--target-abi=gnueabihf", "--cpu=cortex-a9", "--cpu-features=-neon"],
"riscv32": ["--target=riscv32", "--target-abi=ilp32", "--cpu=generic-rv32", "--cpu-features=+m,+a,+c"],
"riscv32_ilp32f": ["--target=riscv32", "--target-abi=ilp32f", "--cpu=generic-rv32", "--cpu-features=+m,+a,+c,+f"],
"riscv32_ilp32d": ["--target=riscv32", "--target-abi=ilp32d", "--cpu=generic-rv32", "--cpu-features=+m,+a,+c,+f,+d"],
"riscv64": ["--target=riscv64", "--target-abi=lp64", "--cpu=generic-rv64", "--cpu-features=+m,+a,+c"],
"riscv64_lp64f": ["--target=riscv64", "--target-abi=lp64f", "--cpu=generic-rv64", "--cpu-features=+m,+a,+c,+f"],
"riscv64_lp64d": ["--target=riscv64", "--target-abi=lp64d", "--cpu=generic-rv64", "--cpu-features=+m,+a,+c,+f,+d"],
}
def debug(data):
if debug_file:
debug_file.write(data)
@ -1025,27 +1046,8 @@ def compile_wasm_to_aot(wasm_tempfile, aot_tempfile, runner, opts, r, output = '
log("Compiling AOT to '%s'" % aot_tempfile)
cmd = [opts.aot_compiler]
if test_target == "x86_64":
cmd.append("--target=x86_64")
cmd.append("--cpu=skylake")
elif test_target == "i386":
cmd.append("--target=i386")
elif test_target == "aarch64":
cmd += ["--target=aarch64", "--cpu=cortex-a57"]
elif test_target == "armv7":
cmd += ["--target=armv7", "--target-abi=gnueabihf"]
elif test_target == "thumbv7":
cmd += ["--target=thumbv7", "--target-abi=gnueabihf", "--cpu=cortex-a9", "--cpu-features=-neon"]
elif test_target == "riscv32_ilp32":
cmd += ["--target=riscv32", "--target-abi=ilp32", "--cpu=generic-rv32", "--cpu-features=+m,+a,+c"]
elif test_target == "riscv32_ilp32d":
cmd += ["--target=riscv32", "--target-abi=ilp32d", "--cpu=generic-rv32", "--cpu-features=+m,+a,+c"]
elif test_target == "riscv64_lp64":
cmd += ["--target=riscv64", "--target-abi=lp64", "--cpu=generic-rv64", "--cpu-features=+m,+a,+c"]
elif test_target == "riscv64_lp64d":
cmd += ["--target=riscv64", "--target-abi=lp64d", "--cpu=generic-rv32", "--cpu-features=+m,+a,+c"]
else:
pass
if test_target in aot_target_options_map:
cmd += aot_target_options_map[test_target]
if opts.sgx:
cmd.append("-sgx")
@ -1094,12 +1096,20 @@ def run_wasm_with_repl(wasm_tempfile, aot_tempfile, opts, r):
if opts.qemu_firmware == '':
raise Exception("QEMU firmware missing")
if opts.target == "thumbv7":
cmd = ["qemu-system-arm", "-semihosting", "-M", "sabrelite", "-m", "1024", "-smp", "4", "-nographic", "-kernel", opts.qemu_firmware]
elif opts.target == "riscv32_ilp32":
cmd = ["qemu-system-riscv32", "-semihosting", "-M", "virt,aclint=on", "-cpu", "rv32", "-smp", "8", "-nographic", "-bios", "none", "-kernel", opts.qemu_firmware]
elif opts.target == "riscv64_lp64":
cmd = ["qemu-system-riscv64", "-semihosting", "-M", "virt,aclint=on", "-cpu", "rv64", "-smp", "8", "-nographic", "-bios", "none", "-kernel", opts.qemu_firmware]
if opts.target.startswith("aarch64"):
cmd = "qemu-system-aarch64 -cpu cortex-a53 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel".split()
cmd.append(opts.qemu_firmware)
elif opts.target.startswith("thumbv7"):
cmd = "qemu-system-arm -semihosting -M sabrelite -m 1024 -smp 4 -nographic -kernel".split()
cmd.append(opts.qemu_firmware)
elif opts.target.startswith("riscv32"):
cmd = "qemu-system-riscv32 -semihosting -M virt,aclint=on -cpu rv32 -smp 8 -nographic -bios none -kernel".split()
cmd.append(opts.qemu_firmware)
elif opts.target.startswith("riscv64"):
cmd = "qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -smp 8 -nographic -bios none -kernel".split()
cmd.append(opts.qemu_firmware)
else:
raise Exception("Unknwon target for QEMU: %s" % opts.target)
else:
cmd = cmd_iwasm

View File

@ -15,7 +15,9 @@ function help()
echo "test_wamr.sh [options]"
echo "-c clean previous test results, not start test"
echo "-s {suite_name} test only one suite (spec|wasi_certification|wamr_compiler)"
echo "-m set compile target of iwasm(x86_64|x86_32|armv7_vfp|thumbv7_vfp|riscv64_lp64d|riscv64_lp64|aarch64)"
echo "-m set compile target of iwasm(x86_64|x86_32|armv7|armv7_vfp|thumbv7|thumbv7_vfp|"
echo " riscv32|riscv32_ilp32f|riscv32_ilp32d|riscv64|"
echo " riscv64_lp64f|riscv64_lp64d|aarch64|aarch64_vfp)"
echo "-t set compile type of iwasm(classic-interp|fast-interp|jit|aot|fast-jit|multi-tier-jit)"
echo "-M enable multi module feature"
echo "-p enable multi thread feature"
@ -65,6 +67,8 @@ ENABLE_QEMU=0
QEMU_FIRMWARE=""
# prod/testsuite-all branch
WASI_TESTSUITE_COMMIT="ee807fc551978490bf1c277059aabfa1e589a6c2"
TARGET_LIST=("AARCH64" "AARCH64_VFP" "ARMV7" "ARMV7_VFP" "THUMBV7" "THUMBV7_VFP" \
"RISCV32" "RISCV32_ILP32F" "RISCV32_ILP32D" "RISCV64" "RISCV64_LP64F" "RISCV64_LP64D")
while getopts ":s:cabgvt:m:MCpSXxwPGQF:j:T:" opt
do
@ -727,9 +731,7 @@ function build_iwasm_with_cfg()
function build_wamrc()
{
if [[ $TARGET == "ARMV7_VFP" || $TARGET == "THUMBV7_VFP"
|| $TARGET == "RISCV32" || $TARGET == "RISCV32_ILP32" || $TARGET == "RISCV32_ILP32D"
|| $TARGET == "RISCV64" || $TARGET == "RISCV64_LP64D" || $TARGET == "RISCV64_LP64" ]];then
if [[ "${TARGET_LIST[*]}" =~ "${TARGET}" ]]; then
echo "suppose wamrc is already built"
return
fi