Skip to content

Commit 4e831d6

Browse files
committed
hrmm tests failing in CI kinda cringe
1 parent 7626af2 commit 4e831d6

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl SimpleOutput {
9090
}
9191

9292
pub fn success(&self) -> bool {
93-
self.status != 0
93+
self.status == 0
9494
}
9595
}
9696

src/runner.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ async fn wait_with_output_and_timeout(
201201
};
202202

203203
let ((), stdout, stderr, (timed_out, exit_status)) =
204-
try_join!(stdin_fut, stdout_fut, stderr_fut, wait_fut)?;
204+
dbg!(try_join!(stdin_fut, stdout_fut, stderr_fut, wait_fut))?;
205205

206206
Ok((SimpleOutput::new(stdout, stderr, exit_status), timed_out))
207207
}
@@ -584,6 +584,12 @@ impl<T: 'static> TestHandle<T> {
584584
}
585585

586586
pub async fn wait_all(&mut self) -> Result<Vec<TestResult<T>>, SpawnTestError> {
587+
let path = self._tmpdir.as_ref().unwrap();
588+
let mut x = tokio::fs::read_dir(path).await.unwrap();
589+
while let Some(e) = x.next_entry().await.unwrap() {
590+
dbg!(e.path());
591+
}
592+
587593
let len = self.len();
588594
let mut out = Vec::with_capacity(len);
589595
let out_slice = out.spare_capacity_mut();

tests/java.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async fn java_success() -> Result<(), Box<dyn Error>> {
2222
.run_command(["java", "Solution"])
2323
.rules(rules)
2424
.max_memory(MemorySize::from_mb(800))
25-
.timeout(Duration::from_secs(1))
25+
.timeout(Duration::from_secs(5))
2626
.build();
2727

2828
dbg!(&context);
@@ -50,6 +50,7 @@ async fn java_success() -> Result<(), Box<dyn Error>> {
5050
for x in compile.stderr().to_str_lossy().lines() {
5151
eprintln!(" {x}");
5252
}
53+
assert_eq!(compile.state(), CompileResultState::Pass);
5354

5455
let results = tests.wait_all().await?;
5556

@@ -78,7 +79,7 @@ async fn java_compile_fail() -> Result<(), Box<dyn Error>> {
7879
.run_command(["java", "Solution"])
7980
.rules(rules)
8081
.max_memory(MemorySize::from_mb(800))
81-
.timeout(Duration::from_secs(1))
82+
.timeout(Duration::from_secs(5))
8283
.build();
8384

8485
dbg!(&context);
@@ -96,7 +97,6 @@ async fn java_compile_fail() -> Result<(), Box<dyn Error>> {
9697

9798
assert!(compile.is_some());
9899
let compile = compile.unwrap();
99-
assert_eq!(compile.state(), CompileResultState::Pass);
100100
eprintln!("COMPILE OUTPUT:");
101101
eprintln!("Status: {}", compile.exit_status());
102102
eprintln!("STDOUT:");
@@ -107,6 +107,7 @@ async fn java_compile_fail() -> Result<(), Box<dyn Error>> {
107107
for x in compile.stderr().to_str_lossy().lines() {
108108
eprintln!(" {x}");
109109
}
110+
assert_eq!(compile.state(), CompileResultState::Pass);
110111

111112
Ok(())
112113
}

0 commit comments

Comments
 (0)