Skip to content

Commit 1b2c04e

Browse files
authored
Haskell Tests - allow displaying of compilation errors (#554)
1 parent 5922391 commit 1b2c04e

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

Changelog.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# CHANGELOG
22
All notable changes to this project will be documented here.
33

4+
## [unreleased]
5+
- Haskell Tests - allow displaying of compilation errors (#554)
6+
47
## [v2.5.1]
58
- Ensure all Haskell test cases still run within same file when there are failed test cases (#543)
69

server/autotest_server/testers/haskell/haskell_tester.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,14 @@ def run_haskell_tests(self) -> Dict[str, List[Dict[str, Union[int, str]]]]:
120120
subprocess.run(cmd, stdout=subprocess.DEVNULL, universal_newlines=True, check=True)
121121
with tempfile.NamedTemporaryFile(mode="w+", dir=this_dir) as sf:
122122
cmd = ["stack", "runghc", *STACK_OPTIONS, "--", f"-i={haskell_lib}", f.name, f"--stats={sf.name}"]
123-
try:
124-
subprocess.run(
125-
cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, universal_newlines=True, check=True
126-
)
127-
except subprocess.CalledProcessError as e:
128-
if e.returncode == 1:
129-
pass
130-
else:
131-
raise Exception(e)
132-
results[test_file] = self._parse_test_results(csv.reader(sf))
123+
out = subprocess.run(
124+
cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, universal_newlines=True, check=False
125+
)
126+
r = self._parse_test_results(csv.reader(sf))
127+
if r:
128+
results[test_file] = r
129+
else:
130+
raise Exception(out.stderr)
133131
return results
134132

135133
@Tester.run_decorator

0 commit comments

Comments
 (0)