Skip to content

Get rid of exclude-list for Windows-only tests #102305

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

Merged
merged 1 commit into from
Oct 3, 2022
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
26 changes: 5 additions & 21 deletions src/test/ui/abi/x86stdcall.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
// run-pass
// ignore-wasm32-bare no libc to test ffi with
// ignore-sgx no libc
// only-windows
// GetLastError doesn't seem to work with stack switching

#[cfg(windows)]
mod kernel32 {
extern "system" {
pub fn SetLastError(err: usize);
pub fn GetLastError() -> usize;
}
extern "system" {
pub fn SetLastError(err: usize);
pub fn GetLastError() -> usize;
}
}


#[cfg(windows)]
pub fn main() {
unsafe {
Expand All @@ -22,17 +20,3 @@ pub fn main() {
assert_eq!(expected, actual);
}
}

#[cfg(any(target_os = "android",
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
target_os = "illumos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris",
target_os = "vxworks"))]
pub fn main() { }
12 changes: 3 additions & 9 deletions src/test/ui/abi/x86stdcall2.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// run-pass
// only-windows

#![allow(non_camel_case_types)]
pub type HANDLE = usize;
Expand All @@ -7,27 +8,20 @@ pub type SIZE_T = u32;
pub type LPVOID = usize;
pub type BOOL = u8;

#[cfg(windows)]
mod kernel32 {
use super::{HANDLE, DWORD, SIZE_T, LPVOID, BOOL};
use super::{BOOL, DWORD, HANDLE, LPVOID, SIZE_T};

extern "system" {
pub fn GetProcessHeap() -> HANDLE;
pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T)
-> LPVOID;
pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID;
pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL;
}
}


#[cfg(windows)]
pub fn main() {
let heap = unsafe { kernel32::GetProcessHeap() };
let mem = unsafe { kernel32::HeapAlloc(heap, 0, 100) };
assert!(mem != 0);
let res = unsafe { kernel32::HeapFree(heap, 0, mem) };
assert!(res != 0);
}

#[cfg(not(windows))]
pub fn main() { }