Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ java_library(
"//src/java/com/google/devtools/mobileharness/platform/android/xts/common/util:xts_dir_util",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/config:configuration_util",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/config:module_configuration_helper",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:non_tradefed_report_generator_constants",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/suite:module_arg",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/suite:suite_common",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/suite:suite_test_filter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import com.google.devtools.mobileharness.platform.android.xts.config.proto.ConfigurationProto.Device;
import com.google.devtools.mobileharness.platform.android.xts.config.proto.DeviceConfigurationProto.DeviceConfigurations;
import com.google.devtools.mobileharness.platform.android.xts.config.proto.DeviceConfigurationProto.ModuleDeviceConfiguration;
import com.google.devtools.mobileharness.platform.android.xts.plugin.NonTradefedReportGeneratorConstants;
import com.google.devtools.mobileharness.platform.android.xts.suite.ModuleArg;
import com.google.devtools.mobileharness.platform.android.xts.suite.SuiteCommon;
import com.google.devtools.mobileharness.platform.android.xts.suite.SuiteTestFilter;
Expand Down Expand Up @@ -138,18 +139,6 @@ public class SessionRequestHandlerUtil {
*/
public static final String MOBLY_TEST_SELECTOR_KEY = "test_case_selector";

/**
* The same as {@link
* com.google.devtools.mobileharness.platform.android.xts.plugin.NonTradefedReportGenerator#PARAM_RUN_CERTIFICATION_TEST_SUITE}.
*/
public static final String PARAM_RUN_CERTIFICATION_TEST_SUITE = "run_certification_test_suite";

/**
* The same as {@link
* com.google.devtools.mobileharness.platform.android.xts.plugin.NonTradefedReportGenerator#PARAM_XTS_SUITE_INFO}.
*/
public static final String PARAM_XTS_SUITE_INFO = "xts_suite_info";

/**
* The same as {@link
* com.google.devtools.deviceinfra.ext.devicemanagement.device.platform.android.realdevice.AndroidRealDeviceConstants#PARAM_CLEAR_GSERVICES_OVERRIDES}.
Expand Down Expand Up @@ -1203,7 +1192,6 @@ public ImmutableList<JobInfo> createXtsNonTradefedJobs(
/**
* Applies the metadata filter to see if the module should run.
*
* @param config The {@link Configuration} being evaluated.
* @param includeFilters the metadata include filter
* @param excludeFilters the metadata exclude filter
* @return True if the module should run, false otherwise.
Expand Down Expand Up @@ -1390,11 +1378,13 @@ private JobInfo createXtsNonTradefedJob(
if (!matchedTestCases.isEmpty()) {
jobInfo.params().add(MOBLY_TEST_SELECTOR_KEY, Joiner.on(" ").join(matchedTestCases));
}
jobInfo.params().add(PARAM_RUN_CERTIFICATION_TEST_SUITE, "true");
jobInfo
.params()
.add(NonTradefedReportGeneratorConstants.PARAM_RUN_CERTIFICATION_TEST_SUITE, "true");
jobInfo
.params()
.add(
PARAM_XTS_SUITE_INFO,
NonTradefedReportGeneratorConstants.PARAM_XTS_SUITE_INFO,
generateXtsSuiteInfoMap(
xtsRootDir.toAbsolutePath().toString(),
xtsType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ java_library(
"//src/java/com/google/devtools/mobileharness/infra/controller/test/util/atsfileserveruploader:ats_file_server_uploader_plugin",
"//src/java/com/google/devtools/mobileharness/infra/controller/test/util/xtsdownloader:mcts_dynamic_download_plugin",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:ats_device_recovery_plugin",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:nontradefed_report_generator",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:non_tradefed_report_generator",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:xts_device_compatibility_checker",
],
deps = [
Expand All @@ -73,6 +73,7 @@ java_library(
"//src/java/com/google/devtools/mobileharness/infra/controller/test/util:test_command_history_saver",
"//src/java/com/google/devtools/mobileharness/infra/controller/test/util/testlogcollector:test_log_collector_plugin",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/common/util:xts_constants",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:non_tradefed_report_generator_constants",
"//src/java/com/google/devtools/mobileharness/shared/util/flags",
"//src/java/com/google/devtools/mobileharness/shared/util/reflection:reflection_util",
"//src/java/com/google/wireless/qa/mobileharness/shared/constant:property",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.devtools.mobileharness.infra.controller.test.util.TestCommandHistorySaver;
import com.google.devtools.mobileharness.infra.controller.test.util.testlogcollector.TestLogCollectorPlugin;
import com.google.devtools.mobileharness.platform.android.xts.common.util.XtsConstants;
import com.google.devtools.mobileharness.platform.android.xts.plugin.NonTradefedReportGeneratorConstants;
import com.google.devtools.mobileharness.shared.util.flags.Flags;
import com.google.devtools.mobileharness.shared.util.reflection.ReflectionUtil;
import com.google.inject.Guice;
Expand Down Expand Up @@ -155,6 +156,8 @@ private static boolean isXtsDeviceCompatibilityCheckerEnabled(JobInfo jobInfo) {
}

private static boolean isXtsNonTradefedJob(JobInfo jobInfo) {
return jobInfo.params().getBool("run_certification_test_suite", false);
return jobInfo
.params()
.getBool(NonTradefedReportGeneratorConstants.PARAM_RUN_CERTIFICATION_TEST_SUITE, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
load("@rules_java//java:defs.bzl", "java_library")

java_library(
name = "nontradefed_report_generator",
name = "non_tradefed_report_generator",
srcs = ["NonTradefedReportGenerator.java"],
visibility = [
"//src/java/com/google/devtools/mobileharness:__subpackages__",
"//src/javatests/com/google/devtools/mobileharness:__subpackages__",
],
deps = [
":non_tradefed_report_generator_constants",
"//src/java/com/google/devtools/deviceinfra/platform/android/lightning/internal/sdk/adb",
"//src/java/com/google/devtools/mobileharness/api/model/error",
"//src/java/com/google/devtools/mobileharness/api/testrunner/event/test",
Expand All @@ -35,7 +36,6 @@ java_library(
"//src/java/com/google/devtools/mobileharness/shared/util/error:more_throwables",
"//src/java/com/google/devtools/mobileharness/shared/util/file/local",
"//src/java/com/google/devtools/mobileharness/shared/util/logging:google_logger",
"//src/java/com/google/wireless/qa/mobileharness/shared/api/annotation:basic_annotation",
"//src/java/com/google/wireless/qa/mobileharness/shared/controller/event:client_test_events",
"//src/java/com/google/wireless/qa/mobileharness/shared/controller/plugin",
"//src/java/com/google/wireless/qa/mobileharness/shared/model/job",
Expand All @@ -44,6 +44,18 @@ java_library(
],
)

java_library(
name = "non_tradefed_report_generator_constants",
srcs = ["NonTradefedReportGeneratorConstants.java"],
visibility = [
"//src/java/com/google/devtools/mobileharness/infra/ats/common:__pkg__",
"//src/java/com/google/devtools/mobileharness/infra/controller/test/local:__pkg__",
"//src/javatests/com/google/devtools/mobileharness/infra/ats/common:__pkg__",
"//src/javatests/com/google/devtools/mobileharness/platform/android/xts/plugin:__pkg__",
],
deps = ["//src/java/com/google/wireless/qa/mobileharness/shared/api/annotation:basic_annotation"],
)

java_library(
name = "xts_device_compatibility_checker",
srcs = ["XtsDeviceCompatibilityChecker.java"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.google.devtools.mobileharness.shared.util.base.StrUtil;
import com.google.devtools.mobileharness.shared.util.error.MoreThrowables;
import com.google.devtools.mobileharness.shared.util.file.local.LocalFileUtil;
import com.google.wireless.qa.mobileharness.shared.api.annotation.ParamAnnotation;
import com.google.wireless.qa.mobileharness.shared.controller.event.TestEndingEvent;
import com.google.wireless.qa.mobileharness.shared.controller.plugin.Plugin;
import com.google.wireless.qa.mobileharness.shared.controller.plugin.Plugin.PluginType;
Expand All @@ -52,16 +51,6 @@
public final class NonTradefedReportGenerator {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();

@ParamAnnotation(
required = false,
help = "Whether to run certification test suite. Default to false.")
public static final String PARAM_RUN_CERTIFICATION_TEST_SUITE = "run_certification_test_suite";

@ParamAnnotation(
required = false,
help = "xTS suite info. Should be key value pairs like 'key1=value1,key2=value2'.")
public static final String PARAM_XTS_SUITE_INFO = "xts_suite_info";

private final Clock clock;
private final Adb adb;
private final AndroidAdbUtil androidAdbUtil;
Expand Down Expand Up @@ -135,7 +124,9 @@ void createTestReport(
JobInfo jobInfo = testInfo.jobInfo();

boolean runCertificationTestSuite =
jobInfo.params().getBool(PARAM_RUN_CERTIFICATION_TEST_SUITE, false);
jobInfo
.params()
.getBool(NonTradefedReportGeneratorConstants.PARAM_RUN_CERTIFICATION_TEST_SUITE, false);
if (!runCertificationTestSuite) {
return;
}
Expand All @@ -161,7 +152,8 @@ void createTestReport(
Map<String, String> suiteInfoMap =
new HashMap<>(
StrUtil.toMap(
jobInfo.params().get(PARAM_XTS_SUITE_INFO, ""), /* allowDelimiterInValue= */ true));
jobInfo.params().get(NonTradefedReportGeneratorConstants.PARAM_XTS_SUITE_INFO, ""),
/* allowDelimiterInValue= */ true));
CertificationSuiteInfo suiteInfo = certificationSuiteInfoFactory.createSuiteInfo(suiteInfoMap);

