From f8b9b818fb97aa7ea8aee3e46b254e62859fa905 Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Mon, 16 Dec 2024 11:13:12 -0800 Subject: [PATCH] fix test --- .../aptos_test_harness/default_int_size.exp | 2 +- .../aptos_test_harness/diamond_clicker.exp | 120 ++++++++---------- .../tests/tests.rs | 24 ++-- 3 files changed, 68 insertions(+), 78 deletions(-) diff --git a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/default_int_size.exp b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/default_int_size.exp index bb7def459c73c..05e61d5e21757 100644 --- a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/default_int_size.exp +++ b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/default_int_size.exp @@ -1,4 +1,4 @@ processed 2 tasks task 1 'run'. lines 4-21: -Error: Failed to execute transaction. ExecutionStatus: ExecutionFailure { location: Script, function: 0, code_offset: 11 } +Error: Failed to execute transaction. ExecutionStatus: ExecutionFailure { location: Script, function: 0, code_offset: 10 } diff --git a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/diamond_clicker.exp b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/diamond_clicker.exp index 2ad9de1be64e9..6da8712401946 100644 --- a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/diamond_clicker.exp +++ b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/diamond_clicker.exp @@ -1,76 +1,62 @@ processed 4 tasks task 1 'print-bytecode'. lines 4-35: -Error: extended checks failed: +// Move bytecode v7 +module f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6.game { +use 0000000000000000000000000000000000000000000000000000000000000001::signer; +use 0000000000000000000000000000000000000000000000000000000000000001::debug; -bug: BYTECODE VERIFICATION FAILED - ┌─ TEMPFILE:25:13 - │ -25 │ debug::print(field); // INTERNAL TEST ERROR: INTERNAL VM INVARIANT VIOLATION - │ ^^^^^^^^^^^^^^^^^^^ ICE failed bytecode verifier: VMError { - major_status: CALL_TYPE_MISMATCH_ERROR, - sub_status: None, - message: None, - exec_state: None, - location: Module( - ModuleId { - address: f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6, - name: Identifier( - "game", - ), - }, - ), - indices: [ - ( - FunctionDefinition, - 0, - ), - ], - offsets: [ - ( - FunctionDefinitionIndex(0), - 25, - ), - ], -} - - - -task 2 'publish'. lines 37-68: -Error: extended checks failed: -bug: BYTECODE VERIFICATION FAILED - ┌─ TEMPFILE1:58:13 - │ -58 │ debug::print(field); // INTERNAL TEST ERROR: INTERNAL VM INVARIANT VIOLATION - │ ^^^^^^^^^^^^^^^^^^^ ICE failed bytecode verifier: VMError { - major_status: CALL_TYPE_MISMATCH_ERROR, - sub_status: None, - message: None, - exec_state: None, - location: Module( - ModuleId { - address: f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6, - name: Identifier( - "game", - ), - }, - ), - indices: [ - ( - FunctionDefinition, - 0, - ), - ], - offsets: [ - ( - FunctionDefinitionIndex(0), - 25, - ), - ], +struct InnerStruct has copy, store, key { + amount: u64 +} +struct OuterStruct has key { + any_field: vector } - +entry public test_upgrade(Arg0: &signer) /* def_idx: 0 */ { +L1: loc0: &mut vector +L2: loc1: u64 +L3: loc2: u64 +B0: + 0: CopyLoc[0](Arg0: &signer) + 1: Call signer::address_of(&signer): address + 2: MoveLoc[0](Arg0: &signer) + 3: VecPack(3, 0) + 4: Pack[1](OuterStruct) + 5: MoveTo[1](OuterStruct) + 6: MutBorrowGlobal[1](OuterStruct) + 7: MutBorrowField[0](OuterStruct.any_field: vector) + 8: StLoc[1](loc0: &mut vector) + 9: LdU64(0) + 10: StLoc[2](loc1: u64) + 11: CopyLoc[1](loc0: &mut vector) + 12: FreezeRef + 13: VecLen(3) + 14: StLoc[3](loc2: u64) +B1: + 15: CopyLoc[2](loc1: u64) + 16: CopyLoc[3](loc2: u64) + 17: Lt + 18: BrFalse(29) +B2: + 19: CopyLoc[1](loc0: &mut vector) + 20: CopyLoc[2](loc1: u64) + 21: VecMutBorrow(3) + 22: FreezeRef + 23: Call debug::print(&InnerStruct) + 24: MoveLoc[2](loc1: u64) + 25: LdU64(1) + 26: Add + 27: StLoc[2](loc1: u64) + 28: Branch(15) +B3: + 29: MoveLoc[1](loc0: &mut vector) + 30: Pop + 31: Ret +} +} task 3 'run'. lines 70-70: -Error: Failed to execute transaction. ExecutionStatus: MiscellaneousError(Some(LINKER_ERROR)) +mutable inputs after call: local#0: 0 +return values: 0 diff --git a/aptos-move/aptos-transactional-test-harness/tests/tests.rs b/aptos-move/aptos-transactional-test-harness/tests/tests.rs index 90bbd913dce1d..d8d4ff6e270cd 100644 --- a/aptos-move/aptos-transactional-test-harness/tests/tests.rs +++ b/aptos-move/aptos-transactional-test-harness/tests/tests.rs @@ -10,14 +10,18 @@ use std::path::Path; datatest_stable::harness!(runner, "tests", r".*\.(mvir|move)$"); fn runner(path: &Path) -> anyhow::Result<(), Box> { - if path.to_str().unwrap().contains("v2-tests/") { - // TODO: we may later want to change this to comparison testing. For now we are mostly - // interested in debugging v2 bytecode. - run_aptos_test_with_config(path, TestRunConfig::CompilerV2 { - language_version: LanguageVersion::default(), - v2_experiments: vec![("attach-compiled-module".to_owned(), true)], - }) - } else { - run_aptos_test_with_config(path, TestRunConfig::CompilerV1) - } + run_aptos_test_with_config(path, TestRunConfig::CompilerV2 { + language_version: LanguageVersion::latest_stable(), + v2_experiments: vec![("attach-compiled-module".to_owned(), true)], + }) + // if path.to_str().unwrap().contains("v2-tests/") { + // // TODO: we may later want to change this to comparison testing. For now we are mostly + // // interested in debugging v2 bytecode. + // run_aptos_test_with_config(path, TestRunConfig::CompilerV2 { + // language_version: LanguageVersion::latest_stable(), + // v2_experiments: vec![("attach-compiled-module".to_owned(), true)], + // }) + // } else { + // run_aptos_test_with_config(path, TestRunConfig::CompilerV1) + // } }