Skip to content

Commit

Permalink
Run unit tests from cwd build/test
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios committed Sep 19, 2024
1 parent 598b9b2 commit 22c41c1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/SConscript
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import atexit
import subprocess
import os
from os.path import basename

Import("env platform party_classes common_sources")
arch_short = '64' if (env['bits'] == '64') else '86'
Expand All @@ -24,9 +25,18 @@ else:
test = env.Program("#build/bin/boe_test", test_sources + party_classes + common_sources)

def run_tests(env,target,source):
cwd = os.getcwd()
def run_subprocess():
app = str(source[0].abspath)
exit_code = subprocess.call(app)
# The target absolute path is in build/bin, but the dynamic libs are installed
# in build/test (the current directory when run_tests() is called)
app = basename(app)
# On Windows, subprocess exe paths are not relative to the cwd argument:
if str(platform) == "win32":
app = f'build/test/{app}'
else:
app = f'./{app}'
exit_code = subprocess.call(app, cwd=cwd)
if exit_code == 0:
open(target[0].abspath,'w').write("PASSED\n")
else:
Expand Down

0 comments on commit 22c41c1

Please sign in to comment.