diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2023-03-18 21:08:51 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-18 21:08:51 +0530 |
commit | 00f4c0df97a7b47495e077a8237142995cb78077 (patch) | |
tree | b6560156ed936f0e2feafb2f0ce402e5ed1589e3 | |
parent | d11e89127d723d84afe6e5603b731c014a54f9da (diff) |
chore(cli/tests): move macos_shared_libraries test to macos_test.rs (#18268)
As per review comment in original PR:
https://github.com/denoland/deno/pull/18244#issuecomment-1473769606
-rw-r--r-- | cli/tests/integration/macos_tests.rs | 40 | ||||
-rw-r--r-- | cli/tests/integration/mod.rs | 39 |
2 files changed, 42 insertions, 37 deletions
diff --git a/cli/tests/integration/macos_tests.rs b/cli/tests/integration/macos_tests.rs new file mode 100644 index 000000000..61ee461a3 --- /dev/null +++ b/cli/tests/integration/macos_tests.rs @@ -0,0 +1,40 @@ +// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. + +#[cfg(target_os = "macos")] +#[test] +// https://github.com/denoland/deno/issues/18243 +// This test is to prevent inadvertently linking to more shared system libraries that usually +// increases dyld startup time. +fn macos_shared_libraries() { + use test_util as util; + + // target/release/deno: + // /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0) + // /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1228.0.0) + // /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60420.60.24) + // /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) + // /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0) + const EXPECTED: [&str; 5] = + ["/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation", + "/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices", + "/System/Library/Frameworks/Security.framework/Versions/A/Security", + "/usr/lib/libiconv.2.dylib", + "/usr/lib/libSystem.B.dylib"]; + + let otool = std::process::Command::new("otool") + .arg("-L") + .arg(util::deno_exe_path()) + .output() + .expect("Failed to execute otool"); + + let output = std::str::from_utf8(&otool.stdout).unwrap(); + // Ensure that the output contains only the expected shared libraries. + for line in output.lines().skip(1) { + let path = line.split_whitespace().next().unwrap(); + assert!( + EXPECTED.contains(&path), + "Unexpected shared library: {}", + path + ); + } +} diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs index 04cd9f20c..4b258d130 100644 --- a/cli/tests/integration/mod.rs +++ b/cli/tests/integration/mod.rs @@ -85,43 +85,6 @@ macro_rules! command_step( } ); -#[cfg(target_os = "macos")] -#[test] -// https://github.com/denoland/deno/issues/18243 -fn macos_shared_libraries() { - use test_util as util; - - // target/release/deno: - // /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0) - // /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1228.0.0) - // /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60420.60.24) - // /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) - // /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0) - const EXPECTED: [&str; 5] = - ["/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation", - "/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices", - "/System/Library/Frameworks/Security.framework/Versions/A/Security", - "/usr/lib/libiconv.2.dylib", - "/usr/lib/libSystem.B.dylib"]; - - let otool = std::process::Command::new("otool") - .arg("-L") - .arg(util::deno_exe_path()) - .output() - .expect("Failed to execute otool"); - - let output = std::str::from_utf8(&otool.stdout).unwrap(); - // Ensure that the output contains only the expected shared libraries. - for line in output.lines().skip(1) { - let path = line.split_whitespace().next().unwrap(); - assert!( - EXPECTED.contains(&path), - "Unexpected shared library: {}", - path - ); - } -} - // These files have `_tests.rs` suffix to make it easier to tell which file is // the test (ex. `lint_tests.rs`) and which is the implementation (ex. `lint.rs`) // when both are open, especially for two tabs in VS Code @@ -162,6 +125,8 @@ mod js_unit_tests; mod lint; #[path = "lsp_tests.rs"] mod lsp; +#[path = "macos_tests.rs"] +mod macos; #[path = "node_compat_tests.rs"] mod node_compat_tests; #[path = "node_unit_tests.rs"] |