Skip to content

std: Add smoke test for internal dynamic loading on Windows. #8818 #16776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
22 changes: 22 additions & 0 deletions src/libstd/dynamic_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,28 @@ mod test {
use libc;
use mem;

// This is a basic smoke test that loading from the exe works, in order to provide
// some Windows coverage (FIXME #8818)
#[test]
#[ignore(cfg(target_os="android"))] // FIXME(#10379)
fn test_loading_internal_smoke() {

let none: Option<Path> = None; // appease the typechecker
let thislib = match DynamicLibrary::open(none) {
Err(error) => fail!("Could not load self as module: {}", error),
Ok(thislib) => thislib
};

// 'main' is the only function that happens to have DllExport on windows,
// so let's try to load it (using the wrong sig since we're not calling it)
let _main: extern fn() = unsafe {
match thislib.symbol("main") {
Err(error) => fail!("Could not load function testcos: {}", error),
Ok(cosine) => mem::transmute::<*mut u8, _>(cosine)
}
};
}

#[test]
#[ignore(cfg(windows))] // FIXME #8818
#[ignore(cfg(target_os="android"))] // FIXME(#10379)
Expand Down