From 7a26b06ee67a7892d2b5f6eac1c210768ec69382 Mon Sep 17 00:00:00 2001 From: ksolana <110843012+ksolana@users.noreply.github.com> Date: Fri, 31 May 2024 06:49:51 -0700 Subject: [PATCH] Test hello world solana --- .../tests/rbpf-tests/hello/Move.toml | 9 +++++++++ .../tests/rbpf-tests/hello/input.json | 16 ++++++++++++++++ .../tests/rbpf-tests/hello/sources/hello.move | 19 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/Move.toml create mode 100644 external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/input.json create mode 100644 external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/sources/hello.move diff --git a/external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/Move.toml b/external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/Move.toml new file mode 100644 index 0000000000000..a3a9b251b3ecb --- /dev/null +++ b/external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/Move.toml @@ -0,0 +1,9 @@ +[package] +name = "hello" +version = "1.0.0" + +[addresses] +hello = "0xba31" + +[dependencies] +MoveStdlib = { local = "../../../../../crates/move-stdlib", addr_subst = { "std" = "0x1" } } diff --git a/external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/input.json b/external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/input.json new file mode 100644 index 0000000000000..f1b9ef1959235 --- /dev/null +++ b/external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/input.json @@ -0,0 +1,16 @@ +{ + "program_id": "DozgQiYtGbdyniV2T74xMdmjZJvYDzoRFFqw7UR5MwPK", + "accounts": [ + { + "key": "524HMdYYBy6TAn4dK5vCcjiTmT2sxV6Xoue5EXrz22Ca", + "owner": "BPFLoaderUpgradeab1e11111111111111111111111", + "is_signer": false, + "is_writable": true, + "lamports": 1000, + "data": [0, 0, 0, 3] + } + ], + "instruction_data": [ + 11, 0, 0, 0, 0, 0, 0, 0, + 104, 101, 108, 108, 111, 95, 95, 109, 97, 105, 110] +} diff --git a/external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/sources/hello.move b/external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/sources/hello.move new file mode 100644 index 0000000000000..956bba34967d9 --- /dev/null +++ b/external-crates/move/solana/move-mv-llvm-compiler/tests/rbpf-tests/hello/sources/hello.move @@ -0,0 +1,19 @@ +// input ../input.json +// use-stdlib +// log 0000000000000000000000000000000000000000000000000000000000000001::string::String { bytes: [72, 101, 108, 108, 111, 32, 83, 111, 108, 97, 110, 97], } + +module 0x10::debug { + native public fun print(x: &T); +} + +module hello::hello { + use 0x10::debug; + use 0x1::string; + + public entry fun main() : u64 { + let rv = 0; + let s = string::utf8(b"Hello Solana"); + debug::print(&s); + rv + } +}