From 88adf8c0883e66c45667daadec2b169e7c9ed475 Mon Sep 17 00:00:00 2001 From: Anna Rift Date: Wed, 28 Jan 2026 13:43:39 -0800 Subject: [PATCH 1/9] Replace explicit printing and error checking with set -ex Signed-off-by: Anna Rift --- util/packaging/docker/test/brew_install.bash | 28 +++----------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/util/packaging/docker/test/brew_install.bash b/util/packaging/docker/test/brew_install.bash index 0887d701899f..f96d5fab0e3f 100755 --- a/util/packaging/docker/test/brew_install.bash +++ b/util/packaging/docker/test/brew_install.bash @@ -1,4 +1,7 @@ #!/usr/bin/env bash + +set -ex + # Important to set HOMEBREW_NO_INSTALL_FROM_API to actually test changes export HOMEBREW_NO_INSTALL_FROM_API=1 # Might not be needed, but also doesn't hurt and matches homebrew CI @@ -14,35 +17,12 @@ export HOMEBREW_NO_AUTO_UPDATE=1 # fi # tests commands + brew test-bot --only-cleanup-before -if [ $? -ne 0 ]; then - echo "brew test-bot --only-cleanup-before failed" - exit 1 -else - echo "brew test-bot --only-cleanup-before succeeded" -fi brew test-bot --only-setup -if [ $? -ne 0 ]; then - echo "brew test-bot --only-setup failed" - exit 1 -else - echo "brew test-bot --only-setup succeeded" -fi brew test-bot --only-formulae-dependents --junit --testing-formulae=chapel --skipped-or-failed-formulae=chapel -if [ $? -ne 0 ]; then - echo "brew test-bot --only-formulae-dependents --junit --testing-formulae=chapel --skipped-or-failed-formulae=chapel failed" - exit 1 -else - echo "brew test-bot --only-formulae-dependents --junit --testing-formulae=chapel --skipped-or-failed-formulae=chapel succeeded" -fi # This is the bulk of the testing and the same command that Homebrew CI runs brew test-bot --skip-online-checks --only-formulae --junit --only-json-tab --skip-dependents --testing-formulae="chapel" --added-formulae="" --deleted-formulae="" -if [ $? -ne 0 ]; then - echo "brew test-bot --skip-online-checks --only-formulae --junit --only-json-tab --skip-dependents --testing-formulae="chapel" --added-formulae="" --deleted-formulae="" failed" - exit 1 -else - echo "brew test-bot --skip-online-checks --only-formulae --junit --only-json-tab --skip-dependents --testing-formulae="chapel" --added-formulae="" --deleted-formulae="" succeeded" -fi From 7050327cd03b95a97d3578124e0625ca5f357768 Mon Sep 17 00:00:00 2001 From: Anna Rift Date: Wed, 28 Jan 2026 13:44:06 -0800 Subject: [PATCH 2/9] Add bogus bottle info to formula during testing Signed-off-by: Anna Rift --- util/packaging/docker/test/Dockerfile | 11 +++++++++-- .../docker/test/brew_get_bogus_bottles.bash | 14 ++++++++++++++ util/packaging/homebrew/chapel-main.rb | 6 +++--- 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100755 util/packaging/docker/test/brew_get_bogus_bottles.bash diff --git a/util/packaging/docker/test/Dockerfile b/util/packaging/docker/test/Dockerfile index 5210f103ba5f..c3036b3085f3 100644 --- a/util/packaging/docker/test/Dockerfile +++ b/util/packaging/docker/test/Dockerfile @@ -20,7 +20,6 @@ RUN brew update # Upgrade to the latest version of all installed formulae RUN brew upgrade - # necessary so that updated chapel.rb formula can be committed, which is only way it # will be tested RUN git config --global user.name "Chapel Tester" @@ -29,7 +28,15 @@ RUN git config --global user.email "chapeluser@nomail.com" # COPY chapel.rb and chapel*.tar.gz inside the container to run homebrew install COPY chapel.rb /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/c/chapel.rb COPY chapel*.tar.gz /home/linuxbrew/ -# must commit the change or brew doctor will complain WORKDIR /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/ + +# Hack: Insert bogus bottle information into the formula, which is required for +# `brew test-bot` to not ignore install failures (see +# https://github.com/Homebrew/homebrew-test-bot/issues/791). +COPY brew_get_bogus_bottles.bash brew_get_bogus_bottles.bash +RUN brew_get_bogus_bottles.bash | sed -i -e '//r /dev/stdin' -e '//d' Formula/c/chapel.rb +RUN rm brew_get_bogus_bottles.bash + +# must commit the change or brew doctor will complain RUN git add Formula/c/chapel.rb && git commit -m "update chapel.rb for nightly testing" WORKDIR /home/linuxbrew/ diff --git a/util/packaging/docker/test/brew_get_bogus_bottles.bash b/util/packaging/docker/test/brew_get_bogus_bottles.bash new file mode 100755 index 000000000000..a5fa0d9752bd --- /dev/null +++ b/util/packaging/docker/test/brew_get_bogus_bottles.bash @@ -0,0 +1,14 @@ +#!/bin/bash + +platforms=$(brew info --json=v1 chapel | jq ".[0].bottle.stable.files | keys[]" -r) + +max_length=$(echo "$platforms" | awk ' { if ( length > x ) { x = length; y = $0 } }END{ print x+1 }') + +echo " bottle do" +echo "$platforms" | + while read -r platform; do + sha256=$(echo $platform | sha256sum | cut -d" " -f1) + # print platforms with padding to align the sha256 hashes + printf " sha256 %s \"%s\"\n" "$(printf "%-${max_length}s" "$platform:")" "$sha256" + done +echo " end" diff --git a/util/packaging/homebrew/chapel-main.rb b/util/packaging/homebrew/chapel-main.rb index 76f13d8c0128..5337cf80cb65 100644 --- a/util/packaging/homebrew/chapel-main.rb +++ b/util/packaging/homebrew/chapel-main.rb @@ -10,9 +10,9 @@ class Chapel < Formula no_autobump! because: :bumped_by_upstream - # Don't include the bottle information in chapel-main.rb deliberately. The - # idea is that we don't want to accidentally use a published bottle in our testing, - # which would always report passing. + # Don't include real bottle information here, to avoid accidentally testing + # off of a published bottle. + depends_on "cmake" depends_on "gmp" From a28cd343b45dc0919cfc42bdfa2ff6fe26c74522 Mon Sep 17 00:00:00 2001 From: Anna Rift Date: Wed, 28 Jan 2026 13:57:33 -0800 Subject: [PATCH 3/9] Break test if bottle insertion fails Signed-off-by: Anna Rift --- util/packaging/docker/test/brew_get_bogus_bottles.bash | 1 - util/packaging/homebrew/chapel-main.rb | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) mode change 100755 => 100644 util/packaging/docker/test/brew_get_bogus_bottles.bash diff --git a/util/packaging/docker/test/brew_get_bogus_bottles.bash b/util/packaging/docker/test/brew_get_bogus_bottles.bash old mode 100755 new mode 100644 index a5fa0d9752bd..a4b9ba53c38b --- a/util/packaging/docker/test/brew_get_bogus_bottles.bash +++ b/util/packaging/docker/test/brew_get_bogus_bottles.bash @@ -4,7 +4,6 @@ platforms=$(brew info --json=v1 chapel | jq ".[0].bottle.stable.files | keys[]" max_length=$(echo "$platforms" | awk ' { if ( length > x ) { x = length; y = $0 } }END{ print x+1 }') -echo " bottle do" echo "$platforms" | while read -r platform; do sha256=$(echo $platform | sha256sum | cut -d" " -f1) diff --git a/util/packaging/homebrew/chapel-main.rb b/util/packaging/homebrew/chapel-main.rb index 5337cf80cb65..a36e6f104af0 100644 --- a/util/packaging/homebrew/chapel-main.rb +++ b/util/packaging/homebrew/chapel-main.rb @@ -12,7 +12,9 @@ class Chapel < Formula # Don't include real bottle information here, to avoid accidentally testing # off of a published bottle. + bottle do + # Intentionally not `end`ed so if insertion fails the test will break depends_on "cmake" depends_on "gmp" From 21d5e830860a845d035dca5d04ed73784b7ef2e6 Mon Sep 17 00:00:00 2001 From: Anna Rift Date: Thu, 29 Jan 2026 10:33:25 -0800 Subject: [PATCH 4/9] Make script executable Signed-off-by: Anna Rift --- util/packaging/docker/test/brew_get_bogus_bottles.bash | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 util/packaging/docker/test/brew_get_bogus_bottles.bash diff --git a/util/packaging/docker/test/brew_get_bogus_bottles.bash b/util/packaging/docker/test/brew_get_bogus_bottles.bash old mode 100644 new mode 100755 From 947abcb2dc0a8bc9cd89f8bb8e550f13cd85f4bd Mon Sep 17 00:00:00 2001 From: Anna Rift Date: Thu, 29 Jan 2026 11:05:42 -0800 Subject: [PATCH 5/9] Copy script into container and run from inside Signed-off-by: Anna Rift --- util/packaging/docker/test/Dockerfile | 9 ++------- util/packaging/docker/test/brew_install.bash | 6 ++++++ util/packaging/docker/test/homebrew_ci.bash | 2 ++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/util/packaging/docker/test/Dockerfile b/util/packaging/docker/test/Dockerfile index c3036b3085f3..c5a9576a8d58 100644 --- a/util/packaging/docker/test/Dockerfile +++ b/util/packaging/docker/test/Dockerfile @@ -30,13 +30,8 @@ COPY chapel.rb /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebre COPY chapel*.tar.gz /home/linuxbrew/ WORKDIR /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/ -# Hack: Insert bogus bottle information into the formula, which is required for -# `brew test-bot` to not ignore install failures (see -# https://github.com/Homebrew/homebrew-test-bot/issues/791). -COPY brew_get_bogus_bottles.bash brew_get_bogus_bottles.bash -RUN brew_get_bogus_bottles.bash | sed -i -e '//r /dev/stdin' -e '//d' Formula/c/chapel.rb -RUN rm brew_get_bogus_bottles.bash - # must commit the change or brew doctor will complain RUN git add Formula/c/chapel.rb && git commit -m "update chapel.rb for nightly testing" WORKDIR /home/linuxbrew/ + +COPY brew_get_bogus_bottles.bash brew_get_bogus_bottles.bash diff --git a/util/packaging/docker/test/brew_install.bash b/util/packaging/docker/test/brew_install.bash index f96d5fab0e3f..f00c31f17cf5 100755 --- a/util/packaging/docker/test/brew_install.bash +++ b/util/packaging/docker/test/brew_install.bash @@ -2,6 +2,12 @@ set -ex +# Hack to inject bogus bottle block into chapel.rb for testing purposes. +cd /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core +/home/linuxbrew/brew_get_bogus_bottles.bash | sed -i -e '//r /dev/stdin' -e '//d' Formula/c/chapel.rb +git add Formula/c/chapel.rb && git commit -m "update chapel.rb for nightly testing" && PAGER=cat git show +cd /home/linuxbrew + # Important to set HOMEBREW_NO_INSTALL_FROM_API to actually test changes export HOMEBREW_NO_INSTALL_FROM_API=1 # Might not be needed, but also doesn't hurt and matches homebrew CI diff --git a/util/packaging/docker/test/homebrew_ci.bash b/util/packaging/docker/test/homebrew_ci.bash index c0af0d903b77..4f3f8181bf2b 100755 --- a/util/packaging/docker/test/homebrew_ci.bash +++ b/util/packaging/docker/test/homebrew_ci.bash @@ -6,6 +6,8 @@ cd ${CHPL_HOME}/util/packaging/docker/test # Remove image with name homebrew_ci before creating a fresh image to avoid failures. docker image rm --force homebrew_ci + +# Build image docker build . --load --platform linux/amd64 -t homebrew_ci containerid= docker image ls | grep 'homebrew_ci' | awk '{print$3}' From 12944d0781d8dc32ac0e48801d08a118024ade90 Mon Sep 17 00:00:00 2001 From: Anna Rift Date: Thu, 29 Jan 2026 11:06:39 -0800 Subject: [PATCH 6/9] Unset HOMEBREW_NO_INSTALL_FROM_API within script and silence metadata download output Signed-off-by: Anna Rift --- .../docker/test/brew_get_bogus_bottles.bash | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/util/packaging/docker/test/brew_get_bogus_bottles.bash b/util/packaging/docker/test/brew_get_bogus_bottles.bash index a4b9ba53c38b..a29fca1acc3c 100755 --- a/util/packaging/docker/test/brew_get_bogus_bottles.bash +++ b/util/packaging/docker/test/brew_get_bogus_bottles.bash @@ -1,13 +1,25 @@ #!/bin/bash +# Generate a "bottle do..." block with bogus SHA256 hashes, to work around +# homebrew behavior of not erroring on failures for un-bottled platforms +# (https://github.com/Homebrew/homebrew-test-bot/issues/791). + +# Have to unset this (just within this script) so `brew info` queries the API +HOMEBREW_NO_INSTALL_FROM_API= + +# Run once before capturing output, due to initial run having output for +# downloading metadata. +brew info &> /dev/null + platforms=$(brew info --json=v1 chapel | jq ".[0].bottle.stable.files | keys[]" -r) max_length=$(echo "$platforms" | awk ' { if ( length > x ) { x = length; y = $0 } }END{ print x+1 }') echo "$platforms" | while read -r platform; do - sha256=$(echo $platform | sha256sum | cut -d" " -f1) + # hash platform name to get a real SHA which would not match the binary + namehash=$(echo $platform | sha256sum | cut -d" " -f1) # print platforms with padding to align the sha256 hashes - printf " sha256 %s \"%s\"\n" "$(printf "%-${max_length}s" "$platform:")" "$sha256" + printf " sha256 %s \"%s\"\n" "$(printf "%-${max_length}s" "$platform:")" "$namehash" done echo " end" From c1c5b6972959e8947677438ee98f06fc5e94123b Mon Sep 17 00:00:00 2001 From: Anna Rift Date: Thu, 29 Jan 2026 11:07:03 -0800 Subject: [PATCH 7/9] Switch to jq keys_unsorted to avoid breaking brew style Signed-off-by: Anna Rift --- util/packaging/docker/test/brew_get_bogus_bottles.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/packaging/docker/test/brew_get_bogus_bottles.bash b/util/packaging/docker/test/brew_get_bogus_bottles.bash index a29fca1acc3c..11cd516650f5 100755 --- a/util/packaging/docker/test/brew_get_bogus_bottles.bash +++ b/util/packaging/docker/test/brew_get_bogus_bottles.bash @@ -11,7 +11,7 @@ HOMEBREW_NO_INSTALL_FROM_API= # downloading metadata. brew info &> /dev/null -platforms=$(brew info --json=v1 chapel | jq ".[0].bottle.stable.files | keys[]" -r) +platforms=$(brew info --json=v1 chapel | jq ".[0].bottle.stable.files | keys_unsorted[]" -r) max_length=$(echo "$platforms" | awk ' { if ( length > x ) { x = length; y = $0 } }END{ print x+1 }') From 7e3924eda1812cccd044acdc4d66411830d9e216 Mon Sep 17 00:00:00 2001 From: Anna Rift Date: Thu, 29 Jan 2026 11:40:36 -0800 Subject: [PATCH 8/9] Set -exo pipefail in test-homebrew*.bash Signed-off-by: Anna Rift --- util/cron/test-homebrew-linux.bash | 3 ++- util/cron/test-homebrew.bash | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/util/cron/test-homebrew-linux.bash b/util/cron/test-homebrew-linux.bash index 359138d48618..7467e1d76d49 100755 --- a/util/cron/test-homebrew-linux.bash +++ b/util/cron/test-homebrew-linux.bash @@ -9,6 +9,8 @@ # tarball created and sha of the tarball, # and run home-brew test-bot commands as homebrew CI does +set -exo pipefail + # Create a tarball from current repo. # The tarball is left in root of repo in tar/ directory. UTIL_CRON_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) ; pwd) @@ -16,7 +18,6 @@ UTIL_CRON_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) ; pwd) # common-tarball sets CHPL_HOME source $UTIL_CRON_DIR/common-tarball.bash - # Tell gen_release to use existing repo instead of creating a new one with # git-archive. export CHPL_GEN_RELEASE_NO_CLONE=true diff --git a/util/cron/test-homebrew.bash b/util/cron/test-homebrew.bash index 3739739a4ad5..3eb8c16bb447 100755 --- a/util/cron/test-homebrew.bash +++ b/util/cron/test-homebrew.bash @@ -6,7 +6,7 @@ # replace the url and sha in the chapel formula with the url pointing to the tarball created and sha of the tarball. # run home-brew scripts to install chapel. -set -ex +set -exo pipefail UTIL_CRON_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) ; pwd) From 98b2087fc16974d79c3390fab9e3c975ca9d4a4f Mon Sep 17 00:00:00 2001 From: Anna Rift Date: Thu, 29 Jan 2026 11:42:53 -0800 Subject: [PATCH 9/9] Also inject bottle block in mac test-homebrew.bash Signed-off-by: Anna Rift --- util/cron/test-homebrew.bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/cron/test-homebrew.bash b/util/cron/test-homebrew.bash index 3eb8c16bb447..f64dc1248183 100755 --- a/util/cron/test-homebrew.bash +++ b/util/cron/test-homebrew.bash @@ -58,14 +58,18 @@ sed_command="sed -i.bak -e " $sed_command "s#url.*#url \"file\:///$location\"#" chapel.rb $sed_command "1s/sha256.*/sha256 \"$sha256\"/;t" -e "1,/sha256.*/s//sha256 \"$sha256\"/" chapel.rb +${CHPL_HOME}/util/packaging/docker/test/brew_get_bogus_bottles.bash | sed -e '//r /dev/stdin' -e '//d' -i '' chapel.rb + log_info "Chapel formula to be tested:" cat chapel.rb # Test if homebrew install using the chapel formula works. brew upgrade brew uninstall --force chapel + # Remove the cached chapel tar file before running brew install --build-from-source chapel.rb rm -f $HOME/Library/Caches/Homebrew/downloads/*--chapel-${short_version}.tar.gz + HOMEBREW_DEVELOPER=1 HOMEBREW_NO_INSTALL_FROM_API=1 brew install -v --build-from-source ./chapel.rb chpl --version