Skip to content

Commit 8051650

Browse files
committed
Fix runAsScript: No ".ex" After Build
Build: Do not search for executables if we are running as a script anyway.
1 parent e688212 commit 8051650

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

regtest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,10 @@ def test_suite(argv):
546546
else:
547547
comp_string, rc = suite.build_c(test=test, outfile=coutfile)
548548

549-
executable = test_util.get_recent_filename(bdir, "", ".ex")
549+
if test.run_as_script:
550+
executable = None
551+
else:
552+
executable = test_util.get_recent_filename(bdir, "", ".ex")
550553

551554
test.comp_string = comp_string
552555

suite.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,13 @@ def build_test_cmake(self, test, opts="", outfile=None):
12171217
outfile = outfile)
12181218

12191219
# make returns 0 if everything was good
1220-
if rc == 0:
1220+
if rc != 0:
1221+
self.log.fail("Failed to build test " + test.name)
1222+
1223+
# if we built a binary executable, we need to rename it into a
1224+
# GNUmake-like naming scheme so that the rest of the test logic can
1225+
# pick it up
1226+
elif not test.run_as_script:
12211227
# Find location of executable
12221228
path_to_exe = None
12231229

@@ -1239,8 +1245,9 @@ def build_test_cmake(self, test, opts="", outfile=None):
12391245
break
12401246

12411247
if path_to_bin is None:
1242-
self.log.warn("build successful but binary directory not found")
1243-
rc = 1
1248+
if not test.customRunCmd:
1249+
self.log.warn("build successful but binary directory not found")
1250+
rc = 1
12441251
else:
12451252
# Find location of executable
12461253
for root, dirnames, filenames in os.walk(path_to_bin):
@@ -1254,14 +1261,13 @@ def build_test_cmake(self, test, opts="", outfile=None):
12541261
break
12551262

12561263
if path_to_exe is None:
1257-
self.log.warn("build successful but executable not found")
1258-
rc = 1
1264+
if not test.customRunCmd:
1265+
self.log.warn("build successful but executable not found")
1266+
rc = 1
12591267
else:
12601268
# Copy and rename executable to test dir
12611269
shutil.move(f"{path_to_exe}",
12621270
f"{self.source_dir}/{test.buildDir}/{test.name}.ex")
1263-
else:
1264-
self.log.fail("Failed to build test " + test.name)
12651271

12661272
return comp_string, rc
12671273

0 commit comments

Comments
 (0)