1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-13 02:52:54 -05:00
denoland-deno/cli/tests/integration/shared_library_tests.rs
Divy Srivastava 82643857cc
Revert "chore: use kqueue backend of notify on macOS" (#21039)
Reverts denoland/deno#21028

Reason:
https://github.com/notify-rs/notify/blob/main/notify/src/kqueue.rs#L79-L81
Need to wait for the watcher thread to spawn otherwise we hit flakes

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-11-01 15:54:27 +00:00

74 lines
2.4 KiB
Rust

// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
#[test]
// https://github.com/denoland/deno/issues/18266
fn linux_shared_libraries() {
use test_util as util;
const EXPECTED: [&str; 7] = [
"linux-vdso.so.1",
"libdl.so.2",
"libgcc_s.so.1",
"libpthread.so.0",
"libm.so.6",
"libc.so.6",
"/lib64/ld-linux-x86-64.so.2",
];
let ldd = std::process::Command::new("ldd")
.arg("-L")
.arg(util::deno_exe_path())
.output()
.expect("Failed to execute ldd");
let output = std::str::from_utf8(&ldd.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
);
}
}
#[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.1.0)
// /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1228.0.0)
// /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",
"/usr/lib/libiconv.2.dylib",
"/usr/lib/libSystem.B.dylib",
"/usr/lib/libobjc.A.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
);
}
}