Changeset 6097
- Timestamp:
- 11/23/06 15:28:42
- Files:
-
- trunk/lib/jerbil/java_helper.rb (modified) (2 diffs)
- trunk/lib/jerbil/testng_task.rb (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jerbil/java_helper.rb
r6071 r6097 73 73 74 74 # Loads the java virtual machine. This method should only be invoked once, typically 75 # before task definitions in a Rakefile. 75 # before task definitions in a Rakefile. If the environment variable +JAVA_OPTS+ is 76 # set, it will be treated as extra parameter for the initial VM load. 76 77 # 77 78 # +classpath+:: a Rake::FileList containing the initial classpath. 78 # +build_dir+:: an optional directory (or list of directories) which will be used to resolve classes at runtime. 79 # +loggingprops+:: the location of a java.util.logging configuration file. 80 def load_jvm(classpath, build_dir = nil, loggingprops = nil ) 79 # +build_dir+:: an optional directory (or list of directories) which will be used to resolve classes at runtime. 80 # Available options: 81 # +:java_home+:: JDK path (defaults to ENV['JAVA_HOME'] 82 # +:java_opts+:: additional JVM arguments (defaults to ENV['JAVA_OPTS'] 83 # +:loggingprops+:: the location of a java.util.logging configuration file. 84 def load_jvm(classpath, build_dir = nil, options = {} ) 81 85 #need verbose java exceptions 82 86 $VERBOSE = true 83 87 84 88 #include tools.jar from JDK (needed for javac etc.) 85 java_home = ENV['JAVA_HOME'] 89 java_home = ENV['JAVA_HOME'] || options[:java_home] 86 90 classpath.include(File.join(java_home, "lib", "tools.jar")) if java_home 87 91 #include build jars and custom classloader 88 92 classpath.include(File.join(File.dirname(__FILE__), "../../buildsupport/*.jar")) 89 classpath.include(File.join(File.dirname(__FILE__), "../../classloader")) unless build_dir.nil?93 classpath.include(File.join(File.dirname(__FILE__), "../../classloader")) if build_dir 90 94 91 95 jvmargs = [] 92 jvmargs << "-Djava.util.logging.config.file=#{ loggingprops.to_s}" unless loggingprops.nil?96 jvmargs << "-Djava.util.logging.config.file=#{options[:loggingprops].to_s}" if options[:loggingprops] 93 97 94 98 if JAVA_DEBUG || ENV['JAVA_DEBUG'] … … 115 119 end 116 120 121 java_opts = ENV['JAVA_OPTS'] || options[:java_opts] 122 jvmargs.unshift(java_opts) if java_opts 123 117 124 begin 118 125 Rjb::load(classpath.to_cp, jvmargs) trunk/lib/jerbil/testng_task.rb
r6071 r6097 2 2 require 'rake/tasklib' 3 3 require 'set' 4 require 'builder' 4 5 require 'jerbil/java_helper' 5 6 … … 109 110 110 111 def onTestFailure(result) 111 $stderr.print " X"112 $stderr.print "F" unless Rake.application.options.trace 112 113 113 114 @failed_classes.add result.getTestClass.getName 114 115 begin 115 log get_test_name(result)116 log "Failure: " + get_test_name(result) 116 117 log result.getThrowable.getMessage 117 trace = printStream_to_s {|ps| result.getThrowable.printStackTrace(ps) } 118 log trace 118 log printStream_to_s {|ps| result.getThrowable.printStackTrace(ps) } 119 119 log "------------------------------------------------------------------------" 120 120 rescue … … 124 124 125 125 def onTestSkipped(result) 126 $stderr.print "S" unless Rake.application.options.trace 126 127 log "skipped test " + get_test_name(result) 127 128 end … … 133 134 134 135 def onTestSuccess(result) 135 $stderr.print "." 136 $stderr.print "." unless Rake.application.options.trace 136 137 end 137 138 … … 181 182 # +excluded+:: classes excluded from the test. 182 183 def create_suite_xml(filename, classnames, suitename="default", onetest=false, excluded = []) 183 require 'builder'184 185 184 File.open(filename, 'w') do |suitexml| 186 185 xml = Builder::XmlMarkup.new(:target=>suitexml, :indent=>4)
