Skip to content

Commit 08690f5

Browse files
committed
test: Build import libraries for all targets
Add unit test cases for all supported cross-compile targets: `-gnu` and `-msvc` + `x86_64-`, `i686-` and `aarch64-`.
1 parent f839c7f commit 08690f5

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

src/lib.rs

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,60 @@ mod tests {
248248

249249
#[test]
250250
fn generate() {
251-
// FIXME: Use "target/test" dir for temporary files.
251+
// FIXME: Use "target/<arch>" dirs for temporary files.
252252
let mut dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
253253
dir.push("target");
254-
dir.push("test");
254+
dir.push("x86_64-pc-windows-gnu");
255+
dir.push("python3-dll");
255256

256257
let out_dir = dir.to_str().unwrap();
257258
generate_implib(out_dir).unwrap();
258259
}
259260

261+
#[test]
262+
fn generate_gnu32() {
263+
let mut dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
264+
dir.push("target");
265+
dir.push("i686-pc-windows-gnu");
266+
dir.push("python3-dll");
267+
268+
let out_dir = dir.to_str().unwrap();
269+
generate_implib_for_target(out_dir, "x86", "gnu").unwrap();
270+
}
271+
272+
#[test]
273+
fn generate_msvc() {
274+
let mut dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
275+
dir.push("target");
276+
dir.push("x86_64-pc-windows-msvc");
277+
dir.push("python3-dll");
278+
279+
let out_dir = dir.to_str().unwrap();
280+
generate_implib_for_target(out_dir, "x86_64", "msvc").unwrap();
281+
}
282+
283+
#[test]
284+
fn generate_msvc32() {
285+
let mut dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
286+
dir.push("target");
287+
dir.push("i686-pc-windows-msvc");
288+
dir.push("python3-dll");
289+
290+
let out_dir = dir.to_str().unwrap();
291+
generate_implib_for_target(out_dir, "x86", "msvc").unwrap();
292+
}
293+
294+
#[test]
295+
fn generate_msvc_arm64() {
296+
let mut dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
297+
dir.push("target");
298+
dir.push("aarch64-pc-windows-msvc");
299+
dir.push("python3-dll");
300+
301+
let out_dir = dir.to_str().unwrap();
302+
generate_implib_for_target(out_dir, "aarch64", "msvc").unwrap();
303+
}
304+
260305
#[test]
261306
fn abi_defs_len() {
262307
assert_eq!(STABLE_ABI_DEFS.len(), 48836);

0 commit comments

Comments
 (0)