Skip to content

Commit be01d87

Browse files
committed
Allow running remote-test-server on Apple simulators
1 parent 4cd91ef commit be01d87

File tree

1 file changed

+15
-4
lines changed
  • src/tools/remote-test-server/src

1 file changed

+15
-4
lines changed

src/tools/remote-test-server/src/main.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ impl Config {
5353
batch: false,
5454
bind: if cfg!(target_os = "android") || cfg!(windows) {
5555
([0, 0, 0, 0], 12345).into()
56+
} else if cfg!(target_env = "sim") {
57+
// iOS/tvOS/watchOS/visionOS simulators share network device
58+
// with the host machine.
59+
([127, 0, 0, 1], 12345).into()
5660
} else {
5761
([10, 0, 2, 15], 12345).into()
5862
},
@@ -262,10 +266,17 @@ fn handle_run(socket: TcpStream, work: &Path, tmp: &Path, lock: &Mutex<()>, conf
262266
cmd.args(args);
263267
cmd.envs(env);
264268

265-
// On windows, libraries are just searched in the executable directory,
266-
// system directories, PWD, and PATH, in that order. PATH is the only one
267-
// we can change for this.
268-
let library_path = if cfg!(windows) { "PATH" } else { "LD_LIBRARY_PATH" };
269+
let library_path = if cfg!(windows) {
270+
// On windows, libraries are just searched in the executable directory,
271+
// system directories, PWD, and PATH, in that order. PATH is the only
272+
// one we can change for this.
273+
"PATH"
274+
} else if cfg!(target_vendor = "apple") {
275+
// On Apple platforms, the environment variable is named differently.
276+
"DYLD_LIBRARY_PATH"
277+
} else {
278+
"LD_LIBRARY_PATH"
279+
};
269280

270281
// Support libraries were uploaded to `work` earlier, so make sure that's
271282
// in `LD_LIBRARY_PATH`. Also include our own current dir which may have

0 commit comments

Comments
 (0)