Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize statis initialize move dir in simtest #18752

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions crates/sui-proc-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
5 changes: 5 additions & 0 deletions scripts/simtest/cargo-simtest
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Comment on lines +101 to +102
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Put these into quotes to prevent potential issues with white spaces, etc.

Suggested change
root_dir=$(git rev-parse --show-toplevel)
export SIMTEST_STATIC_INIT_MOVE=$root_dir"/examples/move/basics"
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[@]}" \
Expand Down
Loading