aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Drewry <drewry@google.com>2015-10-26 14:43:53 -0700
committerWill Drewry <drewry@google.com>2015-10-26 14:43:53 -0700
commite7428b0eb1ebada1330bbb3af89a5f5c41cc7c52 (patch)
tree1ea4afcc647fe53530e050ad0e86f0a3b0fca765
parent0ef2d11b7a55f484603fdfd92264099b6a4a82df (diff)
downloadbdk-e7428b0eb1ebada1330bbb3af89a5f5c41cc7c52.tar.gz
brunch/tests: test basic mobility of a product
Ensure it is possible to create a product in one path and move it to another without breaking envsetup, build, or config. BUG=25148498 Change-Id: Ia8305246e9f2e16a564d03fae2f7e92313595152
-rw-r--r--brunch/tests/relocate_product.sh49
-rw-r--r--brunch/tests/test_helpers2
2 files changed, 50 insertions, 1 deletions
diff --git a/brunch/tests/relocate_product.sh b/brunch/tests/relocate_product.sh
new file mode 100644
index 0000000..20b7f7f
--- /dev/null
+++ b/brunch/tests/relocate_product.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# Copyright (C) 2015 The Android Open Source Project
+#
+# 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
+#
+# http://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.
+
+. tests/test_helpers
+setup_working_path
+
+setup_initial_product() {
+ cd $1
+ $BRUNCH product create product board
+ cd product
+ stub_make
+ . ./envsetup.sh
+ echo "Ensuring the absolute path has the parent in it"
+ echo "$ANDROID_PRODUCT_OUT" | grep "/$1/"
+ brunch product config
+ brunch product build
+}
+
+check_out_new_location() {
+ cd $1/product
+ stub_make
+ . ./envsetup.sh
+ echo "Ensuring the absolute path has the new parent in it"
+ echo "$ANDROID_PRODUCT_OUT" | grep "/$1/"
+ brunch product config
+ brunch product build
+}
+
+# Use subshells to simplify
+echo "Ensuring a product can be accessed via different paths. "
+echo "E.g., locally and over NFS"
+
+mkdir product_container
+(setup_initial_product product_container)
+mv product_container megaproduct
+(check_out_new_location megaproduct)
diff --git a/brunch/tests/test_helpers b/brunch/tests/test_helpers
index 397fc7b..d91c823 100644
--- a/brunch/tests/test_helpers
+++ b/brunch/tests/test_helpers
@@ -30,7 +30,7 @@ setup_working_path() {
# Call this from within the product directory.
stub_make() {
echo "Replacing make with a stub"
- mkdir stubs
+ mkdir -p stubs
cat <<-EOF >stubs/make
#!/bin/sh
echo "\$0"