Revision: 8212
Author: [email protected]
Date: Wed May 26 04:38:31 2010
Log: Added benchmark task to ant in user/

Review at http://gwt-code-reviews.appspot.com/547801

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=8212

Added:
 /branches/2.1/user/test/com/google/gwt/emultest/EmulSuiteBenchmark.java
 /branches/2.1/user/test/com/google/gwt/i18n/I18NSuiteBenchmark.java
Modified:
 /branches/2.1/build.xml
 /branches/2.1/common.ant.xml
 /branches/2.1/user/build.xml

=======================================
--- /dev/null
+++ /branches/2.1/user/test/com/google/gwt/emultest/EmulSuiteBenchmark.java Wed May 26 04:38:31 2010
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.emultest;
+
+import com.google.gwt.emultest.java.lang.StringBufferBenchmark;
+import com.google.gwt.emultest.java.lang.StringBufferImplBenchmark;
+import com.google.gwt.emultest.java.util.ArrayListBenchmark;
+import com.google.gwt.emultest.java.util.ArraySortBenchmark;
+import com.google.gwt.emultest.java.util.HashMapBenchmark;
+import com.google.gwt.emultest.java.util.TreeMapBenchmark;
+import com.google.gwt.emultest.java.util.VectorBenchmark;
+import com.google.gwt.junit.tools.GWTTestSuite;
+import com.google.gwt.lang.LongBenchmark;
+
+import junit.framework.Test;
+
+/**
+ * Test JRE emulations.
+ */
+public class EmulSuiteBenchmark {
+
+  public static Test suite() {
+    GWTTestSuite suite
+      = new GWTTestSuite("Benchmarks for com.google.gwt.emul.java");
+
+    // $JUnit-BEGIN$
+    // java.lang
+    suite.addTestSuite(StringBufferBenchmark.class);
+    suite.addTestSuite(StringBufferImplBenchmark.class);
+    suite.addTestSuite(LongBenchmark.class);
+
+    // java.util
+    suite.addTestSuite(ArrayListBenchmark.class);
+    suite.addTestSuite(ArraySortBenchmark.class);
+    suite.addTestSuite(HashMapBenchmark.class);
+    suite.addTestSuite(TreeMapBenchmark.class);
+    suite.addTestSuite(VectorBenchmark.class);
+    // $JUnit-END$
+
+    return suite;
+  }
+}
=======================================
--- /dev/null
+++ /branches/2.1/user/test/com/google/gwt/i18n/I18NSuiteBenchmark.java Wed May 26 04:38:31 2010
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.i18n;
+
+import com.google.gwt.i18n.client.NumberFormatBenchmark;
+import com.google.gwt.junit.tools.GWTTestSuite;
+
+import junit.framework.Test;
+
+/**
+ * All I18N tests.
+ */
+public class I18NSuiteBenchmark {
+  public static Test suite() {
+    GWTTestSuite suite = new GWTTestSuite("All I18N benchmarks");
+
+    // $JUnit-BEGIN$
+    suite.addTestSuite(NumberFormatBenchmark.class);
+    // $JUnit-END$
+
+    return suite;
+  }
+}
=======================================
--- /branches/2.1/build.xml     Mon May 17 14:09:33 2010
+++ /branches/2.1/build.xml     Wed May 26 04:38:31 2010
@@ -137,6 +137,11 @@
     <call-subproject subproject="tools" subtarget="test" />
   </target>

+  <target name="benchmark" depends="dist-dev"
+          description="[action] Runs all the GWT benchmarks">
+    <call-subproject subproject="user" subtarget="benchmark" />
+  </target>
+
   <path id="emma.classpath.src">
     <pathelement location="${gwt.root}/user/src" />
     <pathelement location="${gwt.root}/dev/**/src/com/google" />
=======================================
--- /branches/2.1/common.ant.xml        Mon Feb  1 07:18:28 2010
+++ /branches/2.1/common.ant.xml        Wed May 26 04:38:31 2010
@@ -102,6 +102,9 @@
   <property name="gwt.junit.port" value="8888" />
   <property name="gwt.junit.testcase.includes" value="**/*Suite.class"/>

+  <!-- Benchmark support -->
+ <property name="gwt.benchmark.testcase.includes" value="**/*SuiteBenchmark.class"/>
+
   <!-- Shared class paths -->
   <path id="project.classpath.class">
     <pathelement location="${javac.out}" />
@@ -162,6 +165,7 @@
<attribute name="test.emma.coverage" default="@{test.out}/emma-coverage" />
     <attribute name="test.cases" default="" />
     <attribute name="test.name" default="" />
+    <attribute name="test.extra.jvmargs" default="" />
     <attribute name="haltonfailure" default="true" />
     <element name="extraclasspaths" optional="true" />
     <sequential>
@@ -190,6 +194,7 @@
         <jvmarg line="-Xss512k" />
<jvmarg value="-demma.coverage.out.fi...@{test.emma.coverage}/coverage.emma" />
         <jvmarg value="-Demma.coverage.out.merge=true" />
