geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r502848 - in /geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS: Controller.groovy report/ReportGenerator.groovy
Date Sat, 03 Feb 2007 02:50:31 GMT
Author: jdillon
Date: Fri Feb  2 18:50:30 2007
New Revision: 502848

URL: http://svn.apache.org/viewvc?view=rev&rev=502848
Log:
Starting to hook up new reporting, need to test some things first, will break current reporting

Modified:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy?view=diff&rev=502848&r1=502847&r2=502848
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
Fri Feb  2 18:50:30 2007
@@ -207,13 +207,6 @@
             args << '--offline'
         }
         
-        // Append some extra arguments for 2.0 runtests to generate summary reports
-        switch (params.require('anthill.workflow')) {
-            case 'build 2.0':
-                args << '--summary'
-                break
-        }
-        
         args << params.require('tests')
         
         // Before we execute, save the parameters used to execute runtests
@@ -245,18 +238,13 @@
     }
     
     def collectResults = {
-        //
-        // TODO: use target/results for dir to be sucked up by AH
-        //
-        
         def workflowId = params.require('anthill.workflow.id')
         def iteration = params.require('iteration')
-        def webcontainer = params.require('webcontainer')
         
         def sourceDir = new File('project/tck-testsuite/target').canonicalFile
         log.info "Source dir: $sourceDir"
         
-        def targetDir = new File("reports/tck/$workflowId").canonicalFile
+        def targetDir = new File("target/results/$workflowId").canonicalFile
         log.info "Target dir: $targetDir"
         
         separator()
@@ -264,6 +252,9 @@
         ant.mkdir(dir: targetDir)
         
         ant.zip(destfile: "$targetDir/runtests-results-${iteration}.zip") {
+            zipfileset(dir: 'target') {
+                include(name: 'runtests.properties')
+            }
             zipfileset(dir: "$sourceDir") {
                 include(name: 'logs/**')
             }
@@ -272,78 +263,38 @@
             }
         }
         
-        
-        //
-        // HACK: Copy the summary.properties, since we need that for legacy report generation
-        //
-        
-        ant.copy(file: "$sourceDir/summary.properties",
-                 tofile: "$targetDir/summary-${iteration}.properties",
-                 verbose: true)
-        
         separator()
     }
     
     def generateReport = {
-        //
-        // NOTE: This is the legacy report based on summary.properties, which
-        //       will soon be replaced
-        //
-        
         def workflowId = params.require('anthill.workflow.id')
-        def webcontainer = params.require('webcontainer')
         
-        def sections = new File('project/tck-testsuite/sections.properties').canonicalFile
-        log.info "Using sections from: $sections"
+        def sourceDir = new File("target/results/$workflowId").canonicalFile
+        log.info "Source dir: $sourceDir"
+        assert sourceDir.exists() : sourceDir
         
-        def inputDir = new File("reports/tck/$workflowId").canonicalFile
-        log.info "Input dir: $inputDir"
-        assert inputDir.exists()
-        
-        def reportDir = new File('reports/tck/html').canonicalFile
-        log.info "Generating reports into: $reportDir"
-        ant.mkdir(dir: reportDir)
-        
-        // Invoke maven to generate the report
-        def maven = new MavenCommand(context)
-        maven.pom = 'project/tck-testsuite/pom.xml'
-        maven.offline = true
-        
-        def args = []
-        args << 'j2eetck:generate-report'
-        args << "-DsectionsFile=$sections"
-        args << "-DsummariesDirectory=$inputDir"
-        args << "-DreportsDirectory=ignored"
-        args << "-DoutputDirectory=$reportDir"
+        def targetDir = new File('target/report').canonicalFile
+        log.info "Target dir: $targetDir"
         
-        maven.execute(args)
-    }
-    
-    def testing = {
-        def resultsDir = new File('target/results').canonicalFile
-        ant.mkdir(dir: resultsDir)
+        // Find all of the result archives
+        def files = ant.fileScanner {
+            fileset(dir: sourceDir) {
+                include(name: 'runtests-results-*.zip')
+            }
+        }
         
-        params.store("$resultsDir/runtests.properties")
-        params.store("$resultsDir/runtests.xml", true)
+        def archives = []
         
-        /*
-        def workflowId = params.require('anthill.workflow.id')
-        def webcontainer = params.require('webcontainer')
+        log.info 'Result archives:'
+        files.each { file ->
+            log.info "    $file"
+            archives << file
+        }
         
-        def inputDir = new File("reports/tck/$workflowId").canonicalFile
-        log.info "Input dir: $inputDir"
-        assert inputDir.exists()
-        
-        def reportDir = new File('reports/tck/html').canonicalFile
-        log.info "Generating reports into: $reportDir"
-        ant.mkdir(dir: reportDir)
-        */
+        separator()
         
-        //
-        // TODO: Setup the input directory, unpack test results
-        //
+        new ReportGenerator(archives, targetDir).generate()
         
-        def generator = new ReportGenerator()
-        generator.generate()
+        separator()
     }
 }

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy?view=diff&rev=502848&r1=502847&r2=502848
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy
Fri Feb  2 18:50:30 2007
@@ -23,52 +23,177 @@
 
 package gbuild.config.projects.Geronimo_CTS.report
 
