Skip to content

Commit

Permalink
chore: add test for Linux shared libraries (denoland#18461)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnester committed Mar 28, 2023
1 parent 795ecfa commit d0a0ff6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
35 changes: 35 additions & 0 deletions cli/tests/integration/linux_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.

#[cfg(target_os = "linux")]
#[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
);
}
}
2 changes: 2 additions & 0 deletions cli/tests/integration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ mod install;
mod js_unit_tests;
#[path = "lint_tests.rs"]
mod lint;
#[path = "linux_tests.rs"]
mod linux;
#[path = "lsp_tests.rs"]
mod lsp;
#[path = "macos_tests.rs"]
Expand Down

0 comments on commit d0a0ff6

Please sign in to comment.