Commit: 697fe6246c2696b9fce3679dfea49ea32690a9ab Author: Matt Ficken <v-maf...@microsoft.com> Sat, 4 May 2013 00:04:05 -0700 Parents: 24eb8fd00939991fd9f16cdf694d62158b20b2e4 Branches: master
Link: http://git.php.net/?p=pftt2.git;a=commitdiff;h=697fe6246c2696b9fce3679dfea49ea32690a9ab Log: better support for hanging processes (primarily builtin web server). Former-commit-id: a58d023ef60566602aceae49116781eadbd59f14 Changed paths: D PBCReportGen.groovy D PHPTReportGen.groovy D PfttAuto.java D PhpUnitReportGen.groovy D UITestReportGen.groovy
diff --git a/PBCReportGen.groovy b/PBCReportGen.groovy deleted file mode 100644 index 70cbdcc..0000000 --- a/PBCReportGen.groovy +++ /dev/null @@ -1,231 +0,0 @@ -package com.mostc.pftt.results -/* -#%powershell1.0% -# -# File: results-template.ps1 -# Description: Output $data into html table. This script is meant to be called from summarize-results.ps1. -# - -Function gaincalc ( $a=0, $b=0 ) { - if ( ($a -ne 0) -and ($b -ne 0) ) { - $c = ($a / $b) - 1 - - switch ($c*100) { - {$_ -ge 0 -and $_ -le 3} {$script:gainclass="none"} - {$_ -gt 3 -and $_ -le 7} {$script:gainclass="gainpossmall"} - {$_ -ge 0 -and $_ -gt 7} {$script:gainclass="gainpos"} - {$_ -lt 0 -and $_ -ge -3} {$script:gainclass="none"} - {$_ -lt -3 -and $_ -ge -7} {$script:gainclass="gainnegsmall"} - {$_ -lt 0 -and $_ -lt -7} {$script:gainclass="gainneg"} - Default { $script:gainclass="none" } - } - - "{0:P2}" -f $c - } - else { - $script:gainclass="none" - } -} - - -write-output " - -<html> -<head> - <style type=text/css> - .data td { border:1px solid black; } - .iis { background-color:#E6B8B7; } - .iiswincache { background-color: #DA9694; } - .apache { background-color: #C5D9F1; } - .apachenoigbinary { background-color: #8DB4E2; } - .apachewithigbinary { background-color: #538DD5; } - .gainpos { background-color: #00A84C; } - .gainpossmall { background-color: #00D661; } - .gainneg { background-color: #FF2929; } - .gainnegsmall { background-color: #DA9694; } - </style> - </head> - -<body> -<table border=0 cellpadding=0 cellspacing=0 width=600> -<tr> -<td> <strong> PHP Performance </strong> </td> -<td> <strong> Hardware & Environment </strong> </td> -</tr><tr> -<td>$PHP1 - $PHP2</td> -<td>Dell R710</td> -</tr><tr> -<td> </td> -<td>CPU - Intel Quad core @ 2.26Ghz (x2) L5520</td> -</tr><tr> -<td> </td> -<td>Memory - 12GB RAM</td> -</tr><tr> -<td> </td> -<td>HD - 147GB SAS RAID 1</td> -</tr><tr> -<td> </td> -<td>NIC - 1Gbps Intel</td> -</tr><tr> -<td> </td> -<td>Windows 2008 R2 - SP1</td> -</tr><tr> -<td> </td> -<td>php-web01.ctac.nttest.microsoft.com</td> -</tr> -<table> -<p> </p> - -<table border=0 cellpadding=0 cellspacing=0 width=1628 class=data> - -<!-- Header Labels --> - <tr> - <td colspan=4></td> - <td colspan=6 class=iis>IIS 7.5</td> - <td colspan=9 class=apache>Apache 2.2</td> - </tr> - - <tr> - <td colspan=4></td> - <td colspan=3 rowspan=2 class=iis>No Cache</td> - <td colspan=3 rowspan=2 class=iiswincache>WinCache</td> - <td colspan=3 rowspan=2 class=apache>No Cache</td> - <td colspan=6 class=apachenoigbinary>APC</td> - </tr> - <tr> - <td></td> - <td colspan=3>Load Agents</td> - <td colspan=3 class=apachenoigbinary>-igbinary</td> - <td colspan=3 class=apachewithigbinary>+igbinary</td> - </tr> - <!-- Header Labels --> - - <tr> - <td>Application</td> - <td>Physical</td> - <td>Virtual</td> - <td></td> - -<!-- IIS No Cache --> - - <td>$PHP1</td> - <td>$PHP2</td> - <td>gain</td> - -<!-- IIS Cache --> - <td>$PHP1</td> - <td>$PHP2</td> - <td>gain</td> - -<!-- Apache No Cache --> - <td>$PHP1</td> - <td>$PHP2</td> - <td>gain</td> - -<!-- Apache Cache -igbinary --> - <td>$PHP1</td> - <td>$PHP2</td> - <td>gain</td> - -<!-- Apache Cache +igbinary --> - <td>$PHP1</td> - <td>$PHP2</td> - <td>gain</td> - </tr> - -<!-- Results --> -" - -Foreach ( $app in $appnames ) { - ## Notes: $data[App_Name][Apache|IIS][cache|nocache|cachenoigbinary|cachewithigbinary][php1|php2][ver|tps8|tps16|tps32] - - write-output " - <tr> - <td rowspan=3>$app</td> - " - - Foreach ( $virt in $VIRTUAL ) { - $gain = "" - $gainclass = "" - if ( $virt -ne "8" ) { - write-output "<tr>" - } - - write-output " - <td>2</td> - <td>$virt</td> - <td> </td> - - <!-- IIS - No Cache --> - <td class=iis>" $data[$app]["IIS"]["nocache"]["php1"]["tps$virt"] "</td> - <td class=iis>" $data[$app]["IIS"]["nocache"]["php2"]["tps$virt"] "</td>" - - $gain = gaincalc $data[$app]["IIS"]["nocache"]["php2"]["tps$virt"] $data[$app]["IIS"]["nocache"]["php1"]["tps$virt"] - write-output " - - <td class=$gainclass> $gain - </td> <!-- Gain --> - - <!-- IIS - Cache --> - <td class=iiswincache>" $data[$app]["IIS"]["cache"]["php1"]["tps$virt"] "</td> - <td class=iiswincache>" $data[$app]["IIS"]["cache"]["php2"]["tps$virt"] "</td>" - - - $gain = gaincalc $data[$app]["IIS"]["cache"]["php2"]["tps$virt"] $data[$app]["IIS"]["cache"]["php1"]["tps$virt"] - write-output " - - <td class=$gainclass> $gain - </td> <!-- Gain --> - - <!-- Apache - No Cache --> - <td class=apache>" $data[$app]["Apache"]["nocache"]["php1"]["tps$virt"] "</td> - <td class=apache>" $data[$app]["Apache"]["nocache"]["php2"]["tps$virt"] "</td>" - - $gain = gaincalc $data[$app]["Apache"]["nocache"]["php2"]["tps$virt"] $data[$app]["Apache"]["nocache"]["php1"]["tps$virt"] - write-output " - - <td class=$gainclass> $gain - </td> <!-- Gain --> - - <!-- Apache - Cache -igbinary --> - <td class=apachenoigbinary>" $data[$app]["Apache"]["cachenoigbinary"]["php1"]["tps$virt"] "</td> - <td class=apachenoigbinary>" $data[$app]["Apache"]["cachenoigbinary"]["php2"]["tps$virt"] "</td>" - - $gain = gaincalc $data[$app]["Apache"]["cachenoigbinary"]["php2"]["tps$virt"] $data[$app]["Apache"]["cachenoigbinary"]["php1"]["tps$virt"] - write-output " - - <td class=$gainclass> $gain - </td> <!-- Gain --> - - <!-- Apache - Cache +igbinary --> - <td class=apachewithigbinary>" $data[$app]["Apache"]["cachewithigbinary"]["php1"]["tps$virt"] "</td> - <td class=apachewithigbinary>" $data[$app]["Apache"]["cachewithigbinary"]["php2"]["tps$virt"] "</td>" - - $gain = gaincalc $data[$app]["Apache"]["cachewithigbinary"]["php2"]["tps$virt"] $data[$app]["Apache"]["cachewithigbinary"]["php1"]["tps$virt"] - write-output " - - <td class=$gainclass> $gain - </td> <!-- Gain --> - </tr> - " - } ## End Foreach -} ## End Foreach - -write-output " -</table> -<p> </p> -<p> </p> -" - -if ( $errlog -ne "" ) { - write-output "<strong>Error Log:</strong> <br/>" - write-output "$errlog" -} - -write-output " -</body> -</html> -" - - -*/ diff --git a/PHPTReportGen.groovy b/PHPTReportGen.groovy deleted file mode 100644 index f4d87b2..0000000 --- a/PHPTReportGen.groovy +++ /dev/null @@ -1,363 +0,0 @@ -package com.mostc.pftt.results - -import java.io.StringWriter; - -import com.mostc.pftt.model.core.EPhptTestStatus; -import com.mostc.pftt.model.core.EBuildBranch; - -class PHPTReportGen extends AbstractReportGen { - protected AbstractPhptRW base_telem, test_telem; - protected int row; - protected StringWriter sw; - - public PHPTReportGen(AbstractPhptRW base_telem, AbstractPhptRW test_telem) { - this.base_telem = base_telem; - this.test_telem = test_telem; - - sw = new StringWriter(); - } - - protected static String bav(EBuildBranch branch, String version) { - if (version==null) - return 'unknown'; // fallback - else if (!version.startsWith('r')) - version = 'r' + version; - return branch.toString()+' '+version; - } - - @Override - public void run(ConsoleManager cm, boolean abbreviated) { - def scenario_set_title = test_telem.getScenarioSetNameWithVersionInfo() - def test_scenario_set_title = scenario_set_title + ' (Test)' - if (scenario_set_title!=base_telem.getScenarioSetNameWithVersionInfo()) { - // for some reason, comparing runs of 2 different SAPIs... make that clear in report. - scenario_set_title = base_telem.getScenarioSetNameWithVersionInfo()+' (Base) with ' + test_telem.getScenarioSetNameWithVersionInfo()+' (Test)' - } - String base_build_branch_and_version = base_telem.getBuildInfo().toString(); - String base_test_pack_branch_and_version = bav(base_telem.getTestPackBranch(), base_telem.getTestPackVersion()) - String test_build_branch_and_version = test_telem.getBuildInfo().toString(); - String test_test_pack_branch_and_version = bav(test_telem.getTestPackBranch(), test_telem.getTestPackVersion()) - - def os_names = abbreviated?['Localhost']:base_telem.getBuildInfo().isX64()?['Win 2008r2 SP0 x64', 'Win 2008r2 SP1 x64', 'Win 2012 SP0 x64', 'Win 2008 SP1 x64', 'Win 2008 SP2 x64', 'Win 7 SP0 x64', 'Win 7 SP1 x64', 'Win 8 SP0 x64', 'Win Vista SP2 x64']:['Win 2008r2 SP0 x64', 'Win 2008r2 SP1 x64', 'Win 2012 SP0 x64', 'Win 2008 SP1 x64', 'Win 2008 SP1 x86', 'Win 2008 SP2 x64', 'Win 2008 SP2 x86', 'Win 7 SP0 x64', 'Win 7 SP0 x86', 'Win 7 SP1 x64', 'Win 7 SP1 x86', 'Win 8 SP0 x64', 'Win Vista SP2 x64', 'Win Vista SP2 x86']; - - row=1 -def html = new groovy.xml.MarkupBuilder(sw) -html.html { - body { - h1("PFTT Core PHPT Report") - - // warnings - if (cm.isSkipSmokeTests()) { - p('Warning: Smoke tests were not run on build. Smoke tests were disabled with -skip_smoke_tests console option.') - } - if (!cm.isThreadSafety()) { - p('Warning: Some failures may be due to race conditions. Thread safety was disabled with -no_thread_safety console option.') - } - if (test_telem.getOSName() != base_telem.getOSName()) { - // for some reason, comparing runs from two different OSes, make it clear in report. - p("Warning: Base OS: ${base_telem.getOSName()} Test OS: ${test_telem.getOSName()}") - } - // - - table(border: 1, cellspacing:0, cellpadding:8) { - /* --------------- begin headers -------------- */ - tr { - td(colspan:15) { - b(base_build_branch_and_version+" (Base)") - span("with") - b(test_build_branch_and_version+" (Test)") - - // check that the build and test pack versions all match - if ( - base_telem.getTestPackBranch()==base_telem.getBuildInfo().getBuildBranch() && - test_telem.getTestPackBranch()==test_telem.getBuildInfo().getBuildBranch() && - ( - base_telem.getTestPackVersion()==base_telem.getBuildInfo().getVersionRevision() - ||base_telem.getBuildInfo().getVersionRevision().contains(base_telem.getTestPackVersion()) - ) && ( - test_telem.getTestPackVersion()==test_telem.getBuildInfo().getVersionRevision() - ||test_telem.getBuildInfo().getVersionRevision().contains(test_telem.getTestPackVersion()) - )) { - // - span("(using test-packs included with each build)") - } else { - // if not, make it clear which versions of which were used - span("(using $base_test_pack_branch_and_version with $base_build_branch_and_version and $test_test_pack_branch_and_version with $test_build_branch_and_version)") - } - } - } // tr - tr { - td(colspan:15, scenario_set_title) - } - tr { - td(colspan:2) { p(align: 'center', 'OS') } - td(colspan:7, style:'background:#CCFF66') {} - td(colspan:2, style:'background:yellow') { - p(align:'center', 'Skip') - } - td(colspan:2, style:'background:#FFC000') { - p(align:'center', 'Test Bug') - } - td(colspan:2, style:'background:#F28020') { - p(align:'center', 'PFTT Bug') - } - } // tr - tr { - td(colspan:2) {} - td(style:'background:#CCFF66') { - p('Pass Rate(%)') - } - td(colspan:1, style:'background:#CCFF66') { - p('Pass') - } - td(colspan:2, style:'background:#CCFF66') { - p('Fail') - } - td(colspan:2, style:'background:#CCFF66') { - p('Crash') - } - td(colspan:1, style:'background:#CCFF66') { - p('XFail') - } - td(colspan:1, style:'background:yellow') { - p('Skip') - } - td(colspan:1, style:'background:yellow') { - p('XSkip*') - } - td(colspan:1, style:'background:#FFC000') { - p('XFail (Work)') - } - td(colspan:1, style:'background:#FFC000') { - p('Bork**') - } - td(colspan:1, style:'background:#F28020') { - p('Unsupported***') - } - td(colspan:1, style:'background:#F28020') { - p('Exceptions') - } - } // tr - /* --------------- end headers -------------- */ - - os_names.each { os_name -> - tr { - td(row++) - td(os_name) - td(style:'background:#CCFF66', PhpResultPack.round1(test_telem.passRate())) - td(style:'background:#CCFF66', test_telem.count(EPhptTestStatus.PASS)) - td(style:'background:#CCFF66', test_telem.count(EPhptTestStatus.FAIL)) - int cmp_fail = test_telem.count(EPhptTestStatus.FAIL) - base_telem.count(EPhptTestStatus.FAIL); - td(style:'background:'+(cmp_fail>0?'#FF0000':cmp_fail<0?'#96DC28':'#CCFF66'), cmp_symbol(cmp_fail)) - // highlight crash count if > 0 - int crash_count = test_telem.count(EPhptTestStatus.CRASH); - td(style:crash_count>0?'background: #ff0000':'background:#CCFF66', crash_count) - int cmp_crash = test_telem.count(EPhptTestStatus.CRASH) - base_telem.count(EPhptTestStatus.CRASH); - td(style:'background:'+(cmp_crash>0?'#FF0000':cmp_crash<0?'#96DC28':'#CCFF66'), cmp_symbol(cmp_crash)) - // - td(style:'background:#CCFF66', test_telem.count(EPhptTestStatus.XFAIL)) - td(style:'background:yellow', test_telem.count(EPhptTestStatus.SKIP)) - td(style:'background:yellow', test_telem.count(EPhptTestStatus.XSKIP)) - td(style:'background:#FFC000', test_telem.count(EPhptTestStatus.XFAIL_WORKS)) - td(style:'background:#FFC000', test_telem.count(EPhptTestStatus.BORK)) - td(style:'background:#F28020', test_telem.count(EPhptTestStatus.UNSUPPORTED)) - td(style:'background:#F28020', test_telem.count(EPhptTestStatus.TEST_EXCEPTION)) - } - } // end os - - /* ----------------- begin footer ------------------ */ - tr { - td(colspan: 2, 'Result-Pack') - td(colspan: 2) { - a(href:'http://131.107.220.66/PFTT-Results/'+base_telem.getBuildInfo().getBuildBranch(), 'Base') // TODO - } - td(colspan: 2) { - a(href:'http://131.107.220.66/PFTT-Results/'+test_telem.getBuildInfo().getBuildBranch(), 'Test') // TODO - } - td(colspan: 9, '') - } - /* ----------------- end footer ------------------ */ - - } // table - - p("* - tests skipped because they can't be run on that Operating System (ok)") - p("** - tests missing required sections (test is not runnable)") - p("*** - tests with unsupported sections (test is not runnable)") - - // all PHPTs marked as CRASH - table(border:1, cellspacing:0, cellpadding:8, style:'background:#F2F2F2') { - /* --------------- begin headers -------------- */ - tr { - td(colspan:3) { - b(test_build_branch_and_version) - - // check that the build and test pack versions all match - if ( - base_telem.getTestPackBranch()==base_telem.getBuildInfo().getBuildBranch() && - test_telem.getTestPackBranch()==test_telem.getBuildInfo().getBuildBranch() && - ( - base_telem.getTestPackVersion()==base_telem.getBuildInfo().getVersionRevision() - ||base_telem.getBuildInfo().getVersionRevision().contains(base_telem.getTestPackVersion()) - ) && ( - test_telem.getTestPackVersion()==test_telem.getBuildInfo().getVersionRevision() - ||test_telem.getBuildInfo().getVersionRevision().contains(test_telem.getTestPackVersion()) - )) { - span("(using test-pack included with test build)") - } else { - // if not, make it clear which versions of which were used - span("(using $test_test_pack_branch_and_version with $test_build_branch_and_version)") - } - } - } // tr - tr { - td(colspan:3, test_scenario_set_title) - } - tr { - td() - td() - td('Crashes (Test)') - } - /* --------------- end headers -------------- */ - os_names.each { os_name -> - tr { - td(row++) - td(os_name) - td() { - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - for ( String test_name : test_telem.getTestNames(EPhptTestStatus.CRASH)) { - br(test_name) - } - } - } - } - } // end os - } // table - - br() - - // new PHPT failures - table(border:1, cellspacing:0, cellpadding:8, style:'background:#F2F2F2') { - /* --------------- begin headers -------------- */ - tr { - td(colspan:3) { - b(base_build_branch_and_version+" (Base)") - span("with") - b(test_build_branch_and_version+" (Test)") - - // check that the build and test pack versions all match - if ( - base_telem.getTestPackBranch()==base_telem.getBuildInfo().getBuildBranch() && - test_telem.getTestPackBranch()==test_telem.getBuildInfo().getBuildBranch() && - ( - base_telem.getTestPackVersion()==base_telem.getBuildInfo().getVersionRevision() - ||base_telem.getBuildInfo().getVersionRevision().contains(base_telem.getTestPackVersion()) - ) && ( - test_telem.getTestPackVersion()==test_telem.getBuildInfo().getVersionRevision() - ||test_telem.getBuildInfo().getVersionRevision().contains(test_telem.getTestPackVersion()) - )) { - span("(using test-pack included with test build)") - } else { - // if not, make it clear which versions of which were used - span("(using $test_test_pack_branch_and_version with $test_build_branch_and_version)") - } - } - } // tr - tr { - td(colspan:3, test_scenario_set_title) - } - tr { - td(colspan:3, 'New Failures') - } - /* --------------- end headers -------------- */ - os_names.each { os_name -> - tr { - td(row++) - td(os_name) - td() { - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - for ( String test_name : PhptTestResult.listANotInB(test_telem.getTestNames(EPhptTestStatus.FAIL), base_telem.getTestNames(EPhptTestStatus.FAIL)) ) { - br(test_name) - } - } - } - } - } // end os - } - - br() - - // all PHPTs marked as FAIL - table(border:1, cellspacing:0, cellpadding:8, style:'background:#FFC000') { - /* --------------- begin headers -------------- */ - tr { - td(colspan:4) { - b(base_build_branch_and_version+" (Base)") - span("with") - b(test_build_branch_and_version+" (Test)") - - // check that the build and test pack versions all match - if ( - base_telem.getTestPackBranch()==base_telem.getBuildInfo().getBuildBranch() && - test_telem.getTestPackBranch()==test_telem.getBuildInfo().getBuildBranch() && - ( - base_telem.getTestPackVersion()==base_telem.getBuildInfo().getVersionRevision() - ||base_telem.getBuildInfo().getVersionRevision().contains(base_telem.getTestPackVersion()) - ) && ( - test_telem.getTestPackVersion()==test_telem.getBuildInfo().getVersionRevision() - ||test_telem.getBuildInfo().getVersionRevision().contains(test_telem.getTestPackVersion()) - )) { - span("(using test-packs included with each build)") - } else { - // if not, make it clear which versions of which were used - span("(using $base_test_pack_branch_and_version with $base_build_branch_and_version and $test_test_pack_branch_and_version with $test_build_branch_and_version)") - } - } - } // tr - tr { - td(colspan:4, scenario_set_title) - } - tr { - td() - td() - td('Failures (Base)') - td('Failures (Test)') - } - /* --------------- end headers -------------- */ - os_names.each { os_name -> - tr { - td(row++) - td(os_name) - td() { - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - for ( String test_name : base_telem.getTestNames(EPhptTestStatus.FAIL)) { - br(test_name) - } - } - } - td() { - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - for ( String test_name : test_telem.getTestNames(EPhptTestStatus.FAIL)) { - br(test_name) - } - } - } - } - } // end os - } // table - - } // body -} // html - - } // end void run - - protected static String cmp_symbol(int n) { - return n >= 0 ? "+"+n : ""+ n; - } - - @Override - public String getHTMLString(ConsoleManager cm, boolean abbreviated) { - run(cm, abbreviated); - return sw.toString(); - } - -} // end class FBCReportGen diff --git a/PfttAuto.java b/PfttAuto.java deleted file mode 100644 index f226ee8..0000000 --- a/PfttAuto.java +++ /dev/null @@ -1,197 +0,0 @@ -package com.mostc.pftt.main; - -import java.io.ByteArrayInputStream; -import java.io.File; - -import org.apache.commons.net.ftp.FTPClient; -import org.columba.ristretto.message.Address; -import org.columba.ristretto.smtp.SMTPProtocol; - -import com.github.mattficken.io.ArrayUtil; -import com.mostc.pftt.host.LocalHost; -import com.mostc.pftt.model.core.EBuildBranch; -import com.mostc.pftt.model.core.EBuildType; -import com.mostc.pftt.model.core.ECPUArch; -import com.mostc.pftt.model.core.PhpBuild; -import com.mostc.pftt.model.core.PhptSourceTestPack; -import com.mostc.pftt.results.ConsoleManager.EPrintType; -import com.mostc.pftt.results.LocalConsoleManager; -import com.mostc.pftt.results.PhpResultPackWriter; -import com.mostc.pftt.util.EMailUtil; -import com.mostc.pftt.util.HostEnvUtil; -import com.mostc.pftt.util.EMailUtil.ESMTPAuthMethod; -import com.mostc.pftt.util.EMailUtil.ESMTPSSL; - -/* - -e-mail report - -attach file to upload to each email msg - -with file name already generated -compress and upload result-pack -cron task - running on JET1 - - */ - - -public class PfttAuto { - public static void main3(String[] args) throws Exception { - SMTPProtocol smtp = EMailUtil.connect( - "smtp.gmail.com", - 465, - Address.parse("tomattfic...@gmail.com"), - ESMTPSSL.IMPLICIT_SSL,//.EXPLICIT_SSL, - ESMTPAuthMethod.DIGEST_MD5,//.LOGIN, - "tomattfic...@gmail.com", - "plasticmouse".toCharArray() - ); - System.out.println("49"); - EMailUtil.sendHTMLMessage( - smtp, - Address.parse("tomattfic...@gmail.com"), - ArrayUtil.toList(Address.parse("v-maf...@microsoft.com")), - "test subject", - "<html><body><h1>HI</h1></body></html>" - ); - } - - public static void main2(String[] args) throws Exception { - //FTPSClient ftp = new FTPSClient(); - FTPClient ftp = new FTPClient(); - ftp.connect("131.107.220.66", 21); - System.err.println(ftp.getReplyString()); - ftp.login("pftt", "1nter0pLAb!!"); - System.err.println(ftp.getReplyString()); - - ftp.makeDirectory("/PFTT-Results/PHP_5_3/test_dir"); - - ftp.storeFile("/PFTT-Results/PHP_5_3/test.html", new ByteArrayInputStream("test_file_contents".getBytes())); - System.err.println(ftp.getReplyString()); - ftp.logout(); - System.err.println(ftp.getReplyString()); - ftp.disconnect(); - System.err.println(ftp.getReplyString()); - } - - public static void main(String[] args) throws Exception { - //Thread.sleep(3*60*60*1000); // TODO temp - //for (;;) { - LocalHost host = new LocalHost(); - - LocalConsoleManager cm = new LocalConsoleManager(); - PfttMain p = new PfttMain(cm); - Config config, config2; - EBuildBranch branch; - EBuildType build_type; - PfttMain.BuildTestDebugPack btd_pack; - - - - config = Config.loadConfigFromFiles(cm, "apache", "cli", "opcache", "builtin_web", "no_code_cache"); - config2 = Config.loadConfigFromFiles(cm, "symfony", "apache", "cli", "opcache", "builtin_web", "no_code_cache"); - //filterScenarioSets(config); - //filterScenarioSets(config2); - branch = EBuildBranch.PHP_5_5; - build_type = EBuildType.TS; - btd_pack = p.releaseGetNewest(false, false, branch, ECPUArch.X86, build_type); - testBuild(branch, build_type, p, config, config2, btd_pack, cm, host); - branch = EBuildBranch.PHP_5_5; - build_type = EBuildType.NTS; - config = Config.loadConfigFromFiles(cm, "cli", "opcache", "builtin_web", "no_code_cache"); - config2 = Config.loadConfigFromFiles(cm, "symfony", "cli", "opcache", "builtin_web", "no_code_cache"); - btd_pack = p.releaseGetNewest(false, false, branch, ECPUArch.X86, build_type); - testBuild(branch, build_type, p, config, config2, btd_pack, cm, host); - // TODO print locations of result packs tested (don't include skipped) - // can then manually run cmp-report - - - config = Config.loadConfigFromFiles(cm, "apache", "cli", "opcache", "builtin_web", "no_code_cache"); - config2 = Config.loadConfigFromFiles(cm, "symfony", "apache", "cli", "opcache", "builtin_web", "no_code_cache"); - //filterScenarioSets(config); - //filterScenarioSets(config2); - branch = EBuildBranch.PHP_5_5; - build_type = EBuildType.TS; - btd_pack = p.releaseGetNewest(false, false, branch, ECPUArch.X64, build_type); - testBuild(branch, build_type, p, config, config2, btd_pack, cm, host); - branch = EBuildBranch.PHP_5_5; - build_type = EBuildType.NTS; - config = Config.loadConfigFromFiles(cm, "cli"); - config2 = Config.loadConfigFromFiles(cm, "symfony", "cli"); - btd_pack = p.releaseGetNewest(false, false, branch, ECPUArch.X64, build_type); - testBuild(branch, build_type, p, config, config2, btd_pack, cm, host); - // TODO print locations of result packs tested (don't include skipped) - // can then manually run cmp-report - - config = Config.loadConfigFromFiles(cm, "apache", "cli", "opcache", "builtin_web", "no_code_cache"); - config2 = Config.loadConfigFromFiles(cm, "symfony", "apache", "cli", "opcache", "builtin_web", "no_code_cache"); - branch = EBuildBranch.PHP_5_4; - build_type = EBuildType.TS; - btd_pack = p.releaseGetNewest(false, false, branch, ECPUArch.X86, build_type); - testBuild(branch, build_type, p, config, config2, btd_pack, cm, host); - branch = EBuildBranch.PHP_5_4; - build_type = EBuildType.NTS; - // TODO automatically skip apache with NTS - config = Config.loadConfigFromFiles(cm, "cli", "opcache", "no_code_cache"); - config2 = Config.loadConfigFromFiles(cm, "symfony", "cli", "opcache", "no_code_cache"); - btd_pack = p.releaseGetNewest(false, false, branch, ECPUArch.X86, build_type); - testBuild(branch, build_type, p, config, config2, btd_pack, cm, host); - // TODO print locations of result packs tested (don't include skipped) - // can then manually run cmp-report - - config = Config.loadConfigFromFiles(cm, "apache", "cli", "opcache", "no_code_cache"); - config2 = Config.loadConfigFromFiles(cm, "symfony", "apache", "cli", "opcache", "no_code_cache"); - branch = EBuildBranch.PHP_5_3; - build_type = EBuildType.TS; - btd_pack = p.releaseGetNewest(false, false, branch, ECPUArch.X86, build_type); - testBuild(branch, build_type, p, config, config2, btd_pack, cm, host); - branch = EBuildBranch.PHP_5_3; - build_type = EBuildType.NTS; - // TODO automatically skip apache with NTS - config = Config.loadConfigFromFiles(cm, "cli", "opcache", "no_code_cache"); - config2 = Config.loadConfigFromFiles(cm, "symfony", "cli", "opcache", "no_code_cache"); - btd_pack = p.releaseGetNewest(false, false, branch, ECPUArch.X86, build_type); - testBuild(branch, build_type, p, config, config2, btd_pack, cm, host); - - - exit(); - - //System.err.println("done one iteration of testing. will check for new builds in 10 minutes..."); - //Thread.sleep(10*60*1000); // check every 10 minutes - - //} - } - static void testBuild(EBuildBranch branch, EBuildType build_type, PfttMain p, Config config, Config config2, PfttMain.BuildTestDebugPack btd_pack, LocalConsoleManager cm, LocalHost host) { - if (btd_pack==null) - return; - try { - PhpBuild build = new PhpBuild(btd_pack.build); - build.open(cm, host); - // - PhptSourceTestPack test_pack = new PhptSourceTestPack(btd_pack.test_pack); - test_pack.open(cm, host); - System.out.println("BUILD: "+build); - System.out.println("TEST-PACK: "+test_pack); - PhpResultPackWriter tmgr = new PhpResultPackWriter(host, cm, new File(host.getPhpSdkDir()+"/PFTT-Auto"), build, test_pack); - if (!tmgr.isFirstForBuild()) { - cm.println(EPrintType.CLUE, PfttAuto.class, "Already tested this build"); - return; // don't exit, try next build/build-type - } - - // TODO if result-pack exists, assume its already tested and skip this - p.coreAll(build, test_pack, config, tmgr); - p.appAll(build, config2, tmgr); - tmgr.close(); - exit(); // don't use finally - } catch ( Throwable t ) { - t.printStackTrace(); - exit(); // don't use finally - } - } - static void exit() { - System.exit(0); - try { - Thread.sleep(60000); - } catch ( InterruptedException ex ) {} - Runtime.getRuntime().halt(0); - } -} diff --git a/PhpUnitReportGen.groovy b/PhpUnitReportGen.groovy deleted file mode 100644 index 9dc3444..0000000 --- a/PhpUnitReportGen.groovy +++ /dev/null @@ -1,346 +0,0 @@ -package com.mostc.pftt.results - -import groovy.xml.MarkupBuilder; - -import com.github.mattficken.io.StringUtil; -import com.mostc.pftt.model.app.EPhpUnitTestStatus; -import com.mostc.pftt.model.core.EBuildBranch; - -class PhpUnitReportGen extends AbstractReportGen { - StringWriter sw; - AbstractPhpUnitRW base_telem, test_telem; - int row; - - public PhpUnitReportGen(AbstractPhpUnitRW base_telem, AbstractPhpUnitRW test_telem) { - this.base_telem = base_telem; - this.test_telem = test_telem; - } - - @Override - void run(ConsoleManager cm, boolean abbreviated) { - def scenario_set_title = test_telem.getScenarioSetNameWithVersionInfo() - def test_scenario_set_title = scenario_set_title + ' (Test)' - if (scenario_set_title!=base_telem.getScenarioSetNameWithVersionInfo()) { - // for some reason, comparing runs of 2 different SAPIs... make that clear in report. - scenario_set_title = base_telem.getScenarioSetNameWithVersionInfo()+' (Base) with ' + test_telem.getScenarioSetNameWithVersionInfo()+' (Test)' - } - String base_build_branch_and_version = base_telem.getBuildInfo().toString(); - String test_build_branch_and_version = test_telem.getBuildInfo().toString(); - - def os_names = abbreviated?['Localhost']:base_telem.getBuildInfo().isX64()?['Win 2008r2 SP0 x64', 'Win 2008r2 SP1 x64', 'Win 2012 SP0 x64', 'Win 2008 SP1 x64', 'Win 2008 SP2 x64', 'Win 7 SP0 x64', 'Win 7 SP1 x64', 'Win 8 SP0 x64', 'Win Vista SP2 x64']:['Win 2008r2 SP0 x64', 'Win 2008r2 SP1 x64', 'Win 2012 SP0 x64', 'Win 2008 SP1 x64', 'Win 2008 SP1 x86', 'Win 2008 SP2 x64', 'Win 2008 SP2 x86', 'Win 7 SP0 x64', 'Win 7 SP0 x86', 'Win 7 SP1 x64', 'Win 7 SP1 x86', 'Win 8 SP0 x64', 'Win Vista SP2 x64', 'Win Vista SP2 x86']; - - row = 1; - sw = new StringWriter() - def html = new groovy.xml.MarkupBuilder(sw) - html.html { - body { - h1("PFTT PhpUnit Report") - - // warnings - if (cm.isSkipSmokeTests()) { - p('Warning: Smoke tests were not run on build. Smoke tests were disabled with -skip_smoke_tests console option.') - } - if (!cm.isThreadSafety()) { - p('Warning: Some errors or failures may be due to race conditions. Thread safety was disabled with -no_thread_safety console option.') - } - if (test_telem.getOSName() != base_telem.getOSName()) { - // for some reason, comparing runs from two different OSes, make it clear in report. - p("Warning: Base OS: ${base_telem.getOSName()} Test OS: ${test_telem.getOSName()}") - } - // - - p { - span(style: 'font-size:14.0pt;line-height:115%', 'Summary') - } - - table(border: 1, cellspacing: 0, cellpadding: 0, style: 'border-collapse:collapse;border:none;') { - tr { - td(colspan:11) { - b(base_build_branch_and_version) - span("using") - b(base_telem.getTestPackNameAndVersionString()+" (Base)") - span("with") - b(test_build_branch_and_version) - span("using") - b(test_telem.getTestPackNameAndVersionString()+" (Test)") - } // td - } // tr - tr { - td(colspan:11, scenario_set_title) - } - tr() { - td() // row number - td(valign:'top', style: 'border:solid windowtext 1.0pt; background:#A9CAED;padding:0in 5.4pt 0in 5.4pt', - "OS" - ) - td(valign: 'top', style: 'border:solid windowtext 1.0pt; border-left:none;background:#A9CAED;padding:0in 5.4pt 0in 5.4pt', - "Tests" - ) - td(colspan:1, valign: 'top', style: 'border:solid windowtext 1.0pt; border-left:none;background:#A9CAED;padding:0in 5.4pt 0in 5.4pt', - "Pass" - ) - td(colspan:2, valign: 'top', style: 'border:solid windowtext 1.0pt; border-left:none;background:#A9CAED;padding:0in 5.4pt 0in 5.4pt', - "Errors" - ) - td(colspan: 2, valign: 'top', style: 'border:solid windowtext 1.0pt; border-left:none;background:#A9CAED;padding:0in 5.4pt 0in 5.4pt', - "Failures" - ) - td(colspan: 2, valign: 'top', style: 'border:solid windowtext 1.0pt; border-left:none;background:#A9CAED;padding:0in 5.4pt 0in 5.4pt', - "Crashes" - ) - td(colspan: 1, valign: 'top', style: 'border:solid windowtext 1.0pt; border-left:none;background:#A9CAED;padding:0in 5.4pt 0in 5.4pt', - "Success Rate" - ) - } - - os_names.each { os_name -> - tr(style: 'height:26.05pt') { - td(row++, style: 'border:solid windowtext 1.0pt; border-top:none; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt;height:26.05pt') - td(valign: 'top', style: 'border:solid windowtext 1.0pt; border-top:none; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt;height:26.05pt', - os_name - ) - td(valign: "top", style: 'border-top:none;border-left:none; border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt; height:26.05pt', - test_telem.getTestCount() - ) - td(valign: 'top', style: 'border-top:none;border-left:none; border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt; height:26.05pt', - test_telem.count(EPhpUnitTestStatus.PASS) - ) - int error = test_telem.count(EPhpUnitTestStatus.ERROR); - int cmp_error = error - base_telem.count(EPhpUnitTestStatus.ERROR); - td(valign: 'top', style: 'border-top:none;border-left:none; border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt; height:26.05pt', - error - ) - td(valign: 'top', style: 'background:'+(cmp_error>0?'#FF0000':cmp_error<0?'#96DC28':'#ECEEE1')+'; border-top:none;border-left:none; border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt; height:26.05pt', - cmp_error > 0 ? "+" + cmp_error : ""+cmp_error - ) - int failure = test_telem.count(EPhpUnitTestStatus.FAILURE); - int cmp_failure = failure - base_telem.count(EPhpUnitTestStatus.FAILURE); - td(valign: 'top', style: 'border-top:none;border-left:none; border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt; height:26.05pt', - failure - ) - td(valign: 'top', style: 'background:'+(cmp_failure>0?'#FF0000':cmp_failure<0?'#96DC28':'#ECEEE1')+'; border-top:none;border-left:none; border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt; height:26.05pt', - cmp_failure > 0 ? "+" + cmp_failure : ""+cmp_failure - ) - int crash = test_telem.count(EPhpUnitTestStatus.CRASH); - int cmp_crash = crash - base_telem.count(EPhpUnitTestStatus.CRASH); - td(valign: 'top', style: 'background:'+(crash>0?'#ff0000':'#ECEEE1')+'; border-top:none;border-left:none; border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt; height:26.05pt', - crash - ) - td(valign: 'top', style: 'background:'+(cmp_crash>0?'#FF0000':cmp_crash<0?'#96DC28':'#ECEEE1')+'; border-top:none;border-left:none; border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt; height:26.05pt', - cmp_crash > 0 ? "+" + cmp_crash : ""+cmp_crash - ) - td(valign: 'top', style: 'border-top:none;border-left: none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt; height:26.05pt', - PhpResultPack.round1(test_telem.passRate()) - ) - } - - } // os - } // end table - - /* ----------------- begin footer ------------------ */ - table { - tr { - td('Result-Pack') - td(colspan: 2) { - a(href:'http://131.107.220.66/PFTT-Results/', 'Base') // TODO - } - td(colspan: 2) { - a(href:'http://131.107.220.66/PFTT-Results/', 'Test') // TODO - } - td(colspan: 7, '') - } - } - /* ----------------- end footer ------------------ */ - - p { - span(style: 'font-size:14.0pt;line-height:115%', - "Php INI for this Report" - ) - } - - table(border: 1, cellspacing: 0, cellpadding: 0, style: 'border-collapse:collapse;border:solid windowtext 1.0pt; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt') { - tr { - td(colspan:4) { - b(base_build_branch_and_version) - span("using") - b(base_telem.getTestPackNameAndVersionString()+" (Base)") - span("with") - b(test_build_branch_and_version) - span("using") - b(test_telem.getTestPackNameAndVersionString()+" (Test)") - } // td - } // tr - tr { - td(colspan:4, scenario_set_title) - } - tr { - td() - td() - td('Base') - td('Test') - } - tr { - td(row++) - td('Windows (All)') - td(){nl2Br(html, base_telem.getPhpIni().toString())} - td(){nl2Br(html, test_telem.getPhpIni().toString())} - } - } // end table - - p { - span(style: 'font-size:14.0pt;line-height:115%', - "NEW Errors and Crashes and Failures" - ) - } - - table(border: 1, cellspacing: 0, cellpadding: 0, style: 'border-collapse:collapse;border:none;') { - tr { - td(colspan:3) { - b(test_build_branch_and_version) - span("using") - b(test_telem.getTestPackNameAndVersionString()+" (Test)") - } // td - } // tr - tr { - td(colspan:3, test_scenario_set_title) - } - - os_names.each { os_name -> - tr() { - td(row++, style: 'border:solid windowtext 1.0pt; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt') - td(valign: 'top', style: 'border:solid windowtext 1.0pt; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt', - os_name - ) - td(valign: 'top', style: 'border:solid windowtext 1.0pt; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt') { - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - PhptTestResult.listANotInB(test_telem.getTestNames(EPhpUnitTestStatus.CRASH), base_telem.getTestNames(EPhpUnitTestStatus.CRASH)).each { test_name -> - p(test_name) - String a = test_telem.getFailureOutput(test_name); - if (a!=null) { - if (a.length()>150) - a = a.substring(0,150); - p { b(a) } - } - } - } - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - PhptTestResult.listANotInB(test_telem.getTestNames(EPhpUnitTestStatus.ERROR), base_telem.getTestNames(EPhpUnitTestStatus.ERROR)).each { test_name -> - p(test_name) - String a = test_telem.getFailureOutput(test_name); - if (a!=null) { - if (a.length()>150) - a = a.substring(0,150); - p { b(a) } - } - } - } - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - PhptTestResult.listANotInB(test_telem.getTestNames(EPhpUnitTestStatus.FAILURE), base_telem.getTestNames(EPhpUnitTestStatus.FAILURE)).each { test_name -> - p(test_name) - String a = test_telem.getFailureOutput(test_name); - if (a!=null) { - if (a.length()>150) - a = a.substring(0,150); - p { b(a) } - } - } - } - } - } - } // end os - } // end table - - p { - span(style: 'font-size:14.0pt;line-height:115%', - "List of Errors and Crashes and Failures" - ) - } - - table(border: 1, cellspacing: 0, cellpadding: 0, style: 'border-collapse:collapse;border:none;') { - tr { - td(colspan:4) { - b(base_build_branch_and_version) - span("using") - b(base_telem.getTestPackNameAndVersionString()+" (Base)") - span("with") - b(test_build_branch_and_version) - span("using") - b(test_telem.getTestPackNameAndVersionString()+" (Test)") - } // td - } // tr - tr { - td(colspan:4, scenario_set_title) - } - tr() { - td() // row - td(valign: 'top', style: 'border:solid windowtext 1.0pt; background:#A9CAED;padding:0in 5.4pt 0in 5.4pt') - td(valign: 'top', style: 'border:solid windowtext 1.0pt; border-left:none;background:#A9CAED;padding:0in 5.4pt 0in 5.4pt', - "Base" - ) - td(valign: 'top', style: 'border:solid windowtext 1.0pt; border-left:none;background:#A9CAED;padding:0in 5.4pt 0in 5.4pt', - "Test" - ) - } - - os_names.each { os_name -> - tr() { - td(row++, style: 'border:solid windowtext 1.0pt; border-top:none; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt') - td(valign: 'top', style: 'border:solid windowtext 1.0pt; border-top:none; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt', - os_name - ) - td(valign: 'top', style: 'border:solid windowtext 1.0pt; border-top:none; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt') { - // don't let the length get too long (for email message, etc...) - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - base_telem.getTestNames(EPhpUnitTestStatus.CRASH).each { test_name -> - p(test_name) - } - } - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - base_telem.getTestNames(EPhpUnitTestStatus.ERROR).each { test_name -> - p(test_name) - } - } - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - base_telem.getTestNames(EPhpUnitTestStatus.FAILURE).each { test_name -> - p(test_name) - } - } - } - td(valign: 'top', style: 'border:solid windowtext 1.0pt; border-top:none; background:#ECEEE1;padding:0in 5.4pt 0in 5.4pt') { - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - test_telem.getTestNames(EPhpUnitTestStatus.CRASH).each { test_name -> - p(test_name) - } - } - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - test_telem.getTestNames(EPhpUnitTestStatus.ERROR).each { test_name -> - p(test_name) - } - } - if (!abbreviated || sw.getBuffer().length()<ABBREVIATED_MAX_LENGTH) { - test_telem.getTestNames(EPhpUnitTestStatus.FAILURE).each { test_name -> - p(test_name) - } - } - } - } - } // end os - } // end table - - } // end body - } // end html - } // end void run - - static void nl2Br(MarkupBuilder html, String str) { - for ( String line : StringUtil.splitLines(str) ) { - html.invokeMethod("br", line); - } - } - - @Override - public String getHTMLString(ConsoleManager cm, boolean abbreviated) { - run(cm, abbreviated); - return sw.toString(); - } - -} // end class AUTReportGen diff --git a/UITestReportGen.groovy b/UITestReportGen.groovy deleted file mode 100644 index 156646b..0000000 --- a/UITestReportGen.groovy +++ /dev/null @@ -1,239 +0,0 @@ -package com.mostc.pftt.results - -import java.io.StringWriter; - -import com.github.mattficken.io.StringUtil; -import com.mostc.pftt.host.AHost; -import com.mostc.pftt.model.ui.EUITestStatus; - -class UITestReportGen extends AbstractReportGen { - protected AbstractUITestRW base_telem, test_telem; - protected StringWriter sw; - - public UITestReportGen(AbstractUITestRW base_telem, AbstractUITestRW test_telem) { - this.base_telem = base_telem; - this.test_telem = test_telem; - } - - @Override - public void run(ConsoleManager cm, boolean abbreviated) { - EUITestStatus base_status, test_status; - def test_html_url; - - // make it easier to see the important test results (fails, warnings) - put them at the top of the report: - // sort by status FAIL* PASS* TE SKIP NI - def test_names = test_telem.getTestNames(); - /*test_names.sort(true) { a, b -> - test_telem.getTestStatus(a).compareTo(test_telem.getTestStatus(b)) - }*/ - // - - def os_names = abbreviated?['Localhost']:['Win 2008r2 SP0 x64', 'Win 2008r2 SP1 x64', 'Win 2012 SP0 x64', 'Win 2008 SP1 x64', 'Win 2008 SP1 x86', 'Win 2008 SP2 x64', 'Win 2008 SP2 x86', 'Win 7 SP0 x64', 'Win 7 SP0 x86', 'Win 7 SP1 x64', 'Win 7 SP1 x86', 'Win 8 SP0 x64', 'Win Vista SP2 x64', 'Win Vista SP2 x86']; - - sw = new StringWriter() -def html = new groovy.xml.MarkupBuilder(sw) -html.html { - body { - h1('PFTT UI Report') - - def build_title, test_pack_title, scenario_set_title; - if (base_telem.getBuildInfo().equals(test_telem.getBuildInfo())) - build_title = test_telem.getBuildInfo().toString() - else - build_title = "${base_telem.getBuildInfo().toString()} with ${test_telem.getBuildInfo().toString()}" - - if (base_telem.getTestPackNameAndVersionString().equals(test_telem.getTestPackNameAndVersionString()) && base_telem.getWebBrowserNameAndVersion().equals(test_telem.getWebBrowserNameAndVersion())) - test_pack_title = "${test_telem.getTestPackNameAndVersionString()} with ${test_telem.getWebBrowserNameAndVersion()}" - else - test_pack_title = "${base_telem.getTestPackNameAndVersionString()} with ${base_telem.getWebBrowserNameAndVersion()} with ${test_telem.getTestPackNameAndVersionString()} with ${test_telem.getWebBrowserNameAndVersion()}" - scenario_set_title = test_telem.getScenarioSetNameWithVersionInfo() - if (scenario_set_title!=base_telem.getScenarioSetNameWithVersionInfo()) { - // for some reason, comparing runs of 2 different SAPIs... make that clear in report. - scenario_set_title = base_telem.getScenarioSetNameWithVersionInfo()+' (Base) with ' + test_telem.getScenarioSetNameWithVersionInfo()+' (Test)' - } - - table('border':"1", 'cellspacing':"0", 'cellpadding':"8") { - tr { - td('colspan': 2) { - b(build_title) - } - } - tr { - td('colspan': 2, test_pack_title) - } - tr { - td('colspan': 2, scenario_set_title) - } - - tr { - td() - td('Win2008r2sp1') - } - - tr { - td('Pass%') { - test_telem.passRate() - } - } - - tr { - td('Pass') { - test_telem.count(EUITestStatus.PASS) + test_telem.count(EUITestStatus.PASS_WITH_WARNING) - } - } - - for ( String test_name : test_names ) { - base_status = base_telem.getTestStatus(test_name) - test_status = test_telem.getTestStatus(test_name) - test_html_url = test_telem.getHTMLURL(test_name) - - tr { - td(test_name) - def style = styleForTestStatus(test_status) - - if (base_status==test_status) { - td('style': style) { - test_html_url? - a(href: test_html_url, test_status): - test_status - } - } else if (base_status==EUITestStatus.PASS) { - td('style': style) { - test_html_url? - a(href: test_html_url, '-'+test_status): - '-'+test_status - } - } else if (test_status==EUITestStatus.PASS) { - td('style': style) { - test_html_url? - a(href: test_html_url, '+'+test_status): - '+'+test_status - } - } else { - td('style': style) { - test_html_url? - a(href: test_html_url, test_status): - test_status - } - } - } // end tr - } // end for - - tr { - td('Not Implemented') { - test_telem.count(EUITestStatus.NOT_IMPLEMENTED) - } - } - tr { - td('Skip') { - test_telem.count(EUITestStatus.SKIP) - } - } - - /* ----------------- begin footer ------------------ */ - tr { - td('Result-Pack') - td() { - a(href:'http://131.107.220.66/PFTT-Results/'+base_telem.getBuildInfo().getBuildBranch(), 'Base') // TODO - '&nbps;' - a(href:'http://131.107.220.66/PFTT-Results/'+test_telem.getBuildInfo().getBuildBranch(), 'Test') // TODO - } - } - } // end table - /* ----------------- end footer ------------------ */ - - p('* - FAIL_WITH_WARNING and PASS_WITH_WARNING indicate a PHP warning or error message or HTTP error was found in the HTTP response during the test') - - h2('Test-Pack Notes') - String base_notes = base_telem.getNotes(); - String test_notes = test_telem.getNotes(); - - // include notes from test-pack - String test_pack_notes = base_notes==null||base_notes==test_notes?test_notes==null?'(No Notes Found)':test_notes:test_notes==null?base_notes:base_notes+"\n"+test_notes; - for ( String line : StringUtil.splitLines(test_pack_notes)) - b(line) - - h2('Test Description/Comments') - // list comments for each test-case that has a comment - table('border':"1", 'cellspacing':"0", 'cellpadding':"8") { - tr { - td('colspan': 2) { - b(build_title) - } - } - tr { - td('colspan': 2, test_pack_title) - } - tr { - td('colspan': 2, scenario_set_title) - } - - for ( String test_name : test_names ) { - def comment = test_telem.getComment(test_name) - - if (!comment) - continue; - - tr { - td(test_name) - td(comment) - } // tr - } // end for - } // table - - if (!abbreviated) { - // show screenshots here - h2('Screenshots') - def file_name; - table('border':"1", 'cellspacing':"0", 'cellpadding':"8") { - tr { - td('colspan': 2) { - b(build_title) - } - } - tr { - td('colspan': 2, test_pack_title) - } - tr { - td('colspan': 2, scenario_set_title) - } - - for ( String test_name : test_names ) { - file_name = test_telem.getScreenshotFilename(test_name) - test_status = test_telem.getTestStatus(test_name) - tr { - td(test_name) - td('style': styleForTestStatus(test_status)) { - img(src: 'file://'+AHost.toUnixPath(file_name), height: 640) - } - } - } - } // table - } - - } // end body -} // end html - } // end void run - - def styleForTestStatus(def test_status) { - switch(test_status) { - case EUITestStatus.FAIL: - case EUITestStatus.FAIL_WITH_WARNING: - case EUITestStatus.CRASH: - return 'background:#ff0000'; - case EUITestStatus.PASS_WITH_WARNING: - return 'background:yellow' - case EUITestStatus.PASS: - return 'background:#ccff66' - default: - return 'background:#ffc000' - } // end switch - } - - @Override - public String getHTMLString(ConsoleManager cm, boolean abbreviated) { - run(cm, abbreviated); - return sw.toString(); - } - -} // end class UITestReportGen