1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

refactor: move shared library tests to their own file (#18479)

This commit is contained in:
Ryan Dahl 2023-03-28 13:40:43 -04:00 committed by Matt Mastracci
parent 0df7e6636a
commit dcf384259f
3 changed files with 36 additions and 39 deletions

View file

@ -1,35 +0,0 @@
// 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
);
}
}

View file

@ -123,12 +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"]
mod macos;
#[path = "node_compat_tests.rs"]
mod node_compat_tests;
#[path = "node_unit_tests.rs"]
@ -139,6 +135,8 @@ mod npm;
mod repl;
#[path = "run_tests.rs"]
mod run;
#[path = "shared_library_tests.rs"]
mod shared_library_tests;
#[path = "task_tests.rs"]
mod task;
#[path = "test_tests.rs"]

View file

@ -1,5 +1,39 @@
// 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