Skip to content

Commit f08e00f

Browse files
committed
Rename run-make/issue-85441 and convert to rmake
1 parent 1e6544a commit f08e00f

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

tests/run-make/issue-85441/Makefile

-9
This file was deleted.
File renamed without changes.
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//@ only-msvc
2+
3+
// Tests that WS2_32.dll is not unnecessarily linked, see issue #85441
4+
5+
use run_make_support::object::{self, read::Object};
6+
use run_make_support::{rustc, tmp_dir};
7+
use std::fs;
8+
9+
fn main() {
10+
rustc().input("empty.rs").run();
11+
rustc().input("tcp.rs").run();
12+
13+
assert!(!links_ws2_32("empty.exe"));
14+
assert!(links_ws2_32("tcp.exe"));
15+
}
16+
17+
fn links_ws2_32(exe: &str) -> bool {
18+
let path = tmp_dir().join(exe);
19+
let binary_data = fs::read(path).unwrap();
20+
let file = object::File::parse(&*binary_data).unwrap();
21+
for import in file.imports().unwrap() {
22+
if import.library().eq_ignore_ascii_case(b"WS2_32.dll") {
23+
return true;
24+
}
25+
}
26+
false
27+
}

tests/run-make/windows-ws2_32/tcp.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
use std::net::TcpListener;
2+
3+
fn main() {
4+
TcpListener::bind("127.0.0.1:80").unwrap();
5+
}

0 commit comments

Comments
 (0)