Skip to content

Commit b3bca69

Browse files
committed
Update on "[build] Add editable mode unittest"
As titled. To do this we need to refactor the arguments being passed into `setup-linux.sh` `setup-macos.sh` and `unittest-linux.sh` `unittest-macos.sh`. [ghstack-poisoned]
2 parents 5c9a49c + 0a6ae11 commit b3bca69

File tree

5 files changed

+11
-19
lines changed

5 files changed

+11
-19
lines changed

.ci/scripts/setup-linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -exu
1010
# shellcheck source=/dev/null
1111
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

13-
parse_args "$@"
13+
read -r BUILD_TOOL BUILD_MODE EDITABLE < <(parse_args "$@")
1414

1515
# As Linux job is running inside a Docker container, all of its dependencies
1616
# have already been installed, so we use PyTorch build from source here instead

.ci/scripts/setup-macos.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -exu
1010
# shellcheck source=/dev/null
1111
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

13-
parse_args "$@"
13+
read -r BUILD_TOOL BUILD_MODE EDITABLE < <(parse_args "$@")
1414

1515
install_buck() {
1616
if ! command -v zstd &> /dev/null; then
@@ -130,9 +130,9 @@ install_pytorch_and_domains
130130
# We build PyTorch from source here instead of using nightly. This allows CI to test against
131131
# the pinned commit from PyTorch
132132
if [[ "$EDITABLE" == "true" ]]; then
133-
install_executorch "--use-pt-pinned-commit" "--editable"
133+
install_executorch --use-pt-pinned-commit --editable
134134
else
135-
install_executorch "--use-pt-pinned-commit"
135+
install_executorch --use-pt-pinned-commit
136136
fi
137137
build_executorch_runner "${BUILD_TOOL}" "${BUILD_MODE}"
138138

.ci/scripts/unittest-linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set -eux
99
# shellcheck source=/dev/null
1010
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1111

12-
parse_args "$@"
12+
read -r BUILD_TOOL BUILD_MODE EDITABLE < <(parse_args "$@")
1313

1414
# The generic Linux job chooses to use base env, not the one setup by the image
1515
eval "$(conda shell.bash hook)"

.ci/scripts/unittest-macos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set -eux
99
# shellcheck source=/dev/null
1010
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1111

12-
parse_args "$@"
12+
read -r BUILD_TOOL BUILD_MODE EDITABLE < <(parse_args "$@")
1313

1414
bash .ci/scripts/setup-conda.sh
1515
eval "$(conda shell.bash hook)"

.ci/scripts/utils.sh

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -191,31 +191,23 @@ parse_args() {
191191
esac
192192
done
193193

194-
if [[ $BUILD_TOOL =~ ^(cmake|buck2)$ ]]; then
195-
echo "Build tool is ${BUILD_TOOL} ..."
196-
elif [ -z "$BUILD_TOOL" ]; then
194+
if [ -z "$BUILD_TOOL" ]; then
197195
echo "Missing build tool (require buck2 or cmake), exiting..."
198196
exit 1
199-
else
197+
elif ! [[ $BUILD_TOOL =~ ^(cmake|buck2)$ ]]; then
200198
echo "Require buck2 or cmake for --build-tool, got ${BUILD_TOOL}, exiting..."
201199
exit 1
202200
fi
203201
BUILD_MODE="${BUILD_MODE:-Release}"
204-
if [[ "$BUILD_MODE" =~ ^(Debug|Release)$ ]]; then
205-
echo "Running tests in build mode ${BUILD_MODE} ..."
206-
else
202+
if ! [[ "$BUILD_MODE" =~ ^(Debug|Release)$ ]]; then
207203
echo "Unsupported build mode ${BUILD_MODE}, options are Debug or Release."
208204
exit 1
209205
fi
210206
EDITABLE="${EDITABLE:-false}"
211-
if [[ $EDITABLE =~ ^(true|false)$ ]]; then
212-
echo "Editable mode is ${EDITABLE} ..."
213-
else
207+
if ! [[ $EDITABLE =~ ^(true|false)$ ]]; then
214208
echo "Require true or false for --editable, got ${EDITABLE}, exiting..."
215209
exit 1
216210
fi
217211

218-
echo "BUILD_TOOL=$BUILD_TOOL"
219-
echo "BUILD_MODE=$BUILD_MODE"
220-
echo "EDITABLE=$EDITABLE"
212+
echo "$BUILD_TOOL $BUILD_MODE $EDITABLE"
221213
}

0 commit comments

Comments
 (0)