diff options
-rw-r--r-- | brunch/tests/relocate_product.sh | 49 | ||||
-rw-r--r-- | brunch/tests/test_helpers | 2 |
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" |