try {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2022 Google LLC
*
* 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
*
* https://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.devtools.mobileharness.platform.android.xts.plugin;

import com.google.wireless.qa.mobileharness.shared.api.annotation.ParamAnnotation;

/** Constants for {@link NonTradefedReportGenerator}. */
public final class NonTradefedReportGeneratorConstants {

@ParamAnnotation(
required = false,
help = "Whether to run certification test suite. Default to false.")
public static final String PARAM_RUN_CERTIFICATION_TEST_SUITE = "run_certification_test_suite";

@ParamAnnotation(
required = false,
help = "xTS suite info. Should be key value pairs like 'key1=value1,key2=value2'.")
public static final String PARAM_XTS_SUITE_INFO = "xts_suite_info";

private NonTradefedReportGeneratorConstants() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ java_library(
"//src/java/com/google/devtools/mobileharness/platform/android/xts/common/util:xts_constants",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/config:configuration_util",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/config:module_configuration_helper",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:non_tradefed_report_generator_constants",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/suite:test_suite_helper",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/suite:test_suite_version",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/suite/retry:previous_result_loader",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import static com.google.common.truth.Truth.assertThat;
import static com.google.devtools.mobileharness.infra.ats.common.SessionRequestHandlerUtil.MOBLY_TEST_SELECTOR_KEY;
import static com.google.devtools.mobileharness.infra.ats.common.SessionRequestHandlerUtil.PARAM_XTS_SUITE_INFO;
import static com.google.devtools.mobileharness.platform.android.xts.plugin.NonTradefedReportGeneratorConstants.PARAM_XTS_SUITE_INFO;
import static org.junit.Assert.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ java_library(
"//src/java/com/google/devtools/mobileharness/platform/android/systemstate:system_state_util",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/common:device_build_info",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:ats_device_recovery_plugin",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:nontradefed_report_generator",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:non_tradefed_report_generator",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:non_tradefed_report_generator_constants",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/plugin:xts_device_compatibility_checker",
"//src/java/com/google/devtools/mobileharness/platform/android/xts/suite:suite_common",
"//src/java/com/google/devtools/mobileharness/shared/util/file/local",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package com.google.devtools.mobileharness.platform.android.xts.plugin;

import static com.google.devtools.mobileharness.platform.android.xts.plugin.NonTradefedReportGenerator.PARAM_RUN_CERTIFICATION_TEST_SUITE;
import static com.google.devtools.mobileharness.platform.android.xts.plugin.NonTradefedReportGenerator.PARAM_XTS_SUITE_INFO;
import static com.google.devtools.mobileharness.platform.android.xts.plugin.NonTradefedReportGeneratorConstants.PARAM_RUN_CERTIFICATION_TEST_SUITE;
import static com.google.devtools.mobileharness.platform.android.xts.plugin.NonTradefedReportGeneratorConstants.PARAM_XTS_SUITE_INFO;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
Expand Down