aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-15 00:45:10 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-15 00:45:10 +0000
commit759a4041e5c10b5d684bad8d711f28102e8b1c34 (patch)
treef88d85633877f5251cba8b910196f3b80db6c040
parent68aaf56d374818c09931ad270bd99ca9d0417344 (diff)
parent33158ffcd4efdc90f142faf911f12918f20a4c75 (diff)
downloadtradefederation-android14-qpr2-s3-release.tar.gz
Change-Id: I529f00b2c92ec0f2d8d8f08137c767ad3486132e
-rw-r--r--javatests/com/android/tradefed/device/NativeDeviceTest.java6
-rw-r--r--javatests/res/device/wifi_status_output_1.txt0
-rw-r--r--src/com/android/tradefed/config/filter/OptionFetcher.java3
-rw-r--r--src/com/android/tradefed/device/LogcatReceiver.java2
-rw-r--r--src/com/android/tradefed/invoker/shard/DynamicShardHelper.java24
-rw-r--r--src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java6
-rw-r--r--src/com/android/tradefed/testtype/suite/ITestSuite.java4
7 files changed, 36 insertions, 9 deletions
diff --git a/javatests/com/android/tradefed/device/NativeDeviceTest.java b/javatests/com/android/tradefed/device/NativeDeviceTest.java
index 1c2d1b6d7..226967326 100644
--- a/javatests/com/android/tradefed/device/NativeDeviceTest.java
+++ b/javatests/com/android/tradefed/device/NativeDeviceTest.java
@@ -2800,7 +2800,8 @@ public class NativeDeviceTest {
verify(mMockIDevice)
.executeShellCommand(
- Mockito.eq(String.format("logcat -v threadtime -t '%s'", dateFormatted)),
+ Mockito.eq(String.format(
+ "logcat -b all -v threadtime -t '%s'", dateFormatted)),
Mockito.any());
}
@@ -2818,7 +2819,8 @@ public class NativeDeviceTest {
verify(mMockIDevice)
.executeShellCommand(
- Mockito.eq("logcat -v threadtime,uid -t '1512990942.012'"), Mockito.any());
+ Mockito.eq("logcat -b all -v threadtime,uid -t '1512990942.012'"),
+ Mockito.any());
}
@Test
diff --git a/javatests/res/device/wifi_status_output_1.txt b/javatests/res/device/wifi_status_output_1.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/javatests/res/device/wifi_status_output_1.txt
diff --git a/src/com/android/tradefed/config/filter/OptionFetcher.java b/src/com/android/tradefed/config/filter/OptionFetcher.java
index 475030095..63ed71f16 100644
--- a/src/com/android/tradefed/config/filter/OptionFetcher.java
+++ b/src/com/android/tradefed/config/filter/OptionFetcher.java
@@ -46,7 +46,8 @@ public class OptionFetcher implements AutoCloseable {
"enable-tracing",
"auto-collect",
"skip-retry-in-presubmit",
- "skip-retrying-list");
+ "skip-retrying-list",
+ "remote-dynamic-sharding");
private TradefedFeatureClient mClient;
diff --git a/src/com/android/tradefed/device/LogcatReceiver.java b/src/com/android/tradefed/device/LogcatReceiver.java
index 96a3acfdf..442c6c4b7 100644
--- a/src/com/android/tradefed/device/LogcatReceiver.java
+++ b/src/com/android/tradefed/device/LogcatReceiver.java
@@ -95,7 +95,7 @@ public class LogcatReceiver implements ILogcatReceiver {
/** Get the default logcat command, only append uid format if api level > 24. */
public static String getDefaultLogcatCmd(ITestDevice device) {
- String logcatCmd = "logcat -v threadtime";
+ String logcatCmd = "logcat -b all -v threadtime";
// Logcat format support UID started from api level 24.
try {
if (SystemUtil.isLocalMode() || device.getApiLevel() >= 24) {
diff --git a/src/com/android/tradefed/invoker/shard/DynamicShardHelper.java b/src/com/android/tradefed/invoker/shard/DynamicShardHelper.java
index 9a8527f65..1ecbc23f9 100644
--- a/src/com/android/tradefed/invoker/shard/DynamicShardHelper.java
+++ b/src/com/android/tradefed/invoker/shard/DynamicShardHelper.java
@@ -90,6 +90,14 @@ public class DynamicShardHelper extends StrictShardHelper {
shouldDelegate = true;
}
+ // Check if any of the tests are not ITestSuite instances
+ // If not, make sure that intra-module sharding is off and delegate
+ if (config.getTests().stream()
+ .anyMatch(x -> !ITestSuite.class.isAssignableFrom(x.getClass()))) {
+ CLog.d("Found non-ITestSuite tests, falling back to strict sharding");
+ shouldDelegate = true;
+ }
+
if (shouldDelegate) {
CLog.d(
"Setting option 'remote-dynamic-sharding' to false since precondition checks"
@@ -190,14 +198,20 @@ public class DynamicShardHelper extends StrictShardHelper {
List<ITestSuite> allTests = new ArrayList<>();
for (IRemoteTest test : config.getTests()) {
if (test instanceof ITestSuite) {
+ ITestSuite suite = (ITestSuite) test;
// Disable intra-module-sharding when requesting dynamic sharding
// as it's currently not supported together.
- ((ITestSuite) test).setIntraModuleSharding(false);
+ if (suite.getIntraModuleSharding()) {
+ CLog.w(
+ "Disabling intra-module sharding because it is not supported with"
+ + "dynamic sharding.");
+ suite.setIntraModuleSharding(false);
+ }
+
allTests.addAll(
- ((ITestSuite) test)
- .split(1000000, testInfo).stream()
- .map(x -> (ITestSuite) x)
- .collect(Collectors.toList()));
+ suite.split(1000000, testInfo).stream()
+ .map(x -> (ITestSuite) x)
+ .collect(Collectors.toList()));
} else {
throw new HarnessRuntimeException(
"Test not an instance of ITestSuite, cannot execute this using dynamic"
diff --git a/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java b/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java
index 981143931..4a07962a8 100644
--- a/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java
+++ b/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java
@@ -346,6 +346,9 @@ public class FastbootDeviceFlasher implements IDeviceFlasher {
// only set bootloader image if this build doesn't have one already
// TODO: move this logic to the BuildProvider step
if (bootloaderVersion != null && localBuild.getBootloaderImageFile() == null) {
+ CLog.v("Bootloader image was not included in the build artifacts (%s, %s), "
+ + "fetching from blob service instead.",
+ localBuild.getDeviceBuildId(), localBuild.getDeviceBuildFlavor());
localBuild.setBootloaderImageFile(
getFlashingResourcesRetriever()
.retrieveFile(getBootloaderFilePrefix(device), bootloaderVersion),
@@ -354,6 +357,9 @@ public class FastbootDeviceFlasher implements IDeviceFlasher {
String basebandVersion = resourceParser.getRequiredBasebandVersion();
// only set baseband image if this build doesn't have one already
if (basebandVersion != null && localBuild.getBasebandImageFile() == null) {
+ CLog.v("Baseband image was not included in the build artifacts (%s, %s), "
+ + "fetching from blob service instead.",
+ localBuild.getDeviceBuildId(), localBuild.getDeviceBuildFlavor());
localBuild.setBasebandImage(getFlashingResourcesRetriever().retrieveFile(
BASEBAND_IMAGE_NAME, basebandVersion), basebandVersion);
}
diff --git a/src/com/android/tradefed/testtype/suite/ITestSuite.java b/src/com/android/tradefed/testtype/suite/ITestSuite.java
index 4808c3d64..d3638231b 100644
--- a/src/com/android/tradefed/testtype/suite/ITestSuite.java
+++ b/src/com/android/tradefed/testtype/suite/ITestSuite.java
@@ -1697,4 +1697,8 @@ public abstract class ITestSuite
public void setIntraModuleSharding(boolean intraModuleSharding) {
mIntraModuleSharding = intraModuleSharding;
}
+
+ public boolean getIntraModuleSharding() {
+ return mIntraModuleSharding;
+ }
}