summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2023-03-17 11:11:17 +0530
committerGitHub <noreply@github.com>2023-03-17 07:41:17 +0200
commit0eabd2c6d67b5581f461b8bc8fbfaba0a1efca7a (patch)
tree02fef5ec0e4b3c9024e9a248e62d98277358199f
parente30d24be72cbdbadd937b1e1d7991c74829719f7 (diff)
chore: add test for macOS shared libraries (#18244)
Closes https://github.com/denoland/deno/issues/18243
-rw-r--r--cli/tests/integration/mod.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs
index 9c865f2ad..dd9a1437f 100644
--- a/cli/tests/integration/mod.rs
+++ b/cli/tests/integration/mod.rs
@@ -85,6 +85,43 @@ 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: [&'static 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.trim().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