-
Notifications
You must be signed in to change notification settings - Fork 608
Extract unittest scripts and add Buck mode #8493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
set -eux | ||
|
||
# TODO: expand this to //... | ||
buck2 query //runtime/... | ||
|
||
# TODO: expand the covered scope of Buck targets. | ||
buck2 build //runtime/core/portable_type/... | ||
buck2 test //runtime/core/portable_type/... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
set -eux | ||
|
||
# Run pytest with coverage | ||
pytest -n auto --cov=./ --cov-report=xml | ||
# Run gtest | ||
LLVM_PROFDATA=llvm-profdata-12 LLVM_COV=llvm-cov-12 \ | ||
test/run_oss_cpp_tests.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
set -eux | ||
|
||
BUILD_TOOL=$1 | ||
if [[ $BUILD_TOOL =~ ^(cmake|buck2)$ ]]; then | ||
echo "Running unittests for ${BUILD_TOOL} ..." | ||
else | ||
echo "Missing build tool (require buck2 or cmake), exiting..." | ||
exit 1 | ||
fi | ||
|
||
# The generic Linux job chooses to use base env, not the one setup by the image | ||
eval "$(conda shell.bash hook)" | ||
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") | ||
conda activate "${CONDA_ENV}" | ||
|
||
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate | ||
source .ci/scripts/setup-vulkan-linux-deps.sh | ||
|
||
PYTHON_EXECUTABLE=python \ | ||
EXECUTORCH_BUILD_PYBIND=ON \ | ||
CMAKE_ARGS="-DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \ | ||
.ci/scripts/setup-linux.sh "$BUILD_TOOL" | ||
|
||
# Install llama3_2_vision dependencies. | ||
PYTHON_EXECUTABLE=python ./examples/models/llama3_2_vision/install_requirements.sh | ||
|
||
if [[ "$BUILD_TOOL" == "cmake" ]]; then | ||
.ci/scripts/unittest-linux-cmake.sh | ||
elif [[ "$BUILD_TOOL" == "buck2" ]]; then | ||
.ci/scripts/unittest-buck2.sh | ||
else | ||
echo "Unknown build tool $BUILD_TOOL" | ||
exit 1 | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
set -eux | ||
|
||
# Run pytest with coverage | ||
${CONDA_RUN} pytest -n auto --cov=./ --cov-report=xml | ||
# Run gtest | ||
LLVM_PROFDATA="xcrun llvm-profdata" LLVM_COV="xcrun llvm-cov" \ | ||
${CONDA_RUN} test/run_oss_cpp_tests.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
set -eux | ||
|
||
BUILD_TOOL=$1 | ||
if [[ $BUILD_TOOL =~ ^(cmake|buck2)$ ]]; then | ||
echo "Running unittests for ${BUILD_TOOL} ..." | ||
else | ||
echo "Missing build tool (require buck2 or cmake), exiting..." | ||
exit 1 | ||
fi | ||
|
||
bash .ci/scripts/setup-conda.sh | ||
eval "$(conda shell.bash hook)" | ||
|
||
# Create temp directory for sccache shims | ||
export TMP_DIR=$(mktemp -d) | ||
export PATH="${TMP_DIR}:$PATH" | ||
trap 'rm -rfv ${TMP_DIR}' EXIT | ||
|
||
# Setup MacOS dependencies as there is no Docker support on MacOS atm | ||
PYTHON_EXECUTABLE=python \ | ||
EXECUTORCH_BUILD_PYBIND=ON \ | ||
CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \ | ||
${CONDA_RUN} --no-capture-output \ | ||
.ci/scripts/setup-macos.sh cmake | ||
|
||
# Install llama3_2_vision dependencies. | ||
PYTHON_EXECUTABLE=python ./examples/models/llama3_2_vision/install_requirements.sh | ||
|
||
if [[ "$BUILD_TOOL" == "cmake" ]]; then | ||
.ci/scripts/unittest-macos-cmake.sh | ||
elif [[ "$BUILD_TOOL" == "buck2" ]]; then | ||
.ci/scripts/unittest-buck2.sh | ||
else | ||
echo "Unknown build tool $BUILD_TOOL" | ||
exit 1 | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python ${CONDA_RUN}...
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the conda run is right there on line 29, and the code comes directly from _unittest.yml