Skip to content

Commit

Permalink
fix flaky tests by using exec in PTY tests (denoland#8525)
Browse files Browse the repository at this point in the history
  • Loading branch information
ry authored Nov 27, 2020
1 parent 29374db commit f60c80e
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions cli/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1451,8 +1451,7 @@ fn run_watch_fail() {
fn repl_test_pty_multiline() {
use std::io::Read;
use util::pty::fork::*;

let tests_path = util::tests_path();
let deno_exe = util::deno_exe_path();
let fork = Fork::from_ptmx().unwrap();
if let Ok(mut master) = fork.is_parent() {
master.write_all(b"(\n1 + 2\n)\n").unwrap();
Expand Down Expand Up @@ -1485,14 +1484,10 @@ fn repl_test_pty_multiline() {

fork.wait().unwrap();
} else {
util::deno_cmd()
.current_dir(tests_path)
.env("NO_COLOR", "1")
.arg("repl")
.spawn()
.unwrap()
.wait()
.unwrap();
std::env::set_var("NO_COLOR", "1");
let err = exec::Command::new(deno_exe).arg("repl").exec();
println!("err {}", err);
unreachable!()
}
}

Expand All @@ -1501,8 +1496,7 @@ fn repl_test_pty_multiline() {
fn repl_test_pty_unpaired_braces() {
use std::io::Read;
use util::pty::fork::*;

let tests_path = util::tests_path();
let deno_exe = util::deno_exe_path();
let fork = Fork::from_ptmx().unwrap();
if let Ok(mut master) = fork.is_parent() {
master.write_all(b")\n").unwrap();
Expand All @@ -1519,14 +1513,10 @@ fn repl_test_pty_unpaired_braces() {

fork.wait().unwrap();
} else {
util::deno_cmd()
.current_dir(tests_path)
.env("NO_COLOR", "1")
.arg("repl")
.spawn()
.unwrap()
.wait()
.unwrap();
std::env::set_var("NO_COLOR", "1");
let err = exec::Command::new(deno_exe).arg("repl").exec();
println!("err {}", err);
unreachable!()
}
}

Expand Down

0 comments on commit f60c80e

Please sign in to comment.