Skip to content

Commit

Permalink
Adapt the build system to recent beekeeper updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Aug 18, 2019
1 parent a407c03 commit 4a785b6
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ def setUpSuite():
"""Configure the entire test suite.
This only needs to be run once, prior to the first test.
Part of the setup is to compile the support library;
this step can be skipped by exporting PRECOMPILE=false
into the test environment.
"""
global _output_dir
global _suite_configured

if _suite_configured:
return

Expand All @@ -54,6 +59,14 @@ def remove_output_dir():

os.environ['VOC_BUILD_DIR'] = os.path.join(_output_dir, 'build')
os.environ['VOC_DIST_DIR'] = os.path.join(_output_dir, 'dist')

# If the code has been precompiled, we don't have to
# compile it as part of the test suite setup.
precompile = os.environ.get('PRECOMPILE', 'true').lower() == 'true'
if not precompile:
_suite_configured = True
return

proc = subprocess.Popen(
"ant java",
stdin=subprocess.PIPE,
Expand Down Expand Up @@ -177,8 +190,8 @@ def compileJava(java_dir, java):
sources.append(class_file)

classpath = os.pathsep.join([
os.path.join('..', 'dist', 'python-java-support.jar'),
os.curdir,
os.path.abspath(os.path.join('dist', 'python-java-support.jar')),
os.path.abspath(java_dir),
])
proc = subprocess.Popen(
["javac", "-classpath", classpath] + sources,
Expand Down Expand Up @@ -328,8 +341,8 @@ def setUpClass(cls):
setUpSuite()
cls.temp_dir = os.path.join(_output_dir, 'temp')
classpath = os.pathsep.join([
os.path.join('dist', 'python-java-testdaemon.jar'),
os.path.join('dist', 'python-java-support.jar'),
os.path.abspath(os.path.join('dist', 'python-java-testdaemon.jar')),
os.path.abspath(os.path.join('dist', 'python-java-support.jar')),
])
cls.jvm = subprocess.Popen(
["java", "-classpath", classpath, "python.testdaemon.TestDaemon"],
Expand Down Expand Up @@ -609,9 +622,9 @@ def runAsJava(self, main_code, extra_code=None, args=None, timed=False):

else:
classpath = os.pathsep.join([
os.path.join('..', 'dist', 'python-java-support.jar'),
os.path.join('..', 'java'),
os.curdir,
os.path.abspath(os.path.join('dist', 'python-java-support.jar')),
os.path.abspath(os.path.join('java')),
os.path.abspath(self.temp_dir),
])

proc = subprocess.Popen(
Expand All @@ -637,7 +650,7 @@ def runAsJava(self, main_code, extra_code=None, args=None, timed=False):
if timed:
print(" Elapsed time: ", (t1_stop-t1_start), " sec")
print(" CPU process time: ", (t2_stop-t2_start), " sec")

return out


Expand Down

0 comments on commit 4a785b6

Please sign in to comment.