summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorYoung Gyu Park <younggyu@google.com>2018-08-14 11:41:02 +0900
committerYoung Gyu Park <younggyu@google.com>2018-08-14 11:41:02 +0900
commit3e6ec8b631057a2bbc0ac7dc83a5685ab37a5e0c (patch)
treecdd3135fc35a40c7d98bad3c0e5459369d0fa012 /src/main
parentc4798bc4cd5ca6734b5918cef141159c4dfa6876 (diff)
downloaddashboard-3e6ec8b631057a2bbc0ac7dc83a5685ab37a5e0c.tar.gz
Update util classes to incorporate entity classes accordingly
Test: go/vts-web-staging Bug: 111481322 Change-Id: I3660afbed1a8e59796eee9b79a24239b864b2ab0
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/android/vts/util/BoxPlot.java2
-rw-r--r--src/main/java/com/android/vts/util/DatastoreHelper.java44
-rw-r--r--src/main/java/com/android/vts/util/FilterUtil.java4
-rw-r--r--src/main/java/com/android/vts/util/Histogram.java8
-rw-r--r--src/main/java/com/android/vts/util/LineGraph.java18
-rw-r--r--src/main/java/com/android/vts/util/PerformanceSummary.java26
-rw-r--r--src/main/java/com/android/vts/util/PerformanceUtil.java8
-rw-r--r--src/main/java/com/android/vts/util/ProfilingPointSummary.java22
-rw-r--r--src/main/java/com/android/vts/util/TestResults.java14
-rw-r--r--src/main/java/com/android/vts/util/TestRunMetadata.java4
10 files changed, 94 insertions, 56 deletions
diff --git a/src/main/java/com/android/vts/util/BoxPlot.java b/src/main/java/com/android/vts/util/BoxPlot.java
index 75b4eb8..455d778 100644
--- a/src/main/java/com/android/vts/util/BoxPlot.java
+++ b/src/main/java/com/android/vts/util/BoxPlot.java
@@ -119,7 +119,7 @@ public class BoxPlot extends Graph {
StatSummary stat =
new StatSummary(
label, VtsReportMessage.VtsProfilingRegressionMode.UNKNOWN_REGRESSION_MODE);
- for (long value : profilingPoint.values) {
+ for (long value : profilingPoint.getValues()) {
stat.updateStats(value);
}
addSeriesData(label, "", stat);
diff --git a/src/main/java/com/android/vts/util/DatastoreHelper.java b/src/main/java/com/android/vts/util/DatastoreHelper.java
index c0ddf9d..cb511ab 100644
--- a/src/main/java/com/android/vts/util/DatastoreHelper.java
+++ b/src/main/java/com/android/vts/util/DatastoreHelper.java
@@ -13,6 +13,7 @@
*/
package com.android.vts.util;
+import com.android.vts.entity.ApiCoverageEntity;
import com.android.vts.entity.BranchEntity;
import com.android.vts.entity.BuildTargetEntity;
import com.android.vts.entity.CoverageEntity;
@@ -28,7 +29,9 @@ import com.android.vts.job.VtsAlertJobServlet;
import com.android.vts.job.VtsCoverageAlertJobServlet;
import com.android.vts.job.VtsProfilingStatsJobServlet;
import com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage;
+import com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage;
import com.android.vts.proto.VtsReportMessage.CoverageReportMessage;
+import com.android.vts.proto.VtsReportMessage.HalInterfaceMessage;
import com.android.vts.proto.VtsReportMessage.LogMessage;
import com.android.vts.proto.VtsReportMessage.ProfilingReportMessage;
import com.android.vts.proto.VtsReportMessage.TestCaseReportMessage;
@@ -62,6 +65,7 @@ import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
+import java.util.stream.Collectors;
/**
* DatastoreHelper, a helper class for interacting with Cloud Datastore.
@@ -231,6 +235,7 @@ public class DatastoreHelper {
coverageEntityList.add(coverageEntity.toEntity());
}
}
+
// Process profiling data for test case
for (ProfilingReportMessage profiling : testCase.getProfilingList()) {
ProfilingPointRunEntity profilingPointRunEntity =
@@ -239,7 +244,7 @@ public class DatastoreHelper {
logger.log(Level.WARNING, "Invalid profiling report in test run " + testRunKey);
} else {
profilingPointRunEntityList.add(profilingPointRunEntity.toEntity());
- profilingPointKeys.add(profilingPointRunEntity.key);
+ profilingPointKeys.add(profilingPointRunEntity.getKey());
testEntity.setHasProfilingData(true);
}
}
@@ -273,18 +278,18 @@ public class DatastoreHelper {
logger.log(Level.WARNING, "Invalid device info in test run " + testRunKey);
} else {
// Run type on devices must be the same, else set to OTHER
- TestRunType runType = TestRunType.fromBuildId(deviceInfoEntity.buildId);
+ TestRunType runType = TestRunType.fromBuildId(deviceInfoEntity.getBuildId());
if (testRunType == null) {
testRunType = runType;
} else if (runType != testRunType) {
testRunType = TestRunType.OTHER;
}
testEntityList.add(deviceInfoEntity.toEntity());
- BuildTargetEntity target = new BuildTargetEntity(deviceInfoEntity.buildFlavor);
+ BuildTargetEntity target = new BuildTargetEntity(deviceInfoEntity.getBuildFlavor());
if (buildTargetKeys.add(target.key)) {
buildTargetEntityList.add(target.toEntity());
}
- BranchEntity branch = new BranchEntity(deviceInfoEntity.branch);
+ BranchEntity branch = new BranchEntity(deviceInfoEntity.getBranch());
if (branchKeys.add(branch.key)) {
branchEntityList.add(branch.toEntity());
}
@@ -311,6 +316,30 @@ public class DatastoreHelper {
}
}
+ // Process global API coverage data
+ for (ApiCoverageReportMessage apiCoverage : report.getApiCoverageList()) {
+ HalInterfaceMessage halInterfaceMessage = apiCoverage.getHalInterface();
+ List<String> halApiList = apiCoverage.getHalApiList().stream().map(h -> h.toStringUtf8())
+ .collect(
+ Collectors.toList());
+ List<String> coveredHalApiList = apiCoverage.getCoveredHalApiList().stream()
+ .map(h -> h.toStringUtf8()).collect(
+ Collectors.toList());
+ ApiCoverageEntity apiCoverageEntity = new ApiCoverageEntity(
+ testRunKey,
+ halInterfaceMessage.getHalPackageName().toStringUtf8(),
+ halInterfaceMessage.getHalVersionMajor(),
+ halInterfaceMessage.getHalVersionMinor(),
+ halInterfaceMessage.getHalInterfaceName().toStringUtf8(),
+ halApiList,
+ coveredHalApiList
+ );
+ com.googlecode.objectify.Key apiCoverageEntityKey = apiCoverageEntity.save();
+ if (apiCoverageEntityKey == null) {
+ logger.log(Level.WARNING, "Invalid API coverage report in test run " + testRunKey);
+ }
+ }
+
// Process global profiling data
for (ProfilingReportMessage profiling : report.getProfilingList()) {
ProfilingPointRunEntity profilingPointRunEntity =
@@ -319,7 +348,7 @@ public class DatastoreHelper {
logger.log(Level.WARNING, "Invalid profiling report in test run " + testRunKey);
} else {
profilingPointRunEntityList.add(profilingPointRunEntity.toEntity());
- profilingPointKeys.add(profilingPointRunEntity.key);
+ profilingPointKeys.add(profilingPointRunEntity.getKey());
testEntity.setHasProfilingData(true);
}
}
@@ -482,6 +511,8 @@ public class DatastoreHelper {
testBuildId,
passCount,
failCount,
+ 0L,
+ 0L,
testRunKeys);
// Create the device infos.
@@ -490,6 +521,9 @@ public class DatastoreHelper {
}
testEntityList.add(testPlanRun.toEntity());
+ // Add the task to calculate total number API list.
+ testPlanRun.addCoverageApiTask();
+
datastoreTransactionalRetry(testPlanEntity, testEntityList);
}
diff --git a/src/main/java/com/android/vts/util/FilterUtil.java b/src/main/java/com/android/vts/util/FilterUtil.java
index 1c7a441..5a567e5 100644
--- a/src/main/java/com/android/vts/util/FilterUtil.java
+++ b/src/main/java/com/android/vts/util/FilterUtil.java
@@ -41,6 +41,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -463,6 +464,7 @@ public class FilterUtil {
ops.limit(maxSize);
testQuery.addSort(Entity.KEY_RESERVED_PROPERTY, dir);
}
+ logger.log(Level.INFO, "testQuery => " + testQuery);
for (Entity testRunKey : datastore.prepare(testQuery).asIterable(ops)) {
filterMatches.add(testRunKey.getKey());
if (maxKey == null || testRunKey.getKey().compareTo(maxKey) > 0)
@@ -476,6 +478,7 @@ public class FilterUtil {
matchingTestKeys = Sets.intersection(matchingTestKeys, filterMatches);
}
}
+ logger.log(Level.INFO, "matchingTestKeys => " + matchingTestKeys);
Set<Key> allMatchingKeys;
if (deviceFilter == null || matchingTestKeys.size() == 0) {
@@ -504,6 +507,7 @@ public class FilterUtil {
}
}
}
+ logger.log(Level.INFO, "allMatchingKeys => " + allMatchingKeys);
List<Key> gets = new ArrayList<>(allMatchingKeys);
if (dir == Query.SortDirection.DESCENDING) {
gets.sort(Comparator.reverseOrder());
diff --git a/src/main/java/com/android/vts/util/Histogram.java b/src/main/java/com/android/vts/util/Histogram.java
index 450714b..2f62a57 100644
--- a/src/main/java/com/android/vts/util/Histogram.java
+++ b/src/main/java/com/android/vts/util/Histogram.java
@@ -123,11 +123,11 @@ public class Histogram extends Graph {
*/
@Override
public void addData(String id, ProfilingPointRunEntity profilingPoint) {
- if (profilingPoint.values.size() == 0)
+ if (profilingPoint.getValues().size() == 0)
return;
- xLabel = profilingPoint.xLabel;
- yLabel = profilingPoint.yLabel;
- for (long v : profilingPoint.values) {
+ xLabel = profilingPoint.getXLabel();
+ yLabel = profilingPoint.getYLabel();
+ for (long v : profilingPoint.getValues()) {
double value = v;
values.add(value);
ids.add(id);
diff --git a/src/main/java/com/android/vts/util/LineGraph.java b/src/main/java/com/android/vts/util/LineGraph.java
index 22c64da..4788961 100644
--- a/src/main/java/com/android/vts/util/LineGraph.java
+++ b/src/main/java/com/android/vts/util/LineGraph.java
@@ -99,13 +99,13 @@ public class LineGraph extends Graph {
*/
@Override
public void addData(String id, ProfilingPointRunEntity profilingPoint) {
- if (profilingPoint.values.size() == 0
- || profilingPoint.values.size() != profilingPoint.labels.size())
+ if (profilingPoint.getValues().size() == 0
+ || profilingPoint.getValues().size() != profilingPoint.getLabels().size())
return;
ids.add(id);
profilingRuns.add(profilingPoint);
- xLabel = profilingPoint.xLabel;
- yLabel = profilingPoint.yLabel;
+ xLabel = profilingPoint.getXLabel();
+ yLabel = profilingPoint.getYLabel();
}
/**
@@ -121,8 +121,8 @@ public class LineGraph extends Graph {
List<String> axisTicks = new ArrayList<>();
Map<String, Integer> tickIndexMap = new HashMap<>();
- for (int i = 0; i < profilingRun.labels.size(); i++) {
- String label = profilingRun.labels.get(i);
+ for (int i = 0; i < profilingRun.getLabels().size(); i++) {
+ String label = profilingRun.getLabels().get(i);
axisTicks.add(label);
tickIndexMap.put(label, i);
}
@@ -130,15 +130,15 @@ public class LineGraph extends Graph {
long[][] lineGraphValues = new long[axisTicks.size()][profilingRuns.size()];
for (int reportIndex = 0; reportIndex < profilingRuns.size(); reportIndex++) {
ProfilingPointRunEntity pt = profilingRuns.get(reportIndex);
- for (int i = 0; i < pt.labels.size(); i++) {
- String label = pt.labels.get(i);
+ for (int i = 0; i < pt.getLabels().size(); i++) {
+ String label = pt.getLabels().get(i);
// Skip value if its label is not present
if (!tickIndexMap.containsKey(label))
continue;
int labelIndex = tickIndexMap.get(label);
- lineGraphValues[labelIndex][reportIndex] = pt.values.get(i);
+ lineGraphValues[labelIndex][reportIndex] = pt.getValues().get(i);
}
}
json.add(VALUE_KEY, new Gson().toJsonTree(lineGraphValues).getAsJsonArray());
diff --git a/src/main/java/com/android/vts/util/PerformanceSummary.java b/src/main/java/com/android/vts/util/PerformanceSummary.java
index 28e6975..a9ce0b4 100644
--- a/src/main/java/com/android/vts/util/PerformanceSummary.java
+++ b/src/main/java/com/android/vts/util/PerformanceSummary.java
@@ -69,32 +69,32 @@ public class PerformanceSummary {
ProfilingPointSummaryEntity.fromEntity(profilingRun);
if (ppSummary == null) return;
- String name = profilingPoint.profilingPointName;
- if (ppSummary.labels != null && ppSummary.labels.size() > 0) {
- if (!ppSummary.series.equals("")) {
- name += " (" + ppSummary.series + ")";
+ String name = profilingPoint.getProfilingPointName();
+ if (ppSummary.getLabels() != null && ppSummary.getLabels().size() > 0) {
+ if (!ppSummary.getSeries().equals("")) {
+ name += " (" + ppSummary.getSeries() + ")";
}
if (!summaryMap.containsKey(name)) {
summaryMap.put(
name,
new ProfilingPointSummary(
- profilingPoint.xLabel,
- profilingPoint.yLabel,
- profilingPoint.regressionMode));
+ profilingPoint.getXLabel(),
+ profilingPoint.getYLabel(),
+ profilingPoint.getVtsProfilingRegressionMode(profilingPoint.getRegressionMode())));
}
summaryMap.get(name).update(ppSummary);
} else {
// Use the option suffix as the table name.
// Group all profiling points together into one table
- if (!summaryMap.containsKey(ppSummary.series)) {
+ if (!summaryMap.containsKey(ppSummary.getSeries())) {
summaryMap.put(
- ppSummary.series,
+ ppSummary.getSeries(),
new ProfilingPointSummary(
- profilingPoint.xLabel,
- profilingPoint.yLabel,
- profilingPoint.regressionMode));
+ profilingPoint.getXLabel(),
+ profilingPoint.getYLabel(),
+ profilingPoint.getVtsProfilingRegressionMode(profilingPoint.getRegressionMode())));
}
- summaryMap.get(ppSummary.series).updateLabel(ppSummary, name);
+ summaryMap.get(ppSummary.getSeries()).updateLabel(ppSummary, name);
}
}
diff --git a/src/main/java/com/android/vts/util/PerformanceUtil.java b/src/main/java/com/android/vts/util/PerformanceUtil.java
index 36acee7..000f4e0 100644
--- a/src/main/java/com/android/vts/util/PerformanceUtil.java
+++ b/src/main/java/com/android/vts/util/PerformanceUtil.java
@@ -196,7 +196,7 @@ public class PerformanceUtil {
for (ProfilingPointEntity pp : profilingPoints) {
Query profilingQuery =
new Query(ProfilingPointSummaryEntity.KIND)
- .setAncestor(pp.key)
+ .setAncestor(pp.getKey())
.setFilter(filter);
asyncEntities.put(
pp,
@@ -211,7 +211,7 @@ public class PerformanceUtil {
ProfilingPointSummaryEntity.fromEntity(ppSummaryEntity);
if (ppSummary == null) continue;
for (PerformanceSummary perfSummary : summaries) {
- if (perfSummary.contains(ppSummary.startTime)) {
+ if (perfSummary.contains(ppSummary.getStartTime())) {
perfSummary.addData(pp, ppSummaryEntity);
}
}
@@ -270,8 +270,8 @@ public class PerformanceUtil {
public static String getOptionAlias(
ProfilingPointRunEntity profilingRun, Set<String> optionKeys) {
String name = "";
- if (profilingRun.options != null) {
- name = getOptionAlias(profilingRun.options, optionKeys);
+ if (profilingRun.getOptions() != null) {
+ name = getOptionAlias(profilingRun.getOptions(), optionKeys);
}
return name;
}
diff --git a/src/main/java/com/android/vts/util/ProfilingPointSummary.java b/src/main/java/com/android/vts/util/ProfilingPointSummary.java
index e842b4a..b08615a 100644
--- a/src/main/java/com/android/vts/util/ProfilingPointSummary.java
+++ b/src/main/java/com/android/vts/util/ProfilingPointSummary.java
@@ -80,15 +80,15 @@ public class ProfilingPointSummary implements Iterable<StatSummary> {
* @param ppSummary The profiling point run entity object containing profiling data.
*/
public void update(ProfilingPointSummaryEntity ppSummary) {
- for (String label : ppSummary.labels) {
- if (!ppSummary.labelStats.containsKey(label)) continue;
+ for (String label : ppSummary.getLabels()) {
+ if (!ppSummary.getLabelStats().containsKey(label)) continue;
if (!labelIndices.containsKey(label)) {
labelIndices.put(label, statSummaries.size());
labels.add(label);
- statSummaries.add(ppSummary.labelStats.get(label));
+ statSummaries.add(ppSummary.getLabelStats().get(label));
} else {
StatSummary summary = getStatSummary(label);
- summary.merge(ppSummary.labelStats.get(label));
+ summary.merge(ppSummary.getLabelStats().get(label));
}
}
}
@@ -110,16 +110,16 @@ public class ProfilingPointSummary implements Iterable<StatSummary> {
StatSummary stat =
new StatSummary(
label,
- ppSummary.globalStats.getMin(),
- ppSummary.globalStats.getMax(),
- ppSummary.globalStats.getMean(),
- ppSummary.globalStats.getSumSq(),
- ppSummary.globalStats.getCount(),
- ppSummary.globalStats.getRegressionMode());
+ ppSummary.getGlobalStats().getMin(),
+ ppSummary.getGlobalStats().getMax(),
+ ppSummary.getGlobalStats().getMean(),
+ ppSummary.getGlobalStats().getSumSq(),
+ ppSummary.getGlobalStats().getCount(),
+ ppSummary.getGlobalStats().getRegressionMode());
statSummaries.add(stat);
} else {
StatSummary summary = getStatSummary(label);
- summary.merge(ppSummary.globalStats);
+ summary.merge(ppSummary.getGlobalStats());
}
}
diff --git a/src/main/java/com/android/vts/util/TestResults.java b/src/main/java/com/android/vts/util/TestResults.java
index 70422ab..b6cfc2c 100644
--- a/src/main/java/com/android/vts/util/TestResults.java
+++ b/src/main/java/com/android/vts/util/TestResults.java
@@ -143,7 +143,7 @@ public class TestResults {
List<DeviceInfoEntity> deviceInfos = deviceInfoMap.get(mostRecentRun.getKey());
if (deviceInfos.size() > 0) {
DeviceInfoEntity totDevice = deviceInfos.get(0);
- totBuildId = totDevice.buildId;
+ totBuildId = totDevice.getBuildId();
}
// Count array for each test result
for (TestCaseRunEntity testCaseRunEntity : testCaseResults) {
@@ -260,13 +260,13 @@ public class TestResults {
List<String> productVariantList = new ArrayList<>();
List<String> abiInfoList = new ArrayList<>();
for (DeviceInfoEntity deviceInfoEntity : devices) {
- buildAliasList.add(deviceInfoEntity.branch);
- buildFlavorList.add(deviceInfoEntity.buildFlavor);
- productVariantList.add(deviceInfoEntity.product);
- buildIdList.add(deviceInfoEntity.buildId);
+ buildAliasList.add(deviceInfoEntity.getBranch());
+ buildFlavorList.add(deviceInfoEntity.getBuildFlavor());
+ productVariantList.add(deviceInfoEntity.getProduct());
+ buildIdList.add(deviceInfoEntity.getBuildId());
String abi = "";
- String abiName = deviceInfoEntity.abiName;
- String abiBitness = deviceInfoEntity.abiBitness;
+ String abiName = deviceInfoEntity.getAbiName();
+ String abiBitness = deviceInfoEntity.getAbiBitness();
if (abiName.length() > 0) {
abi += abiName;
if (abiBitness.length() > 0) {
diff --git a/src/main/java/com/android/vts/util/TestRunMetadata.java b/src/main/java/com/android/vts/util/TestRunMetadata.java
index 51f3051..bf4bd24 100644
--- a/src/main/java/com/android/vts/util/TestRunMetadata.java
+++ b/src/main/java/com/android/vts/util/TestRunMetadata.java
@@ -78,8 +78,8 @@ public class TestRunMetadata {
for (DeviceInfoEntity device : this.devices) {
String abi = "";
- String abiName = device.abiName;
- String abiBitness = device.abiBitness;
+ String abiName = device.getAbiName();
+ String abiBitness = device.getAbiBitness();
if (abiName.length() > 0) {
abi += abiName;
if (abiBitness.length() > 0) {