diff --git a/contracts/Cargo.toml b/contracts/Cargo.toml index 77ddf1b..bcbbb80 100644 --- a/contracts/Cargo.toml +++ b/contracts/Cargo.toml @@ -4,6 +4,5 @@ resolver = "2" [profile.release] overflow-checks = true -opt-level = 's' -lto = true +strip = true codegen-units = 1 diff --git a/contracts/ckb-std-tests/src/entry.rs b/contracts/ckb-std-tests/src/entry.rs index 3715873..b85dda3 100644 --- a/contracts/ckb-std-tests/src/entry.rs +++ b/contracts/ckb-std-tests/src/entry.rs @@ -805,15 +805,6 @@ pub fn main() -> Result<(), Error> { test_query(); test_calc_data_hash(); - #[cfg(target_arch = "riscv64")] - unsafe { - let mut context = ContextType::new(); - #[allow(deprecated)] - let mut old_context = ContextTypeOld::new(); - - test_dynamic_loading(&mut old_context); - test_dynamic_loading_c_impl(&mut context); - } test_vm_version(); test_current_cycles(); test_since(); @@ -823,5 +814,16 @@ pub fn main() -> Result<(), Error> { test_atomic2(); test_log(); } + + #[cfg(target_arch = "riscv64")] + unsafe { + let mut context = ContextType::new(); + #[allow(deprecated)] + let mut old_context = ContextTypeOld::new(); + + test_dynamic_loading(&mut old_context); + test_dynamic_loading_c_impl(&mut context); + } + Ok(()) } diff --git a/test/Makefile b/test/Makefile index f80f504..5cc1c38 100644 --- a/test/Makefile +++ b/test/Makefile @@ -6,13 +6,13 @@ test: build build-examples build: make -C shared-lib all-via-docker - cd ../contracts && RUSTFLAGS="-C target-feature=-a" cargo build --target riscv64imac-unknown-none-elf + cd ../contracts && RUSTFLAGS="-C target-feature=-a" cargo build --release --target riscv64imac-unknown-none-elf build-examples: - cd ../examples && RUSTFLAGS="-C target-feature=-a" cargo build --features build-with-clang --example always_failure --target riscv64imac-unknown-none-elf - cd ../examples && RUSTFLAGS="-C target-feature=-a" cargo build --features build-with-clang --example always_success --target riscv64imac-unknown-none-elf - cd ../examples && RUSTFLAGS="-C target-feature=-a" cargo build --features build-with-clang --example atomic --target riscv64imac-unknown-none-elf - cd ../examples && RUSTFLAGS="-C target-feature=-a" cargo build --features build-with-clang --example type_id --target riscv64imac-unknown-none-elf --features "type-id" + cd ../examples && RUSTFLAGS="-C target-feature=-a" cargo build --release --target riscv64imac-unknown-none-elf --features build-with-clang --example always_failure + cd ../examples && RUSTFLAGS="-C target-feature=-a" cargo build --release --target riscv64imac-unknown-none-elf --features build-with-clang --example always_success + cd ../examples && RUSTFLAGS="-C target-feature=-a" cargo build --release --target riscv64imac-unknown-none-elf --features build-with-clang --example atomic + cd ../examples && RUSTFLAGS="-C target-feature=-a" cargo build --release --target riscv64imac-unknown-none-elf --features build-with-clang,type-id --example type_id clean: rm -rf ../build diff --git a/test/src/contract.rs b/test/src/contract.rs index 4df5393..4940fbe 100644 --- a/test/src/contract.rs +++ b/test/src/contract.rs @@ -14,7 +14,7 @@ fn it_works() { let mut context = Context::default(); let contract_bin = { let mut buf = Vec::new(); - File::open("../contracts/target/riscv64imac-unknown-none-elf/debug/ckb-std-tests") + File::open("../contracts/target/riscv64imac-unknown-none-elf/release/ckb-std-tests") .unwrap() .read_to_end(&mut buf) .expect("read code"); diff --git a/test/src/exec.rs b/test/src/exec.rs index f130ea9..fec0a1f 100644 --- a/test/src/exec.rs +++ b/test/src/exec.rs @@ -21,7 +21,7 @@ fn test_exec_by_index() { let mut context = Context::default(); let caller_bin = { let mut buf = Vec::new(); - File::open("../contracts/target/riscv64imac-unknown-none-elf/debug/exec-caller") + File::open("../contracts/target/riscv64imac-unknown-none-elf/release/exec-caller") .unwrap() .read_to_end(&mut buf) .expect("read code"); @@ -30,7 +30,7 @@ fn test_exec_by_index() { let caller_out_point = context.deploy_cell(caller_bin); let callee_bin = { let mut buf = Vec::new(); - File::open("../contracts/target/riscv64imac-unknown-none-elf/debug/exec-callee") + File::open("../contracts/target/riscv64imac-unknown-none-elf/release/exec-callee") .unwrap() .read_to_end(&mut buf) .expect("read code"); @@ -85,7 +85,7 @@ fn test_exec_by_code_hash() { let caller_bin = { let mut buf = Vec::new(); File::open( - "../contracts/target/riscv64imac-unknown-none-elf/debug/exec-caller-by-code-hash", + "../contracts/target/riscv64imac-unknown-none-elf/release/exec-caller-by-code-hash", ) .unwrap() .read_to_end(&mut buf) @@ -95,7 +95,7 @@ fn test_exec_by_code_hash() { let caller_out_point = context.deploy_cell(caller_bin); let callee_bin = { let mut buf = Vec::new(); - File::open("../contracts/target/riscv64imac-unknown-none-elf/debug/exec-callee") + File::open("../contracts/target/riscv64imac-unknown-none-elf/release/exec-callee") .unwrap() .read_to_end(&mut buf) .expect("read code"); diff --git a/test/src/type_id.rs b/test/src/type_id.rs index 45f99e5..fd92676 100644 --- a/test/src/type_id.rs +++ b/test/src/type_id.rs @@ -9,7 +9,7 @@ const MAX_CYCLES: u64 = 1000_0000; fn build_bins() -> (Bytes, Bytes) { let always_success_bin = { let mut buf = Vec::new(); - File::open("../target/riscv64imac-unknown-none-elf/debug/examples/always_success") + File::open("../target/riscv64imac-unknown-none-elf/release/examples/always_success") .unwrap() .read_to_end(&mut buf) .expect("read code"); @@ -17,7 +17,7 @@ fn build_bins() -> (Bytes, Bytes) { }; let type_id_bin = { let mut buf = Vec::new(); - File::open("../target/riscv64imac-unknown-none-elf/debug/examples/type_id") + File::open("../target/riscv64imac-unknown-none-elf/release/examples/type_id") .unwrap() .read_to_end(&mut buf) .expect("read code");