Skip to content
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
2 changes: 2 additions & 0 deletions ci/bench/part2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ _ cargo +"$rust_nightly" bench --manifest-path runtime/Cargo.toml ${V:+--verbose
_ cargo build --manifest-path=keygen/Cargo.toml
export PATH="$PWD/target/debug":$PATH

_ make -C programs/sbf all

# Run sbf benches
_ cargo +"$rust_nightly" bench --manifest-path programs/sbf/Cargo.toml ${V:+--verbose} --features=sbf_c \
-- -Z unstable-options --format=json --nocapture | tee -a "$BENCH_FILE"
Expand Down
1 change: 1 addition & 0 deletions ci/test-bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ _ $cargoNightly bench --manifest-path core/Cargo.toml ${V:+--verbose} \
-- -Z unstable-options --format=json | tee -a "$BENCH_FILE"

# Run sbf benches
_ make -C programs/sbf all
_ $cargoNightly bench --manifest-path programs/sbf/Cargo.toml ${V:+--verbose} --features=sbf_c \
-- -Z unstable-options --format=json --nocapture | tee -a "$BENCH_FILE"

Expand Down
15 changes: 6 additions & 9 deletions ci/test-stable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ test-stable-sbf)
cargo_build_sbf="$(realpath ./cargo-build-sbf)"
cargo_test_sbf="$(realpath ./cargo-test-sbf)"

# platform-tools version
"$cargo_build_sbf" --version

# SBF solana-sdk legacy compile test
"$cargo_build_sbf" --manifest-path sdk/Cargo.toml

Expand All @@ -67,12 +70,9 @@ test-stable-sbf)
exit 1
fi

# SBF C program system tests
# SBF program tests
export SBF_OUT_DIR=target/sbf-solana-solana/release
_ make -C programs/sbf/c tests
_ cargo test \
--manifest-path programs/sbf/Cargo.toml \
--no-default-features --features=sbf_c,sbf_rust -- --nocapture
_ make -C programs/sbf test

# SBF Rust program unit tests
for sbf_test in programs/sbf/rust/*; do
Expand Down Expand Up @@ -100,14 +100,11 @@ test-stable-sbf)
exit 1
fi

# platform-tools version
"$cargo_build_sbf" -V

# SBF program instruction count assertion
sbf_target_path=programs/sbf/target
_ cargo test \
--manifest-path programs/sbf/Cargo.toml \
--no-default-features --features=sbf_c,sbf_rust assert_instruction_count \
--features=sbf_c,sbf_rust assert_instruction_count \
-- --nocapture &> "${sbf_target_path}"/deploy/instruction_counts.txt

sbf_dump_archive="sbf-dumps.tar.bz2"
Expand Down
1 change: 0 additions & 1 deletion programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions programs/sbf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[profile.release]
# The test programs are build in release mode
# Minimize their file size so that they fit into the account size limit
strip = true
Comment thread
alessandrod marked this conversation as resolved.

[features]
sbf_c = []
sbf_rust = []
dummy-for-ci-check = ["sbf_c", "sbf_rust"]

[build-dependencies]
walkdir = "2"

[dev-dependencies]
agave-validator = { workspace = true }
bincode = { workspace = true }
Expand Down
13 changes: 13 additions & 0 deletions programs/sbf/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SBF_SDK_PATH := ../../sdk/sbf
SRC_DIR := c/src
OUT_DIR := target/sbf-solana-solana/release

test: rust all
SBF_OUT_DIR=$(OUT_DIR) cargo test --features="sbf_rust,sbf_c" $(TEST_ARGS)

rust:
cargo +solana build --release --target sbf-solana-solana --workspace

.PHONY: rust

include $(SBF_SDK_PATH)/c/sbf.mk
131 changes: 0 additions & 131 deletions programs/sbf/build.rs

This file was deleted.

2 changes: 0 additions & 2 deletions programs/sbf/c/makefile

This file was deleted.

13 changes: 11 additions & 2 deletions runtime/src/loader_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,18 @@ const CHUNK_SIZE: usize = 512; // Size of chunk just needs to fit into tx
pub fn load_program_from_file(name: &str) -> Vec<u8> {
let mut pathbuf = {
let current_exe = env::current_exe().unwrap();
PathBuf::from(current_exe.parent().unwrap().parent().unwrap())
PathBuf::from(
current_exe
.parent()
.unwrap()
.parent()
.unwrap()
.parent()
.unwrap(),
)
};
pathbuf.push("sbf/");
pathbuf.push("sbf-solana-solana");
pathbuf.push("release");
pathbuf.push(name);
pathbuf.set_extension("so");
let mut file = File::open(&pathbuf).unwrap_or_else(|err| {
Expand Down