aboutsummaryrefslogtreecommitdiff
path: root/src/com/android/tradefed
diff options
context:
space:
mode:
authorJulien Desprez <jdesprez@google.com>2017-09-06 19:40:34 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-09-06 19:40:34 +0000
commitc9e9f11610ca3b6697a390cc75ac9dc2bc9881e9 (patch)
treefd79493ac4dd756b4b1274a64c7ab3e6f26d1399 /src/com/android/tradefed
parenta89c6676b9d930612b012761ce6123dc472a8056 (diff)
parentcc6cf5bedf03f3505040f768808d95d57920efb7 (diff)
downloadtradefederation-c9e9f11610ca3b6697a390cc75ac9dc2bc9881e9.tar.gz
Merge "Simplify the module names for TfSuiteRunner" into oc-dev
am: cc6cf5bedf Change-Id: I5dedbc02dc230897eb01fbd9e75570891e65b65c
Diffstat (limited to 'src/com/android/tradefed')
-rw-r--r--src/com/android/tradefed/testtype/suite/TfSuiteRunner.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/com/android/tradefed/testtype/suite/TfSuiteRunner.java b/src/com/android/tradefed/testtype/suite/TfSuiteRunner.java
index 5664e1cfd..219591266 100644
--- a/src/com/android/tradefed/testtype/suite/TfSuiteRunner.java
+++ b/src/com/android/tradefed/testtype/suite/TfSuiteRunner.java
@@ -43,6 +43,8 @@ import java.util.List;
*/
public class TfSuiteRunner extends ITestSuite {
+ private static final String CONFIG_EXT = ".config";
+
@Option(name = "run-suite-tag", description = "The tag that must be run.",
mandatory = true)
private String mSuiteTag = null;
@@ -177,7 +179,7 @@ public class TfSuiteRunner extends ITestSuite {
}
// If we have any IRemoteTests remaining in the base configuration, it will run.
if (!config.getTests().isEmpty()) {
- configMap.put(configName, config);
+ configMap.put(sanitizeModuleName(configName), config);
}
return configMap;
@@ -186,4 +188,24 @@ public class TfSuiteRunner extends ITestSuite {
private String getSuiteTag() {
return mSuiteTag;
}
+
+ /**
+ * Some module names are currently the absolute path name of some config files. We want to
+ * sanitize that look more like a short included config name.
+ */
+ private String sanitizeModuleName(String originalName) {
+ if (originalName.endsWith(CONFIG_EXT)) {
+ originalName = originalName.substring(0, originalName.length() - CONFIG_EXT.length());
+ }
+ if (!originalName.startsWith("/")) {
+ return originalName;
+ }
+ // if it's an absolute path
+ String[] segments = originalName.split("/");
+ if (segments.length < 3) {
+ return originalName;
+ }
+ // return last two segments only
+ return String.join("/", segments[segments.length - 2], segments[segments.length - 1]);
+ }
}