Merge pull request #8654 from keymanapp/fix/common/8650-deps-flag

fix(common): builder - pass deps flags to child scripts
This commit is contained in:
Marc Durdin 2023-04-24 22:51:09 +10:00 committed by GitHub
commit bb4d335401
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 57 additions and 3 deletions

View file

@ -1 +1,2 @@
child?.*
child?.*
dep.*

View file

@ -32,7 +32,7 @@ else
fi
# All child actions will generate files which we need to verify for test
rm -f ./child?.*
rm -f ./child?.* ./dep.clean ./dep.configure ./dep.build
function test_present() {
local target=$1
@ -45,7 +45,7 @@ function test_present() {
if [ ! -f $target.$action ]; then
builder_die "$CROSS FAIL: ./$target.$action to be present"
else
echo "$CHECK PASS: ./$target.$action found as expected"
echo -e "$CHECK PASS: ./$target.$action found as expected"
fi
fi
}

View file

@ -15,6 +15,7 @@ cd "$THIS_SCRIPT_PATH"
project=child1
builder_describe "$project test module" \
"@../dep" \
clean \
configure \
build \

View file

@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -eu
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "${THIS_SCRIPT%/*}/../../../../../resources/build/build-utils.sh"
# END STANDARD BUILD SCRIPT INCLUDE
cd "$THIS_SCRIPT_PATH"
# Test builder_describe_outputs and dependencies
project=dep
builder_describe "$project test module" \
clean \
configure \
build
builder_parse "$@"
if builder_is_child_build; then
builder_die "FAIL: builder_is_child_build should return false but was $_builder_is_child for a dependency script"
else
builder_echo "PASS: builder_is_child_build is false ($_builder_is_child) for the dependency script"
fi
function test_action() {
local action=$1
if builder_start_action $action; then
touch ../$project.$action
builder_finish_action success $action
fi
}
test_action clean
test_action configure
test_action build

View file

@ -2,16 +2,26 @@
set -eu
echo "--- Full clean configure build install test build ---"
./build.sh clean configure build install test
if [ $(ls child?.* | wc -l) -ne 14 ]; then
echo unexpected output file count
exit 1
fi
echo "--- Test error result for child build ---"
./build.sh error && (echo should not have passed; exit 1) || (echo " ... build returned error as expected")
echo "--- Test building only specific actions and targets (install:child1 test:child2) ---"
./build.sh install:child1 test:child2
if [ $(ls child?.* | wc -l) -ne 2 ]; then
echo unexpected output file count
exit 1
fi
echo "--- Test that --no-deps is passed correctly to child scripts ---"
./build.sh --no-deps
if [ -f ./dep.configure ] || [ -f ./dep.build ]; then
echo unexpected dep.configure or dep.build file, should not have built this because of --no-deps flag
exit 1
fi

View file

@ -394,6 +394,7 @@ _builder_execute_child() {
"$script" $action \
--builder-child \
$_builder_build_deps \
${child_options[@]} \
$builder_verbose \
$builder_debug \