aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/java_tools/junitrunner/java/com/google/testing/junit
diff options
context:
space:
mode:
authorGravatar Irina Iancu <elenairina@google.com>2016-09-29 08:13:28 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-09-29 09:13:06 +0000
commit51417759a37e5b11003dd773d5c90ddd4c7a6aa7 (patch)
tree9ab6f4e85a3e9dfc102236e29e3254ae4a888d79 /src/java_tools/junitrunner/java/com/google/testing/junit
parent05e12bb5daf370be0ae1f63e723a8ac274a81436 (diff)
Branched internal RuntimeCost in junitrunner.
RuntimeCost class is needed by the package com.google.testing.junit.runner.sharding.weighted. I branched it from the internal code because the weighted package is now open sourced and does not have access to the previous import. This didn't break Bazel before because there was no dependency to the weighted target when building BazelTestRunner. I catched this trying to open-source junitrunner tests. -- MOS_MIGRATED_REVID=134634122
Diffstat (limited to 'src/java_tools/junitrunner/java/com/google/testing/junit')
-rw-r--r--src/java_tools/junitrunner/java/com/google/testing/junit/runner/BUILD1
-rw-r--r--src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/BUILD1
-rw-r--r--src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/BinStackingShardingFilterFactory.java1
-rw-r--r--src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/RuntimeCost.java41
-rw-r--r--src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/WeightedShardingFilter.java1
5 files changed, 42 insertions, 3 deletions
diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/BUILD b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/BUILD
index 9d6c9c00c4..5879ad4163 100644
--- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/BUILD
+++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/BUILD
@@ -14,6 +14,7 @@ java_library(
# Disable sunapi warnings about sun.misc.Signal.
# There are no non-Sun APIs for doing this.
javacopts = ["-Xlint:-sunapi"],
+ runtime_deps = ["//src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted"],
deps = [
"//src/java_tools/junitrunner/java/com/google/testing/junit/runner/internal",
"//src/java_tools/junitrunner/java/com/google/testing/junit/runner/junit4",
diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/BUILD b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/BUILD
index a35ed2357c..e0cb79b3db 100644
--- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/BUILD
+++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/BUILD
@@ -12,7 +12,6 @@ java_library(
name = "weighted",
srcs = glob(["*.java"]),
deps = [
- "//java/com/google/testing/util",
"//src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/api",
"//third_party:junit4",
],
diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/BinStackingShardingFilterFactory.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/BinStackingShardingFilterFactory.java
index 5f597920bd..6b3d05294c 100644
--- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/BinStackingShardingFilterFactory.java
+++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/BinStackingShardingFilterFactory.java
@@ -16,7 +16,6 @@ package com.google.testing.junit.runner.sharding.weighted;
import com.google.testing.junit.runner.sharding.api.ShardingFilterFactory;
import com.google.testing.junit.runner.sharding.api.WeightStrategy;
-import com.google.testing.util.RuntimeCost;
import java.util.Collection;
import org.junit.Ignore;
import org.junit.runner.Description;
diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/RuntimeCost.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/RuntimeCost.java
new file mode 100644
index 0000000000..ee3726311c
--- /dev/null
+++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/RuntimeCost.java
@@ -0,0 +1,41 @@
+// Copyright 2016 The Bazel Authors. All Rights Reserved.
+//
+// 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.testing.junit.runner.sharding.weighted;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * An annotation specified on a test method to indicate the tests' expected
+ * runtime duration. The costs are expressed in user defined relative units.
+ * For example, if a test with weight=1 runs in 10 seconds, then test with
+ * weight=5 should run in 50 seconds.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD})
+public @interface RuntimeCost {
+
+ /**
+ * Returns the relative cost of running the annotated test.
+ */
+ public int value();
+
+ /**
+ * Returns any notes.
+ */
+ public String notes() default "";
+}
diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/WeightedShardingFilter.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/WeightedShardingFilter.java
index bb3a8aa718..7e2795134e 100644
--- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/WeightedShardingFilter.java
+++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/weighted/WeightedShardingFilter.java
@@ -15,7 +15,6 @@
package com.google.testing.junit.runner.sharding.weighted;
import com.google.testing.junit.runner.sharding.api.WeightStrategy;
-import com.google.testing.util.RuntimeCost;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;