diff mx/commands.py @ 11227:bd0e589a9a65

avoid use of JUnitWrapper when exactly one test is being executed
author Doug Simon <doug.simon@oracle.com>
date Tue, 06 Aug 2013 18:10:44 +0200
parents e36f7e4af7bf
children 2e38c55153e5
line wrap: on
line diff
--- a/mx/commands.py	Tue Aug 06 16:13:05 2013 +0200
+++ b/mx/commands.py	Tue Aug 06 18:10:44 2013 +0200
@@ -763,7 +763,14 @@
             prefixArgs = ['-esa', '-ea']
         else:
             prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea']
-        vm(prefixArgs + vmArgs + ['-cp', projectscp + os.pathsep + mxdir, name] + [testfile])
+        with open(testfile) as fp:
+            testclasses = [l.rstrip() for l in fp.readlines()]
+        if len(testclasses) == 1:
+            # Execute Junit directly when one test is being run. This simplifies
+            # replaying the VM execution in a native debugger (e.g., gdb).
+            vm(prefixArgs + vmArgs + ['-cp', projectscp, 'org.junit.runner.JUnitCore'] + testclasses)
+        else:
+            vm(prefixArgs + vmArgs + ['-cp', projectscp + os.pathsep + mxdir, name] + [testfile])
 
     try:
         _run_tests(args, harness, annotations, testfile)