aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/benchmark/javatests
diff options
context:
space:
mode:
authorGravatar Yue Gan <yueg@google.com>2017-03-21 12:13:01 +0000
committerGravatar Yue Gan <yueg@google.com>2017-03-21 12:55:36 +0000
commit44c322b4e654930dfe8a7260843695289b9ecf39 (patch)
tree99a57e76a4fe020433b6bf4c3997a7fb5ec14e57 /src/tools/benchmark/javatests
parente29f6144f0b04ef233461911dbdfd9d75c0f83bb (diff)
Enable CppCodeGenerator for benchmark.
Before push: add a dummy 8-target json file in the beginning of file_list, so there will be 8 charts initialized. RELNOTES: Bazel benchmark (perf.bazel.build) supports Java and Cpp targets. -- PiperOrigin-RevId: 150740780 MOS_MIGRATED_REVID=150740780
Diffstat (limited to 'src/tools/benchmark/javatests')
-rw-r--r--src/tools/benchmark/javatests/com/google/devtools/build/benchmark/BazelBuildCaseTest.java19
-rw-r--r--src/tools/benchmark/javatests/com/google/devtools/build/benchmark/codegenerator/CppCodeGeneratorTest.java8
-rw-r--r--src/tools/benchmark/javatests/com/google/devtools/build/benchmark/codegenerator/JavaCodeGeneratorTest.java10
3 files changed, 27 insertions, 10 deletions
diff --git a/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/BazelBuildCaseTest.java b/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/BazelBuildCaseTest.java
index 44fbc41da0..ef7526a5d2 100644
--- a/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/BazelBuildCaseTest.java
+++ b/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/BazelBuildCaseTest.java
@@ -71,9 +71,24 @@ public class BazelBuildCaseTest {
ImmutableSet<String> destinationList =
fileArrayToImmutableSet(destination.toFile().listFiles());
assertThat(sourceList)
- .containsExactly("AFewFiles", "LongChainedDeps", "ManyFiles", "ParallelDeps");
+ .containsExactly("cpp", "java");
assertThat(destinationList)
- .containsExactly("AFewFiles", "LongChainedDeps", "ManyFiles", "ParallelDeps", "WORKSPACE");
+ .containsExactly("cpp", "java", "WORKSPACE");
+
+ ImmutableSet<String> targets = ImmutableSet.of(
+ "AFewFiles", "LongChainedDeps", "ManyFiles", "ParallelDeps");
+ ImmutableSet<String> sourceCppList =
+ fileArrayToImmutableSet(source.resolve("cpp").toFile().listFiles());
+ ImmutableSet<String> sourceJavaList =
+ fileArrayToImmutableSet(source.resolve("java").toFile().listFiles());
+ ImmutableSet<String> destinationCppList =
+ fileArrayToImmutableSet(destination.resolve("cpp").toFile().listFiles());
+ ImmutableSet<String> destinationJavaList =
+ fileArrayToImmutableSet(destination.resolve("java").toFile().listFiles());
+ assertThat(sourceCppList).containsExactlyElementsIn(targets);
+ assertThat(sourceJavaList).containsExactlyElementsIn(targets);
+ assertThat(destinationCppList).containsExactlyElementsIn(targets);
+ assertThat(destinationJavaList).containsExactlyElementsIn(targets);
}
private static ImmutableSet<String> fileArrayToImmutableSet(File[] files) {
diff --git a/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/codegenerator/CppCodeGeneratorTest.java b/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/codegenerator/CppCodeGeneratorTest.java
index 87154669ca..500cf704b8 100644
--- a/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/codegenerator/CppCodeGeneratorTest.java
+++ b/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/codegenerator/CppCodeGeneratorTest.java
@@ -57,18 +57,18 @@ public class CppCodeGeneratorTest {
// Target 1: a few files
checkSimpleTarget(
- dir, JavaCodeGenerator.TARGET_A_FEW_FILES, JavaCodeGenerator.SIZE_A_FEW_FILES);
+ dir, CppCodeGenerator.TARGET_A_FEW_FILES, cppCodeGenerator.getSizeAFewFiles());
// Target 2: many files
- checkSimpleTarget(dir, JavaCodeGenerator.TARGET_MANY_FILES, JavaCodeGenerator.SIZE_MANY_FILES);
+ checkSimpleTarget(dir, CppCodeGenerator.TARGET_MANY_FILES, cppCodeGenerator.getSizeManyFiles());
// Target 3: long chained deps
checkDepsTarget(
- dir, JavaCodeGenerator.TARGET_LONG_CHAINED_DEPS, JavaCodeGenerator.SIZE_LONG_CHAINED_DEPS);
+ dir, CppCodeGenerator.TARGET_LONG_CHAINED_DEPS, cppCodeGenerator.getSizeLongChainedDeps());
// Target 4: parallel deps
checkDepsTarget(
- dir, JavaCodeGenerator.TARGET_PARALLEL_DEPS, JavaCodeGenerator.SIZE_PARALLEL_DEPS);
+ dir, CppCodeGenerator.TARGET_PARALLEL_DEPS, cppCodeGenerator.getSizeParallelDeps());
}
private static ImmutableSet<String> fileArrayToImmutableSet(File[] files) {
diff --git a/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/codegenerator/JavaCodeGeneratorTest.java b/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/codegenerator/JavaCodeGeneratorTest.java
index 1e7985436b..24db84f410 100644
--- a/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/codegenerator/JavaCodeGeneratorTest.java
+++ b/src/tools/benchmark/javatests/com/google/devtools/build/benchmark/codegenerator/JavaCodeGeneratorTest.java
@@ -58,21 +58,23 @@ public class JavaCodeGeneratorTest {
// Target 1: a few files
checkProjectPathContains(dir, JavaCodeGenerator.TARGET_A_FEW_FILES);
checkSimpleTarget(
- dir, JavaCodeGenerator.TARGET_A_FEW_FILES, JavaCodeGenerator.SIZE_A_FEW_FILES);
+ dir, JavaCodeGenerator.TARGET_A_FEW_FILES, javaCodeGenerator.getSizeAFewFiles());
// Target 2: many files
checkProjectPathContains(dir, JavaCodeGenerator.TARGET_MANY_FILES);
- checkSimpleTarget(dir, JavaCodeGenerator.TARGET_MANY_FILES, JavaCodeGenerator.SIZE_MANY_FILES);
+ checkSimpleTarget(
+ dir, JavaCodeGenerator.TARGET_MANY_FILES, javaCodeGenerator.getSizeManyFiles());
// Target 3: long chained deps
checkProjectPathContains(dir, JavaCodeGenerator.TARGET_LONG_CHAINED_DEPS);
checkDepsTarget(
- dir, JavaCodeGenerator.TARGET_LONG_CHAINED_DEPS, JavaCodeGenerator.SIZE_LONG_CHAINED_DEPS);
+ dir, JavaCodeGenerator.TARGET_LONG_CHAINED_DEPS,
+ javaCodeGenerator.getSizeLongChainedDeps());
// Target 4: parallel deps
checkProjectPathContains(dir, JavaCodeGenerator.TARGET_PARALLEL_DEPS);
checkDepsTarget(
- dir, JavaCodeGenerator.TARGET_PARALLEL_DEPS, JavaCodeGenerator.SIZE_PARALLEL_DEPS);
+ dir, JavaCodeGenerator.TARGET_PARALLEL_DEPS, javaCodeGenerator.getSizeParallelDeps());
}
private static ImmutableSet<String> fileArrayToImmutableSet(File[] files) {