Merge branch main into dev/wasi-libc-windows
This commit is contained in:
@ -456,7 +456,7 @@ def cast_v128_to_i64x2(numbers, type, lane_type):
|
||||
|
||||
assert(packed)
|
||||
unpacked = struct.unpack("Q Q", packed)
|
||||
return unpacked, "[{} {}]:{}:v128".format(unpacked[0], unpacked[1], lane_type)
|
||||
return unpacked, f"[{unpacked[0]:#x} {unpacked[1]:#x}]:{lane_type}:v128"
|
||||
|
||||
def parse_simple_const_w_type(number, type):
|
||||
number = number.replace('_', '')
|
||||
@ -468,13 +468,7 @@ def parse_simple_const_w_type(number, type):
|
||||
else "-0x{:x}:{}".format(0 - number, type)
|
||||
elif type in ["f32", "f64"]:
|
||||
if "nan:" in number:
|
||||
# TODO: how to handle this correctly
|
||||
if "nan:canonical" in number:
|
||||
return float.fromhex("0x200000"), "nan:{}".format(type)
|
||||
elif "nan:arithmetic" in number:
|
||||
return float.fromhex("-0x200000"), "nan:{}".format(type)
|
||||
else:
|
||||
return float('nan'), "nan:{}".format(type)
|
||||
return float('nan'), "nan:{}".format(type)
|
||||
else:
|
||||
number = float.fromhex(number) if '0x' in number else float(number)
|
||||
return number, "{:.7g}:{}".format(number, type)
|
||||
@ -598,9 +592,6 @@ def vector_value_comparison(out, expected):
|
||||
if out_type != expected_type:
|
||||
return False
|
||||
|
||||
if out_val == expected_val:
|
||||
return True
|
||||
|
||||
out_val = out_val.split(" ")
|
||||
expected_val = expected_val.split(" ")
|
||||
|
||||
@ -624,12 +615,14 @@ def vector_value_comparison(out, expected):
|
||||
|
||||
out_is_nan = [math.isnan(o) for o in out_unpacked]
|
||||
expected_is_nan = [math.isnan(e) for e in expected_unpacked]
|
||||
if out_is_nan and expected_is_nan:
|
||||
return True;
|
||||
if any(out_is_nan):
|
||||
nan_comparision = [o == e for o, e in zip(out_is_nan, expected_is_nan)]
|
||||
if all(nan_comparision):
|
||||
print(f"Pass NaN comparision")
|
||||
return True
|
||||
|
||||
# print("compare {} and {}".format(out_unpacked, expected_unpacked))
|
||||
# print(f"compare {out_unpacked} and {expected_unpacked}")
|
||||
result = [o == e for o, e in zip(out_unpacked, expected_unpacked)]
|
||||
|
||||
if not all(result):
|
||||
result = [
|
||||
"{:.7g}".format(o) == "{:.7g}".format(e)
|
||||
@ -834,7 +827,7 @@ def test_assert_return(r, opts, form):
|
||||
numbers, _ = cast_v128_to_i64x2(splitted[2:], 'v128', splitted[1])
|
||||
|
||||
assert(len(numbers) == 2), "has to reform arguments into i64x2"
|
||||
args.append("{}\{}".format(numbers[0], numbers[1]))
|
||||
args.append(f"{numbers[0]:#x}\{numbers[1]:#x}")
|
||||
elif "ref.null" == splitted[0]:
|
||||
args.append("null")
|
||||
elif "ref.extern" == splitted[0]:
|
||||
@ -1183,7 +1176,7 @@ def test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile,
|
||||
|
||||
if __name__ == "__main__":
|
||||
opts = parser.parse_args(sys.argv[1:])
|
||||
print('Input param :',opts)
|
||||
# print('Input param :',opts)
|
||||
|
||||
if opts.aot: test_aot = True
|
||||
# default x86_64
|
||||
@ -1206,7 +1199,7 @@ if __name__ == "__main__":
|
||||
|
||||
ret_code = 0
|
||||
try:
|
||||
log("################################################")
|
||||
log("\n################################################")
|
||||
log("### Testing %s" % opts.test_file.name)
|
||||
log("################################################")
|
||||
forms = read_forms(opts.test_file.read())
|
||||
@ -1352,6 +1345,16 @@ if __name__ == "__main__":
|
||||
|
||||
# add new_module copied from the old into temp_file_repo[]
|
||||
temp_file_repo.append(new_module)
|
||||
|
||||
if test_aot:
|
||||
new_module_aot = os.path.join(tempfile.gettempdir(), name_new + ".aot")
|
||||
r = compile_wasm_to_aot(new_module, new_module_aot, True, opts, r)
|
||||
try:
|
||||
assert_prompt(r, ['Compile success'], opts.start_timeout, True)
|
||||
except:
|
||||
raise Exception("compile wasm to aot failed")
|
||||
# add aot module into temp_file_repo[]
|
||||
temp_file_repo.append(new_module_aot)
|
||||
else:
|
||||
# there is no name defined in register cmd
|
||||
raise Exception("can not find module name from the register")
|
||||
@ -1394,3 +1397,4 @@ if __name__ == "__main__":
|
||||
log("Leaving tempfiles: %s" % ([wast_tempfile, wasm_tempfile]))
|
||||
|
||||
sys.exit(ret_code)
|
||||
|
||||
Reference in New Issue
Block a user