+import groovy.xml.MarkupBuilder
+
 import gbuild.system.LogSupport
 import gbuild.system.util.LazyProxy
-
-/*
-import org.apache.velocity.Template
-import org.apache.velocity.VelocityContext
-import org.apache.velocity.app.Velocity
-import org.apache.velocity.app.VelocityEngine
+import gbuild.system.util.Sorting
 
 import org.apache.commons.lang.time.StopWatch
-*/
 
+/**
+ * ???
+ */
 class ReportGenerator extends LogSupport
 {
+    AntBuilder ant = new AntBuilder()
+    
+    List archives
+    
+    File targetDir
+    
+    def ReportGenerator(List archives, File targetDir) {
+        this.archives = archives
+        this.targetDir = targetDir
+        
+        assert archives.size() > 0
+    }
+    
+    def loadProperties(file) {
+        assert file
+        
+        log.debug "Loading properties from: $file"
+        
+        file = new File("$file").canonicalFile
+        def props = new Properties()
+        
+        def input = file.newInputStream()
+        try {
+            props.load(input)
+        }
+        finally {
+            input.close()
+        }
+        
+        return props
+    }
+    
     def generate() {
+        ant.mkdir(dir: targetDir)
+        
+        def workDir = new File('target/work').canonicalFile
+        ant.delete(dir: workDir)
+        
+        // Process each result archive
+        archives.each { archive ->
+            log.info "Processing results archive: $archive"
+            
+            // Unpack the results
+            ant.unzip(src: archive, dest: workDir)
+            
+            //
+            // TODO: Load runtests.properties
+            //
+            // def props = loadProperties("$workDir/runtests.properties")
+            
+            def scanner = ant.fileScanner {
+            fileset(dir: workDir) {
+                    include(name: '**/*.jtr')
+                }
+            }
+            
+            def testCases = []
+            scanner.each { file ->
+                def factory = { new TestResult(it) }.curry(file)
+                testCases << new TestCase(new LazyProxy(factory))
+            }
+            
+            log.info 'Loading testsuite'
+            
+            def watch = new StopWatch()
+            watch.start()
+            
+            def testSuite = new TestSuite(testCases)
+            
+            watch.stop()
+            
+            log.info "Testsuite loaded in $watch"
+            
+            /*
+            testSuite.testCases.keySet().sort(Sorting.CASE_INSENSITIVE).each {
+                println it
+            }
+            
+            println "Summary"
+            
+            println testSuite.passCount
+            println testSuite.failureCount
+            println testSuite.duration
+            println testSuite.successRate
+            println testSuite.passed
+            */
+            
+            // Clean up
+            log.info "Cleaning up"
+            ant.delete(dir: workDir)
+        }
+        
+        //
+        // HACK: Just to make sure current AH config will soak up the output dir
+        //
+        
+        def writer = new File("$targetDir/index.html").newWriter()
+        def doc = new MarkupBuilder(writer)
+        
+        try {
+            doc.html() {
+                head() {
+                    title('testing')
+                }
+                body('testing')
+            }
+        }
+        finally {
+            writer.close()
+        }
+    }
+    
+    def foo() {
         def passing = new File('/Users/jason/Downloads/Client_compat12EntityCmpTest1.jtr')
         
         def failing = new File('/Users/jason/Downloads/MDBClient_test1.jtr')
         
-        // Curry the filename so we don't loose it due to scoping rules
-        def factory = { new TestResult(it) }.curry(failing)
-        def result = new LazyProxy(factory)
+        // 13, 20
+        def resultInput = new File('/Users/jason/Downloads/runtests-results-13')
         
-        println result.checksum
+        def ant = new AntBuilder()
+        
+        def scanner = ant.fileScanner {
+            fileset(dir: resultInput) {
+                include(name: '**/*.jtr')
+            }
+        }
+        
+        def testCases = []
+        scanner.each { file ->
+            def factory = { new TestResult(it) }.curry(file)
+            testCases << new TestCase(new LazyProxy(factory))
+        }
+        
+        println "Generating suite"
+        
+        def watch = new StopWatch()
+        watch.start()
+        
+        def testSuite = new TestSuite(testCases)
+        
+        watch.stop()
+        
+        println "Suite loaded in $watch"
         
         /*
-        // simple memory usage test (LazyProxy wins... ya)
-        def list = []
-        while (true) {
-            def failing = new File('/Users/jason/Downloads/MDBClient_test1.jtr')
-            
-            // def result = new TestResult(failing)
-            
-            // Curry the filename so we don't loose it due to scoping rules
-            def factory = { new TestResult(it) }.curry(failing)
-            def result = new LazyProxy(factory)
-            
-            failing = false
-            
-            println result.checksum
-            
-            list << result
-            
-            println list.size()
+        testSuite.testCases.keySet().sort(Sorting.CASE_INSENSITIVE).each {
+            println it
         }
         */
+        
+        println "Summary"
+        
+        println testSuite.passCount
+        println testSuite.failureCount
+        println testSuite.duration
+        println testSuite.successRate
+        println testSuite.passed
         
         //
         // TODO: Load all .jtr files, NOTE: Might not be able to load each .jtr



Mime
View raw message