Changeset 6097

Show
Ignore:
Timestamp:
11/23/06 15:28:42
Author:
jan
Message:

some jerbil enhancememnts

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jerbil/java_helper.rb

    r6071 r6097  
    7373     
    7474    # 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. 
    7677    # 
    7778    # +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 = {} )  
    8185      #need verbose java exceptions 
    8286      $VERBOSE = true 
    83      
     87    
    8488      #include tools.jar from JDK (needed for javac etc.) 
    85       java_home = ENV['JAVA_HOME'] 
     89      java_home = ENV['JAVA_HOME'] || options[:java_home]  
    8690      classpath.include(File.join(java_home, "lib", "tools.jar")) if java_home     
    8791      #include build jars and custom classloader 
    8892      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 
    9094       
    9195      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]  
    9397        
    9498      if JAVA_DEBUG || ENV['JAVA_DEBUG'] 
     
    115119      end 
    116120            
     121          java_opts = ENV['JAVA_OPTS'] || options[:java_opts] 
     122          jvmargs.unshift(java_opts) if java_opts 
     123           
    117124      begin 
    118125        Rjb::load(classpath.to_cp, jvmargs) 
  • trunk/lib/jerbil/testng_task.rb

    r6071 r6097  
    22require 'rake/tasklib' 
    33require 'set' 
     4require 'builder' 
    45require 'jerbil/java_helper' 
    56 
     
    109110         
    110111        def onTestFailure(result) 
    111           $stderr.print "X" 
     112          $stderr.print "F" unless Rake.application.options.trace 
    112113           
    113114          @failed_classes.add result.getTestClass.getName 
    114115          begin 
    115             log get_test_name(result) 
     116            log "Failure: " + get_test_name(result) 
    116117            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) } 
    119119            log "------------------------------------------------------------------------" 
    120120          rescue  
     
    124124         
    125125        def onTestSkipped(result) 
     126                  $stderr.print "S" unless Rake.application.options.trace 
    126127          log "skipped test " + get_test_name(result) 
    127128        end 
     
    133134         
    134135        def onTestSuccess(result) 
    135           $stderr.print "."        
     136          $stderr.print "." unless Rake.application.options.trace       
    136137        end 
    137138      
     
    181182        # +excluded+:: classes excluded from the test. 
    182183        def create_suite_xml(filename, classnames, suitename="default", onetest=false, excluded = []) 
    183           require 'builder' 
    184            
    185184          File.open(filename, 'w') do |suitexml| 
    186185            xml = Builder::XmlMarkup.new(:target=>suitexml, :indent=>4)