From 7e08f3fd9392f43aed4e8067e57221eefb8757eb Mon Sep 17 00:00:00 2001 From: Justus Adam Date: Wed, 28 Jun 2023 16:40:43 -0700 Subject: [PATCH] Fixing test cases and allowing multiple `.expected` files --- .../function-contract/arbitrary_requires_fail.expected | 2 -- .../function-contract/arbitrary_requires_pass.expected | 2 -- tools/compiletest/src/runtest.rs | 7 ++++++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/expected/function-contract/arbitrary_requires_fail.expected b/tests/expected/function-contract/arbitrary_requires_fail.expected index 6b9a8e3d4bfb..132a7455f12d 100644 --- a/tests/expected/function-contract/arbitrary_requires_fail.expected +++ b/tests/expected/function-contract/arbitrary_requires_fail.expected @@ -2,9 +2,7 @@ RESULTS: Check 1: div.assertion.1 - Status: FAILURE - Description: "attempt to divide by zero" - - Location: arbitrary_requires_fail.rs:6:5 in function div Check 2: div.division-by-zero.1 - Status: SUCCESS - Description: "division by zero" - - Location: arbitrary_requires_fail.rs:6:5 in function div diff --git a/tests/expected/function-contract/arbitrary_requires_pass.expected b/tests/expected/function-contract/arbitrary_requires_pass.expected index e4033b162c0a..2a5317f904a4 100644 --- a/tests/expected/function-contract/arbitrary_requires_pass.expected +++ b/tests/expected/function-contract/arbitrary_requires_pass.expected @@ -2,9 +2,7 @@ RESULTS: Check 1: div.assertion.1 - Status: SUCCESS - Description: "attempt to divide by zero" - - Location: arbitrary_requires_pass.rs:6:5 in function div Check 2: div.division-by-zero.1 - Status: SUCCESS - Description: "division by zero" - - Location: arbitrary_requires_pass.rs:6:5 in function div diff --git a/tools/compiletest/src/runtest.rs b/tools/compiletest/src/runtest.rs index 59b79a24d8d9..946e8cd94712 100644 --- a/tools/compiletest/src/runtest.rs +++ b/tools/compiletest/src/runtest.rs @@ -375,7 +375,12 @@ impl<'test> TestCx<'test> { /// the expected output in `expected` file. fn run_expected_test(&self) { let proc_res = self.run_kani(); - let expected_path = self.testpaths.file.parent().unwrap().join("expected"); + let dot_expected_path = self.testpaths.file.with_extension("expected"); + let expected_path = if dot_expected_path.exists() { + dot_expected_path + } else { + self.testpaths.file.parent().unwrap().join("expected") + }; self.verify_output(&proc_res, &expected_path); }