Add runtime measurement for Perf spec tests
@@ -122,6 +122,7 @@ public abstract class SpecTestCase implements RemoteStoreCallback {
// TODO: Make this configurable with JUnit options.
private static final boolean RUN_BENCHMARK_TESTS = false;
+ private static final String BENCHMARK_TAG = "benchmark";
// Disables all other tests; useful for debugging. Multiple tests can have
// this tag and they'll all be run (but all others won't).
@@ -133,7 +134,7 @@ public abstract class SpecTestCase implements RemoteStoreCallback {
private static final Set<String> DISABLED_TAGS =
RUN_BENCHMARK_TESTS
? Sets.newHashSet("no-android", "multi-client")
- : Sets.newHashSet("no-android", "benchmark", "multi-client");
+ : Sets.newHashSet("no-android", BENCHMARK_TAG, "multi-client");
private boolean garbageCollectionEnabled;
private boolean networkEnabled = true;
@@ -1063,7 +1064,9 @@ public abstract class SpecTestCase implements RemoteStoreCallback {
Set<String> tags = getTestTags(testJSON);
boolean runTest = shouldRunTest(tags) && (!exclusiveMode || tags.contains(EXCLUSIVE_TAG));
+ boolean measureRuntime = tags.contains(BENCHMARK_TAG);
if (runTest) {
+ long start = System.currentTimeMillis();
try {
info("Spec test: " + name);
runSteps(steps, config);
@@ -1071,6 +1074,10 @@ public abstract class SpecTestCase implements RemoteStoreCallback {
} catch (AssertionError e) {
throw new AssertionError("Spec test failure: " + name, e);
}
+ long end = System.currentTimeMillis();
+ if (measureRuntime) {
+ info("Runtime: " + (end - start) + " ms");
+ }
} else {
info(" [SKIPPED] Spec test: " + name);
}
