Remove bloat due to test symbols (#5965)

This commit is contained in:
Jack May
2019-09-18 19:54:10 -07:00
committed by GitHub
parent 10565277d6
commit 0d16db2d1b
31 changed files with 207 additions and 19 deletions

View File

@ -15,6 +15,9 @@ edition = "2018"
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
solana-bpf-rust-128bit-dep = { path = "../128bit_dep", version = "0.19.0-pre0" }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -49,3 +49,15 @@ pub extern "C" fn entrypoint(_input: *mut u8) -> u32 {
SUCCESS
}
#[cfg(test)]
mod test {
use super::*;
// Pulls in the stubs requried for `info!()`
solana_sdk_bpf_test::stubs!();
#[test]
fn test_entrypoint() {
assert_eq!(SUCCESS, entrypoint(std::ptr::null_mut()));
}
}

View File

@ -14,6 +14,9 @@ edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -14,6 +14,9 @@ edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -102,3 +102,15 @@ pub extern "C" fn entrypoint(_input: *mut u8) -> u32 {
SUCCESS
}
#[cfg(test)]
mod test {
use super::*;
// Pulls in the stubs requried for `info!()`
solana_sdk_bpf_test::stubs!();
#[test]
fn test_entrypoint() {
assert_eq!(SUCCESS, entrypoint(std::ptr::null_mut()));
}
}

View File

@ -15,6 +15,9 @@ edition = "2018"
byteorder = { version = "1", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -16,3 +16,15 @@ pub extern "C" fn entrypoint(_input: *mut u8) -> u32 {
SUCCESS
}
#[cfg(test)]
mod test {
use super::*;
// Pulls in the stubs requried for `info!()`
solana_sdk_bpf_test::stubs!();
#[test]
fn test_entrypoint() {
assert_eq!(SUCCESS, entrypoint(std::ptr::null_mut()));
}
}

View File

@ -28,17 +28,17 @@ perform_action() {
set -e
case "$1" in
build)
"$sdkDir"/bpf/rust/build.sh "$2"
"$sdkDir"/bpf/rust/build.sh "$2"
so_path="$targetDir/$profile/"
so_name="solana_bpf_rust_${3%/}"
if [ -f "$so_path/${so_name}.so" ]; then
cp "$so_path/${so_name}.so" "$so_path/${so_name}_debug.so"
"$sdkDir"/bpf/dependencies/llvm-native/bin/llvm-objcopy --strip-all "$so_path/${so_name}.so" "$so_path/$so_name.so"
so_path="$targetDir/$profile/"
so_name="solana_bpf_rust_${3%/}"
if [ -f "$so_path/${so_name}.so" ]; then
cp "$so_path/${so_name}.so" "$so_path/${so_name}_debug.so"
"$sdkDir"/bpf/dependencies/llvm-native/bin/llvm-objcopy --strip-all "$so_path/${so_name}.so" "$so_path/$so_name.so"
fi
;;
clean)
"$sdkDir"/bpf/rust/clean.sh "$2"
"$sdkDir"/bpf/rust/clean.sh "$2"
;;
test)
(
@ -77,17 +77,17 @@ perform_action() {
ls \
-la \
"$so" \
> "${dump}-mangled.txt"
>"${dump}-mangled.txt"
greadelf \
-aW \
"$so" \
>> "${dump}-mangled.txt"
>>"${dump}-mangled.txt"
../"$sdkDir"/bpf/dependencies/llvm-native/bin/llvm-objdump \
-print-imm-hex \
--source \
--disassemble \
"$so" \
>> "${dump}-mangled.txt"
>>"${dump}-mangled.txt"
sed \
s/://g \
< "${dump}-mangled.txt" \
@ -114,7 +114,7 @@ set -e
if [ "$#" -ne 2 ]; then
# Build all projects
for project in */ ; do
for project in */; do
perform_action "$1" "$PWD/$project" "$project"
done
else

View File

@ -14,6 +14,9 @@ edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -14,6 +14,9 @@ edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -18,3 +18,15 @@ pub extern "C" fn entrypoint(_input: *mut u8) -> u32 {
SUCCESS
}
#[cfg(test)]
mod test {
use super::*;
// Pulls in the stubs requried for `info!()`
solana_sdk_bpf_test::stubs!();
#[test]
fn test_entrypoint() {
assert_eq!(SUCCESS, entrypoint(std::ptr::null_mut()));
}
}

View File

@ -15,6 +15,9 @@ edition = "2018"
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
solana-bpf-rust-many-args-dep = { path = "../many_args_dep", version = "0.19.0-pre0" }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -26,3 +26,15 @@ pub extern "C" fn entrypoint(_input: *mut u8) -> u32 {
SUCCESS
}
#[cfg(test)]
mod test {
use super::*;
// Pulls in the stubs requried for `info!()`
solana_sdk_bpf_test::stubs!();
#[test]
fn test_entrypoint() {
assert_eq!(SUCCESS, entrypoint(std::ptr::null_mut()));
}
}

View File

@ -14,6 +14,9 @@ edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -50,8 +50,9 @@ pub fn many_args_sret(
#[cfg(test)]
mod test {
extern crate std;
use super::*;
// Pulls in the stubs requried for `info!()`
solana_sdk_bpf_test::stubs!();
#[test]
fn test_many_args() {

View File

@ -14,6 +14,9 @@ edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -60,6 +60,8 @@ fn process_instruction(program_id: &Pubkey, accounts: &mut [AccountInfo], data:
#[cfg(test)]
mod test {
use super::*;
// Pulls in the stubs requried for `info!()`
solana_sdk_bpf_test::stubs!();
#[test]
fn test_return_sstruct() {

View File

@ -14,6 +14,9 @@ edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -15,6 +15,9 @@ edition = "2018"
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
solana-bpf-rust-param-passing-dep = { path = "../param_passing_dep", version = "0.19.0-pre0" }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -23,3 +23,15 @@ pub extern "C" fn entrypoint(_input: *mut u8) -> u32 {
SUCCESS
}
#[cfg(test)]
mod test {
use super::*;
// Pulls in the stubs requried for `info!()`
solana_sdk_bpf_test::stubs!();
#[test]
fn test_entrypoint() {
assert_eq!(SUCCESS, entrypoint(std::ptr::null_mut()));
}
}

View File

@ -14,6 +14,9 @@ edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]

View File

@ -2,6 +2,7 @@
extern crate solana_sdk;
#[derive(Debug)]
pub struct Data<'a> {
pub twentyone: u64,
pub twentytwo: u64,
@ -11,6 +12,7 @@ pub struct Data<'a> {
pub array: &'a [u8],
}
#[derive(PartialEq, Debug)]
pub struct TestDep {
pub thirty: u32,
}
@ -21,3 +23,24 @@ impl<'a> TestDep {
}
}
}
#[cfg(test)]
mod test {
use super::*;
// Pulls in the stubs requried for `info!()`
solana_sdk_bpf_test::stubs!();
#[test]
fn test_dep() {
let array = [0xA, 0xB, 0xC, 0xD, 0xE, 0xF];
let data = Data {
twentyone: 21u64,
twentytwo: 22u64,
twentythree: 23u64,
twentyfour: 24u64,
twentyfive: 25u32,
array: &array,
};
assert_eq!(TestDep { thirty: 30 }, TestDep::new(&data, 1, 2, 3, 4, 5));
}
}

View File

@ -14,6 +14,9 @@ edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]