Skip to content

Commit 69dd9af

Browse files
committed
Push Zinc support down into exec_maven
1 parent c77f951 commit 69dd9af

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

dev/run-tests.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,12 @@ def exec_maven(mvn_args=()):
232232
"""Will call Maven in the current directory with the list of mvn_args passed
233233
in and returns the subprocess for any further processing"""
234234

235-
run_cmd([os.path.join(SPARK_HOME, "build", "mvn"), "--force"] + mvn_args)
235+
zinc_port = get_zinc_port()
236+
os.environ["ZINC_PORT"] = "%s" % zinc_port
237+
zinc_flag = "-DzincPort=%s" % zinc_port
238+
flags = [os.path.join(SPARK_HOME, "build", "mvn"), "--force", zinc_flag]
239+
run_cmd(flags + mvn_args)
240+
kill_zinc_on_port(zinc_port)
236241

237242

238243
def exec_sbt(sbt_args=()):
@@ -288,15 +293,13 @@ def get_zinc_port():
288293
"""
289294
Get a randomized port on which to start Zinc
290295
"""
291-
292296
return random.randrange(3030, 4030)
293297

294298

295299
def kill_zinc_on_port(zinc_port):
296300
"""
297301
Kill the Zinc process running on the given port, if one exists.
298302
"""
299-
300303
cmd = ("/usr/sbin/lsof -P |grep %s | grep LISTEN "
301304
"| awk '{ print $2; }' | xargs kill") % zinc_port
302305
# TODO: Not sure what happens here if no process exists
@@ -306,7 +309,6 @@ def kill_zinc_on_port(zinc_port):
306309
def build_spark_maven(hadoop_version):
307310
# Enable all of the profiles for the build:
308311
build_profiles = get_hadoop_profiles(hadoop_version) + modules.root.build_profile_flags
309-
zinc_port = get_zinc_port()
310312
mvn_goals = ["clean", "package", "-DskipTests", "-DzincPort=%s" % zinc_port]
311313
profiles_and_goals = build_profiles + mvn_goals
312314
print("[info] Building Spark (w/Hive 0.13.1) using Maven with these arguments: ",
@@ -351,15 +353,13 @@ def detect_binary_inop_with_mima():
351353

352354

353355
def run_scala_tests_maven(test_profiles):
354-
zinc_port = get_zinc_port()
355-
mvn_test_goals = ["test", "--fail-at-end", "-DzincPort=%s" % zinc_port]
356+
mvn_test_goals = ["test", "--fail-at-end"]
356357
profiles_and_goals = test_profiles + mvn_test_goals
357358

358359
print("[info] Running Spark tests using Maven with these arguments: ",
359360
" ".join(profiles_and_goals))
360361

361362
exec_maven(profiles_and_goals)
362-
kill_zinc_on_port(zinc_port)
363363

364364

365365
def run_scala_tests_sbt(test_modules, test_profiles):

0 commit comments

Comments
 (0)