Skip to content

Commit 44839b6

Browse files
committed
make mason errors more clear
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
1 parent ae93997 commit 44839b6

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

test/mason/MasonBashSubTest

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ class Test:
102102
return path
103103
return None
104104

105+
def _nice_output_name(self) -> str:
106+
testdir = sub_test_util.get_test_dir(str(chpl_home))
107+
localdir = sub_test_util.get_local_dir(testdir)
108+
return f"{localdir}/{self.source_file.stem}"
109+
105110
def _execute(self) -> Tuple[Optional[int], Optional[Path]]:
106111
executable = self.source_file
107112

@@ -167,7 +172,7 @@ class Test:
167172
!= 0
168173
):
169174
sys.stdout.write(
170-
f"[Error matching executable output for {self.source_file.stem}]\n"
175+
f"[Error matching executable output for {self._nice_output_name()}]\n"
171176
)
172177
return False
173178
return True
@@ -184,13 +189,13 @@ class Test:
184189

185190
if retcode != 0:
186191
sys.stdout.write(
187-
"[Error matching output for {} (exited with exit code {})]\n".format(self.source_file.stem, retcode)
192+
"[Error matching output for {} (exited with exit code {})]\n".format(self._nice_output_name(), retcode)
188193
)
189194
elif self.good_file is None:
190195
self._cleanup(executable_output)
191196
sys.stdout.write(
192197
"[Success matching output for {}]\n".format(
193-
self.source_file.stem
198+
self._nice_output_name()
194199
)
195200
)
196201
else:
@@ -200,7 +205,7 @@ class Test:
200205
self._cleanup(executable_output)
201206
sys.stdout.write(
202207
"[Success matching output for {}]\n".format(
203-
self.source_file.stem
208+
self._nice_output_name()
204209
)
205210
)
206211
elapsed = time.time() - start_time
@@ -233,6 +238,14 @@ def dirSkipIf(d: Path):
233238
def main():
234239
sub_test_util.printStartOfTestMsg(time.localtime())
235240

241+
242+
compiler=sys.argv[1]
243+
chpl_base = sub_test_util.get_chpl_base(compiler)
244+
chpl_home_from_chpl = sub_test_util.get_chpl_home(chpl_base)
245+
if Path(chpl_home_from_chpl).resolve() != chpl_home.resolve():
246+
sys.stdout.write(f"[Error: chpl_home from chpl {chpl_home_from_chpl} does not match expected {chpl_home}]\n")
247+
sys.exit(1)
248+
236249
d = Path(os.path.dirname(os.path.abspath(__file__)))
237250

238251
if dirSkipIf(d):

0 commit comments

Comments
 (0)