-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jarkko Sakkinen <[email protected]>
- Loading branch information
Showing
12 changed files
with
110 additions
and
37 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "polkavm-test-data" | ||
version.workspace = true | ||
authors.workspace = true | ||
license.workspace = true | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
repository.workspace = true | ||
|
||
[build-dependencies] | ||
polkavm-linker = { workspace = true } | ||
|
||
[lints] | ||
workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use std::path::Path; | ||
use std::process::Command; | ||
|
||
fn build(project: &str, profile: &str, target: &str) -> Result<(), String> { | ||
let polkavm = Path::new(std::env!("CARGO_MANIFEST_DIR")).join("../.."); | ||
let project_path = polkavm.join("guest-programs").join(project).into_os_string().into_string().unwrap(); | ||
|
||
let remap = std::format!( | ||
"--remap-path-prefix={}= --remap-path-prefix={}=", | ||
polkavm.into_os_string().into_string().unwrap(), | ||
std::env!("HOME"), | ||
); | ||
|
||
let mut cmd = Command::new("cargo"); | ||
|
||
cmd.current_dir(project_path) | ||
.env_clear() | ||
.env("PATH", std::env!("PATH")) | ||
.env("RUSTFLAGS", remap) | ||
.env("RUSTUP_HOME", std::env!("RUSTUP_HOME")) | ||
.arg("build") | ||
.arg("-q") | ||
.arg("--profile") | ||
.arg(profile) | ||
.arg("--bin") | ||
.arg(project) | ||
.arg("-p") | ||
.arg(project) | ||
.arg("--target") | ||
.arg(target) | ||
.arg("-Zunstable-options") | ||
.arg("-Zbuild-std=core,alloc"); | ||
|
||
let res = cmd.output().unwrap(); | ||
|
||
if res.status.success() { | ||
return Ok(()); | ||
} | ||
|
||
return Err(String::from_utf8_lossy(&res.stderr).to_string()); | ||
} | ||
|
||
fn main() -> Result<(), String> { | ||
println!("cargo:rerun-if-env-changed=OUT_DIR"); | ||
|
||
let target_32 = polkavm_linker::target_json_32_path() | ||
.unwrap() | ||
.into_os_string() | ||
.into_string() | ||
.unwrap(); | ||
|
||
let target_64 = polkavm_linker::target_json_64_path() | ||
.unwrap() | ||
.into_os_string() | ||
.into_string() | ||
.unwrap(); | ||
|
||
build("test-blob", "no-lto", &target_32)?; | ||
build("test-blob", "no-lto", &target_64)?; | ||
build("bench-pinky", "release", &target_32)?; | ||
build("bench-pinky", "release", &target_64)?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pub const BENCH_PINKY_32: &[u8] = include_bytes!("../../../guest-programs/target/riscv64emac-unknown-none-polkavm/release/bench-pinky"); | ||
pub const BENCH_PINKY_64: &[u8] = include_bytes!("../../../guest-programs/target/riscv64emac-unknown-none-polkavm/release/bench-pinky"); | ||
pub const TEST_BLOB_32: &[u8] = include_bytes!("../../../guest-programs/target/riscv32emac-unknown-none-polkavm/no-lto/test-blob"); | ||
pub const TEST_BLOB_64: &[u8] = include_bytes!("../../../guest-programs/target/riscv64emac-unknown-none-polkavm/no-lto/test-blob"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.