#!/usr/bin/env perl

# Script to run generated T3 test-suites and measure coverage

# Need java 8
my $JAVA = "c:/apps/Java/jdk1.8.0/bin/java" ;
# used separator in class-path
my $CPseparator = ";" ;

my $targetHome = "joda-time-2.3" ;
my $targetClassDir = "../" . $targetHome . "/classes" ;
my $targetInstrumetedClassDir = "../" . $targetHome . "/iclasses" ;

my $T3replay = " Sequenic.T3.T3Replay "  ;
my $T3jar = "../../../T3/v0/build/T3v0.jar"  ;
my $T3params = "--multicore " 
                . "--bulk org.joda.time "
                . "--silent "
                . "--norethrow " 
                . "-lf t3replay "  
                ;
                
my $suiteDir = "./suites"    ;           

my $coberturaHome = "c:/apps/cobertura" ;
my $coberturaJar  = $coberturaHome . "/cobertura-2.0.3.jar" ;

my $classpath = "\'" . $T3jar 
                . $CPseparator 
                . $coberturaJar
                . $CPseparator 
                . $targetInstrumetedClassDir
                . $CPseparator 
                . $targetClassDir
                . "\'" ;
            
# to run suites-replay :
sub runT3Replay {
    system(
     $JAVA . " -ea -cp " . $classpath
     . " -Dnet.sourceforge.cobertura.datafile=./coverage/joda.ser "   
     . $T3replay . " " . $T3params 
     . " " . $suiteDir
     # . " " . $suiteDir . "/org.joda.time.field.OffsetDateTimeField__1378127950609.tr"
    ) ;
}

# now to run:
runT3Replay() ; 