unable to reproduce linkage issue (#5912)

This commit is contained in:
Jack May
2019-09-16 14:35:58 -07:00
committed by GitHub
parent d5ba90d375
commit f5964b4f3c
3 changed files with 254 additions and 109 deletions

View File

@ -33,24 +33,3 @@ pub fn divide(n: i128, d: i128) -> i128 {
pub fn modulo(n: i128, d: i128) -> i128 {
n % d
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn pull_in_externs() {
// Rust on Linux excludes the externs unless there is a
// direct dependency, use this test to force the pull in of the library.
// This is not necessary on macos and unfortunate on Linux
// Issue #4972
use solana_sdk::program_test::*;
unsafe { sol_log_("X".as_ptr(), 1) };
sol_log_64_(1, 2, 3, 4, 5);
}
#[test]
fn test_add() {
assert_eq!(3, add(1, 2));
}
}

View File

@ -14,7 +14,7 @@ pub fn many_args(
arg8: u64,
arg9: u64,
) -> u64 {
info!("Another package");
info!("Another package - many_args");
info!(arg1, arg2, arg3, arg4, arg5);
info!(arg6, arg7, arg8, arg9, 0);
arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9
@ -38,7 +38,7 @@ pub fn many_args_sret(
arg8: u64,
arg9: u64,
) -> Ret {
info!("Another package");
info!("Another package - many_args_sret");
info!(arg1, arg2, arg3, arg4, arg5);
info!(arg6, arg7, arg8, arg9, 0);
Ret {
@ -53,19 +53,20 @@ mod test {
extern crate std;
use super::*;
#[test]
fn pull_in_externs() {
// Rust on Linux excludes the externs unless there is a
// direct dependency, use this test to force the pull in of the library.
// This is not necessary on macos and unfortunate on Linux
// Issue #4972
use solana_sdk::program_test::*;
unsafe { sol_log_("X".as_ptr(), 1) };
sol_log_64_(1, 2, 3, 4, 5);
}
#[test]
fn test_many_args() {
assert_eq!(45, many_args(1, 2, 3, 4, 5, 6, 7, 8, 9));
}
#[test]
fn test_sret() {
assert_eq!(
Ret {
group1: 6,
group2: 15,
group3: 24
},
many_args_sret(1, 2, 3, 4, 5, 6, 7, 8, 9)
);
}
}