diff --git a/crates/sui-proc-macros/src/lib.rs b/crates/sui-proc-macros/src/lib.rs index ab0fca56a7f46..4cc49ce52e229 100644 --- a/crates/sui-proc-macros/src/lib.rs +++ b/crates/sui-proc-macros/src/lib.rs @@ -57,8 +57,7 @@ pub fn init_static_initializers(_args: TokenStream, item: TokenStream) -> TokenS use sui_simulator::move_package::package_hooks::register_package_hooks; register_package_hooks(Box::new(SuiPackageHooks {})); - let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - path.extend(["..", "..", "examples", "move", "basics"]); + let mut path = PathBuf::from(env!("SIMTEST_STATIC_INIT_MOVE")); let mut build_config = BuildConfig::default(); build_config.config.install_dir = Some(TempDir::new().unwrap().into_path()); diff --git a/scripts/simtest/cargo-simtest b/scripts/simtest/cargo-simtest index a93af53753134..57614f76405fe 100755 --- a/scripts/simtest/cargo-simtest +++ b/scripts/simtest/cargo-simtest @@ -96,6 +96,11 @@ fi # Must supply a new temp dir - the test is deterministic and can't choose one randomly itself. export TMPDIR=$(mktemp -d) +# Set the example move package for the simtest static initializer +# https://github.com/MystenLabs/sui/blob/7bc276d534c6c758ac2cfefe96431c2b1318ca01/crates/sui-proc-macros/src/lib.rs#L52 +root_dir=$(git rev-parse --show-toplevel) +export SIMTEST_STATIC_INIT_MOVE=$root_dir"/examples/move/basics" + cargo ${CARGO_COMMAND[@]} \ --config "build.rustflags = [$RUST_FLAGS]" \ "${cargo_patch_args[@]}" \