+        <jvmarg value="-Dcom.google.gwt.junit.reportPath=reports" />
         <sysproperty key="gwt.args" value="@{test.args}" />
         <sysproperty key="java.awt.headless" value="true" />
         <classpath>
=======================================
--- /branches/2.1/user/build.xml        Wed May 12 10:52:01 2010
+++ /branches/2.1/user/build.xml        Wed May 26 04:38:31 2010
@@ -27,6 +27,10 @@
<property name="gwt.junit.testcase.dev.includes" value="${gwt.junit.testcase.includes}" />
   <property name="gwt.junit.testcase.dev.excludes" value="" />

+  <property name="benchmark.timeout" value="30" />
+ <property name="gwt.benchmark.testcase.web.includes" value="${gwt.benchmark.testcase.includes}" /> + <property name="gwt.benchmark.testcase.web.excludes" value="${gwt.benchmark.testcase.excludes}" />
+
   <!--
     Test args can be specified per test target type.
   -->
@@ -586,6 +590,77 @@
     </limit>
   </target>

+  <target name="benchmark"
+      description="Run all benchmarks for this project.">
+
+    <property.ensure name="distro.built" location="${gwt.dev.staging.jar}"
+ message="GWT must be built before performing any tests. This can be fixed by running ant in the ${gwt.root} directory." />
+    <limit failonerror="true" hours="${benchmark.timeout}">
+      <!-- no-op unless gwt.hosts.web.remote is defined -->
+      <antcall target="benchmark.web.remote"/>
+      <!-- no-op unless gwt.hosts.web.selenium is defined -->
+      <antcall target="benchmark.web.selenium"/>
+      <antcall target="benchmark.web.htmlunit"/>
+    </limit>
+  </target>
+
+  <target name="benchmark.web.htmlunit"
+      depends="compile, compile.tests"
+      description="Run web-mode benchmarks with HtmlUnit."
+      unless="benchmark.web.htmlunit.disable">
+    <fileset id="benchmark.web.htmlunit.tests" dir="${javac.junit.out}"
+        includes="${gwt.benchmark.testcase.web.includes}"
+        excludes="${gwt.benchmark.testcase.web.excludes}" />
+    <gwt.junit test.name="benchmark.web.htmlunit"
+ test.args="${test.args} -testMethodTimeout ${benchmark.timeout} -out www -prod -standardsMode"
+        test.out="${junit.out}/web-htmlunit-benchmark"
+        test.cases="benchmark.web.htmlunit.tests" >
+      <extraclasspaths>
+        <path refid="test.extraclasspath" />
+      </extraclasspaths>
+    </gwt.junit>
+  </target>
+
+  <target name="benchmark.web.selenium"
+      depends="compile, compile.tests"
+      description="Run web benchmark using Selenium RC"
+      if="gwt.hosts.web.selenium"
+      unless="benchmark.web.selenium.disable">
+ <echo message="Performing web benchmarking using Selenium RC at ${gwt.hosts.web.selenium}" /> + <property name="test.web.selenium.args" value="${test.args.web.selenium}" />
+    <fileset id="benchmark.web.selenium.tests" dir="${javac.junit.out}"
+        includes="${gwt.benchmark.testcase.web.includes}"
+        excludes="${gwt.benchmark.testcase.web.excludes}" />
+    <gwt.junit test.name="benchmark.web.selenium"
+ test.args='${test.web.selenium.args} -testMethodTimeout ${benchmark.timeout} -prod -out www -standardsMode -runStyle "Selenium:${gwt.hosts.web.selenium}"'
+        test.out="${junit.out}/web-selenium-benchmark"
+        test.cases="benchmark.web.selenium.tests" >
+      <extraclasspaths>
+        <path refid="test.extraclasspath" />
+      </extraclasspaths>
+    </gwt.junit>
+  </target>
+
+  <target name="benchmark.web.remote"
+      depends="compile, compile.tests"
+      description="Run web benchmarks with remote browsers"
+      if="gwt.hosts.web.remote"
+      unless="benchmark.web.remote.disable">
+ <echo message="Performing web remote benchmarking at ${gwt.hosts.web.remote}" /> + <property name="test.web.remote.args" value="${test.args.web.remote}" />
+    <fileset id="benchmark.web.remote.tests" dir="${javac.junit.out}"
+        includes="${gwt.benchmark.testcase.web.includes}"
+        excludes="${gwt.benchmark.testcase.web.excludes}" />
+    <gwt.junit test.name="benchmark.web.remote"
+ test.args="${test.web.remote.args} -testMethodTimeout ${benchmark.timeout} -out www -prod -standardsMode -runStyle RemoteWeb:${gwt.hosts.web.remote}"
+        test.out="${junit.out}/web-remote-benchmark"
+        test.cases="benchmark.web.remote.tests" >
+      <extraclasspaths>
+        <path refid="test.extraclasspath" />
+      </extraclasspaths>
+    </gwt.junit>
+  </target>
+
   <!--
       Merges coverage data for the entire project
   -->

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to