summaryrefslogtreecommitdiff
path: root/tests/util
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-10-24 18:06:17 -0400
committerGitHub <noreply@github.com>2024-10-24 22:06:17 +0000
commite16230624747eccea7636b20b952df5899719336 (patch)
tree9a8ed7a52ca7042877101425e67a086f562f29ad /tests/util
parent8dd6177c624649d75ffcacca77e7c4f48cea07a2 (diff)
chore: remove print debugging from test server (#26529)
Accidentally added in https://github.com/denoland/deno/pull/26473/files
Diffstat (limited to 'tests/util')
-rw-r--r--tests/util/server/src/builders.rs1
-rw-r--r--tests/util/server/src/fs.rs5
-rw-r--r--tests/util/server/src/lib.rs18
-rw-r--r--tests/util/server/src/lsp.rs18
-rw-r--r--tests/util/server/src/npm.rs8
-rw-r--r--tests/util/server/src/pty.rs18
-rw-r--r--tests/util/server/src/servers/hyper_utils.rs8
-rw-r--r--tests/util/server/src/servers/mod.rs14
-rw-r--r--tests/util/server/src/servers/ws.rs7
9 files changed, 65 insertions, 32 deletions
diff --git a/tests/util/server/src/builders.rs b/tests/util/server/src/builders.rs
index 4a4b6a761..3bf5c704a 100644
--- a/tests/util/server/src/builders.rs
+++ b/tests/util/server/src/builders.rs
@@ -78,6 +78,7 @@ impl DiagnosticLogger {
logger.write_all(text.as_ref().as_bytes()).unwrap();
logger.write_all(b"\n").unwrap();
}
+ #[allow(clippy::print_stderr)]
None => eprintln!("{}", text.as_ref()),
}
}
diff --git a/tests/util/server/src/fs.rs b/tests/util/server/src/fs.rs
index 47d0d61fa..7feb0799a 100644
--- a/tests/util/server/src/fs.rs
+++ b/tests/util/server/src/fs.rs
@@ -285,7 +285,10 @@ impl PathRef {
#[track_caller]
pub fn assert_matches_file(&self, wildcard_file: impl AsRef<Path>) -> &Self {
let wildcard_file = testdata_path().join(wildcard_file);
- println!("output path {}", wildcard_file);
+ #[allow(clippy::print_stdout)]
+ {
+ println!("output path {}", wildcard_file);
+ }
let expected_text = wildcard_file.read_to_string();
self.assert_matches_text(&expected_text)
}
diff --git a/tests/util/server/src/lib.rs b/tests/util/server/src/lib.rs
index e4a2cc02e..67dbcd820 100644
--- a/tests/util/server/src/lib.rs
+++ b/tests/util/server/src/lib.rs
@@ -1,8 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
-#![allow(clippy::print_stdout)]
-#![allow(clippy::print_stderr)]
-
use std::collections::HashMap;
use std::env;
use std::io::Write;
@@ -302,7 +299,10 @@ async fn get_tcp_listener_stream(
.collect::<Vec<_>>();
// Eye catcher for HttpServerCount
- println!("ready: {name} on {:?}", addresses);
+ #[allow(clippy::print_stdout)]
+ {
+ println!("ready: {name} on {:?}", addresses);
+ }
futures::stream::select_all(listeners)
}
@@ -345,7 +345,10 @@ struct HttpServerStarter {
impl Default for HttpServerStarter {
fn default() -> Self {
- println!("test_server starting...");
+ #[allow(clippy::print_stdout)]
+ {
+ println!("test_server starting...");
+ }
let mut test_server = Command::new(test_server_path())
.current_dir(testdata_path())
.stdout(Stdio::piped())
@@ -360,7 +363,6 @@ impl Default for HttpServerStarter {
let mut ready_count = 0;
for maybe_line in lines {
if let Ok(line) = maybe_line {
- eprintln!("LINE: {}", line);
if line.starts_with("ready:") {
ready_count += 1;
}
@@ -480,6 +482,7 @@ pub fn run_collect(
} = prog.wait_with_output().expect("failed to wait on child");
let stdout = String::from_utf8(stdout).unwrap();
let stderr = String::from_utf8(stderr).unwrap();
+ #[allow(clippy::print_stderr)]
if expect_success != status.success() {
eprintln!("stdout: <<<{stdout}>>>");
eprintln!("stderr: <<<{stderr}>>>");
@@ -540,6 +543,7 @@ pub fn run_and_collect_output_with_args(
} = deno.wait_with_output().expect("failed to wait on child");
let stdout = String::from_utf8(stdout).unwrap();
let stderr = String::from_utf8(stderr).unwrap();
+ #[allow(clippy::print_stderr)]
if expect_success != status.success() {
eprintln!("stdout: <<<{stdout}>>>");
eprintln!("stderr: <<<{stderr}>>>");
@@ -564,6 +568,7 @@ pub fn deno_cmd_with_deno_dir(deno_dir: &TempDir) -> TestCommandBuilder {
.env("JSR_URL", jsr_registry_unset_url())
}
+#[allow(clippy::print_stdout)]
pub fn run_powershell_script_file(
script_file_path: &str,
args: Vec<&str>,
@@ -655,6 +660,7 @@ impl<'a> CheckOutputIntegrationTest<'a> {
}
pub fn wildcard_match(pattern: &str, text: &str) -> bool {
+ #[allow(clippy::print_stderr)]
match wildcard_match_detailed(pattern, text) {
WildcardMatchResult::Success => true,
WildcardMatchResult::Fail(debug_output) => {
diff --git a/tests/util/server/src/lsp.rs b/tests/util/server/src/lsp.rs
index 4e75cfadb..d34deb216 100644
--- a/tests/util/server/src/lsp.rs
+++ b/tests/util/server/src/lsp.rs
@@ -157,6 +157,7 @@ impl LspStdoutReader {
self.pending_messages.0.lock().len()
}
+ #[allow(clippy::print_stderr)]
pub fn output_pending_messages(&self) {
let messages = self.pending_messages.0.lock();
eprintln!("{:?}", messages);
@@ -573,6 +574,7 @@ impl LspClientBuilder {
for line in stderr.lines() {
match line {
Ok(line) => {
+ #[allow(clippy::print_stderr)]
if print_stderr {
eprintln!("{}", line);
}
@@ -587,7 +589,10 @@ impl LspClientBuilder {
continue;
}
Err(err) => {
- eprintln!("failed to parse perf record: {:#}", err);
+ #[allow(clippy::print_stderr)]
+ {
+ eprintln!("failed to parse perf record: {:#}", err);
+ }
}
}
}
@@ -782,11 +787,14 @@ impl LspClient {
std::thread::sleep(Duration::from_millis(20));
}
- eprintln!("==== STDERR OUTPUT ====");
- for line in found_lines {
- eprintln!("{}", line)
+ #[allow(clippy::print_stderr)]
+ {
+ eprintln!("==== STDERR OUTPUT ====");
+ for line in found_lines {
+ eprintln!("{}", line)
+ }
+ eprintln!("== END STDERR OUTPUT ==");
}
- eprintln!("== END STDERR OUTPUT ==");
panic!("Timed out waiting on condition.")
}
diff --git a/tests/util/server/src/npm.rs b/tests/util/server/src/npm.rs
index 4b17b95f7..31686fa85 100644
--- a/tests/util/server/src/npm.rs
+++ b/tests/util/server/src/npm.rs
@@ -103,7 +103,6 @@ impl TestNpmRegistry {
}
pub fn root_dir(&self) -> PathRef {
- eprintln!("root {}", self.local_path);
tests_path().join("registry").join(&self.local_path)
}
@@ -120,7 +119,6 @@ impl TestNpmRegistry {
}
pub fn registry_file(&self, name: &str) -> Result<Option<Vec<u8>>> {
- eprintln!("registry file {}", name);
self.get_package_property(name, |p| p.registry_file.as_bytes().to_vec())
}
@@ -138,7 +136,6 @@ impl TestNpmRegistry {
package_name: &str,
func: impl FnOnce(&CustomNpmPackage) -> TResult,
) -> Result<Option<TResult>> {
- eprintln!("get package property {}", package_name);
// it's ok if multiple threads race here as they will do the same work twice
if !self.cache.lock().contains_key(package_name) {
match get_npm_package(&self.hostname, &self.local_path, package_name)? {
@@ -155,7 +152,6 @@ impl TestNpmRegistry {
&self,
uri_path: &'s str,
) -> Option<(&'s str, &'s str)> {
- eprintln!("GEETT {}", uri_path);
let prefix1 = format!("/{}/", DENOTEST_SCOPE_NAME);
let prefix2 = format!("/{}%2f", DENOTEST_SCOPE_NAME);
@@ -198,10 +194,6 @@ fn get_npm_package(
local_path: &str,
package_name: &str,
) -> Result<Option<CustomNpmPackage>> {
- eprintln!(
- "get npm package {} {} {}",
- registry_hostname, local_path, package_name
- );
let registry_hostname = if package_name == "@denotest/tarballs-privateserver2"
{
"http://localhost:4262"
diff --git a/tests/util/server/src/pty.rs b/tests/util/server/src/pty.rs
index 8d42fed78..07659262c 100644
--- a/tests/util/server/src/pty.rs
+++ b/tests/util/server/src/pty.rs
@@ -61,7 +61,10 @@ impl Pty {
if is_windows && *IS_CI {
// the pty tests don't really start up on the windows CI for some reason
// so ignore them for now
- eprintln!("Ignoring windows CI.");
+ #[allow(clippy::print_stderr)]
+ {
+ eprintln!("Ignoring windows CI.");
+ }
false
} else {
true
@@ -250,11 +253,14 @@ impl Pty {
}
let text = self.next_text();
- eprintln!(
- "------ Start Full Text ------\n{:?}\n------- End Full Text -------",
- String::from_utf8_lossy(&self.read_bytes)
- );
- eprintln!("Next text: {:?}", text);
+ #[allow(clippy::print_stderr)]
+ {
+ eprintln!(
+ "------ Start Full Text ------\n{:?}\n------- End Full Text -------",
+ String::from_utf8_lossy(&self.read_bytes)
+ );
+ eprintln!("Next text: {:?}", text);
+ }
false
}
diff --git a/tests/util/server/src/servers/hyper_utils.rs b/tests/util/server/src/servers/hyper_utils.rs
index c2db7ea66..8e01151ed 100644
--- a/tests/util/server/src/servers/hyper_utils.rs
+++ b/tests/util/server/src/servers/hyper_utils.rs
@@ -42,7 +42,10 @@ where
let fut: Pin<Box<dyn Future<Output = Result<(), anyhow::Error>>>> =
async move {
let listener = TcpListener::bind(options.addr).await?;
- println!("ready: {}", options.addr);
+ #[allow(clippy::print_stdout)]
+ {
+ println!("ready: {}", options.addr);
+ }
loop {
let (stream, _) = listener.accept().await?;
let io = TokioIo::new(stream);
@@ -58,6 +61,7 @@ where
if let Err(e) = fut.await {
let err_str = e.to_string();
+ #[allow(clippy::print_stderr)]
if !err_str.contains("early eof") {
eprintln!("{}: {:?}", options.error_msg, e);
}
@@ -89,6 +93,7 @@ pub async fn run_server_with_acceptor<'a, A, F, S>(
if let Err(e) = fut.await {
let err_str = e.to_string();
+ #[allow(clippy::print_stderr)]
if !err_str.contains("early eof") {
eprintln!("{}: {:?}", error_msg, e);
}
@@ -135,6 +140,7 @@ async fn hyper_serve_connection<I, F, S>(
if let Err(e) = result {
let err_str = e.to_string();
+ #[allow(clippy::print_stderr)]
if !err_str.contains("early eof") {
eprintln!("{}: {:?}", error_msg, e);
}
diff --git a/tests/util/server/src/servers/mod.rs b/tests/util/server/src/servers/mod.rs
index 3a9c44010..6c960ce52 100644
--- a/tests/util/server/src/servers/mod.rs
+++ b/tests/util/server/src/servers/mod.rs
@@ -198,7 +198,6 @@ fn json_body(value: serde_json::Value) -> UnsyncBoxBody<Bytes, Infallible> {
/// Benchmark server that just serves "hello world" responses.
async fn hyper_hello(port: u16) {
- println!("hyper hello");
let addr = SocketAddr::from(([127, 0, 0, 1], port));
let handler = move |_: Request<hyper::body::Incoming>| async move {
Ok::<_, anyhow::Error>(Response::new(UnsyncBoxBody::new(
@@ -342,7 +341,10 @@ async fn get_tcp_listener_stream(
.collect::<Vec<_>>();
// Eye catcher for HttpServerCount
- println!("ready: {name} on {:?}", addresses);
+ #[allow(clippy::print_stdout)]
+ {
+ println!("ready: {name} on {:?}", addresses);
+ }
futures::stream::select_all(listeners)
}
@@ -358,7 +360,10 @@ async fn run_tls_client_auth_server(port: u16) {
while let Some(Ok(mut tls_stream)) = tls.next().await {
tokio::spawn(async move {
let Ok(handshake) = tls_stream.handshake().await else {
- eprintln!("Failed to handshake");
+ #[allow(clippy::print_stderr)]
+ {
+ eprintln!("Failed to handshake");
+ }
return;
};
// We only need to check for the presence of client certificates
@@ -405,7 +410,6 @@ async fn absolute_redirect(
.collect();
if let Some(url) = query_params.get("redirect_to") {
- println!("URL: {url:?}");
let redirect = redirect_resp(url.to_owned());
return Ok(redirect);
}
@@ -413,7 +417,6 @@ async fn absolute_redirect(
if path.starts_with("/REDIRECT") {
let url = &req.uri().path()[9..];
- println!("URL: {url:?}");
let redirect = redirect_resp(url.to_string());
return Ok(redirect);
}
@@ -1357,6 +1360,7 @@ async fn wrap_client_auth_https_server(port: u16) {
// here. Rusttls ensures that they are valid and signed by the CA.
match handshake.has_peer_certificates {
true => { yield Ok(tls); },
+ #[allow(clippy::print_stderr)]
false => { eprintln!("https_client_auth: no valid client certificate"); },
};
}
diff --git a/tests/util/server/src/servers/ws.rs b/tests/util/server/src/servers/ws.rs
index 815119b6a..dd4efbf65 100644
--- a/tests/util/server/src/servers/ws.rs
+++ b/tests/util/server/src/servers/ws.rs
@@ -76,6 +76,7 @@ pub async fn run_wss2_server(port: u16) {
let server: Handshake<_, Bytes> = h2.handshake(tls);
let mut server = match server.await {
Ok(server) => server,
+ #[allow(clippy::print_stdout)]
Err(e) => {
println!("Failed to handshake h2: {e:?}");
return;
@@ -87,6 +88,7 @@ pub async fn run_wss2_server(port: u16) {
};
let (recv, send) = match conn {
Ok(conn) => conn,
+ #[allow(clippy::print_stdout)]
Err(e) => {
println!("Failed to accept a connection: {e:?}");
break;
@@ -137,6 +139,7 @@ where
.map_err(|e| anyhow!("Error upgrading websocket connection: {}", e))
.unwrap();
+ #[allow(clippy::print_stderr)]
if let Err(e) = handler(ws).await {
eprintln!("Error in websocket connection: {}", e);
}
@@ -152,6 +155,7 @@ where
.serve_connection(io, service)
.with_upgrades();
+ #[allow(clippy::print_stderr)]
if let Err(e) = conn.await {
eprintln!("websocket server error: {e:?}");
}
@@ -162,16 +166,19 @@ async fn handle_wss_stream(
recv: Request<RecvStream>,
mut send: SendResponse<Bytes>,
) -> Result<(), h2::Error> {
+ #[allow(clippy::print_stderr)]
if recv.method() != Method::CONNECT {
eprintln!("wss2: refusing non-CONNECT stream");
send.send_reset(Reason::REFUSED_STREAM);
return Ok(());
}
+ #[allow(clippy::print_stderr)]
let Some(protocol) = recv.extensions().get::<h2::ext::Protocol>() else {
eprintln!("wss2: refusing no-:protocol stream");
send.send_reset(Reason::REFUSED_STREAM);
return Ok(());
};
+ #[allow(clippy::print_stderr)]
if protocol.as_str() != "websocket" && protocol.as_str() != "WebSocket" {
eprintln!("wss2: refusing non-websocket stream");
send.send_reset(Reason::REFUSED_STREAM);