summaryrefslogtreecommitdiff
path: root/android/testing.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-03-29 00:21:00 +0100
committer Paul Duffin <paulduffin@google.com> 2021-03-29 17:29:30 +0100
commitf53555da2f12a902288d5f7706c14a81f77cff31 (patch)
treed405812c8ce68fd57b2acd0672e64e49ab864b1e /android/testing.go
parent755b10fe533d0640f114c0e5077dafc6ecccb1d9 (diff)
Add StringRelativeToTop
Needed for some follow up changes. Bug: 182885307 Test: m nothing Change-Id: I15992cc11e9c4c0e07af879192220ef1848dd09c
Diffstat (limited to 'android/testing.go')
-rw-r--r--android/testing.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/android/testing.go b/android/testing.go
index 27573d5d8..5813d74f3 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -1040,3 +1040,14 @@ func StringPathsRelativeToTop(soongOutDir string, paths []string) []string {
}
return result
}
+
+// StringRelativeToTop will normalize a string containing paths, e.g. ninja command, by replacing
+// any references to the test specific temporary build directory that changes with each run to a
+// fixed path relative to a notional top directory.
+//
+// This is similar to StringPathRelativeToTop except that assumes the string is a single path
+// containing at most one instance of the temporary build directory at the start of the path while
+// this assumes that there can be any number at any position.
+func StringRelativeToTop(config Config, command string) string {
+ return normalizeStringRelativeToTop(config, command)
+}