-
Notifications
You must be signed in to change notification settings - Fork 769
[Buildbot] Add scripts for build steps #45
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Scripts for build steps on Buildbot | ||
|
||
## Purpose | ||
|
||
The purpose of the script is for developer to customize build command for the builder on Buildbot. | ||
|
||
## How it works | ||
|
||
The scripts will be run by Buildbot at corresponding build step, for example, the "compile" step will run "compile.sh". Developer can change the build command, then the builder (e.g. pull request builder) will use the changed command to do the build. | ||
|
||
## Arguments for the scripts | ||
|
||
* -b BRANCH: the branch name to build | ||
* -n BUILD\_NUMBER: the Buildbot build number (the build count of one builder, which will be in the url of one specific build) | ||
* -r PR\_NUMBER: if it's a pull request build, this will be the pull request number | ||
|
||
## Assumptions | ||
|
||
The Buildbot worker directory structure is: | ||
|
||
/path/to/WORKER_ROOT/BUILDER/ | ||
llvm.src --> source code | ||
llvm.obj --> build directory | ||
|
||
Initial working directory of the scripts: | ||
|
||
* dependency.sh : llvm.obj | ||
* configure.sh : llvm.obj | ||
* compile.sh : llvm.obj | ||
* clang-tidy.sh : llvm.src | ||
* check-llvm.sh : llvm.obj | ||
* check-clang.sh : llvm.obj | ||
* check-llvm-spirv.sh : llvm.obj | ||
* check-sycl.sh : llvm.obj |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
BRANCH= | ||
BUILD_NUMBER= | ||
PR_NUMBER= | ||
|
||
# $1 exit code | ||
# $2 error message | ||
exit_if_err() | ||
{ | ||
if [ $1 -ne 0 ]; then | ||
echo "Error: $2" | ||
exit $1 | ||
fi | ||
} | ||
|
||
unset OPTIND | ||
while getopts ":b:r:n:" option; do | ||
case $option in | ||
b) BRANCH=$OPTARG ;; | ||
n) BUILD_NUMBER=$OPTARG ;; | ||
r) PR_NUMBER=$OPTARG ;; | ||
esac | ||
done && shift $(($OPTIND - 1)) | ||
|
||
# we're in llvm.obj dir | ||
BUILD_DIR=${PWD} | ||
|
||
make check-clang VERBOSE=1 LIT_ARGS="-v -j `nproc`" | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
BRANCH= | ||
BUILD_NUMBER= | ||
PR_NUMBER= | ||
|
||
# $1 exit code | ||
# $2 error message | ||
exit_if_err() | ||
{ | ||
if [ $1 -ne 0 ]; then | ||
echo "Error: $2" | ||
exit $1 | ||
fi | ||
} | ||
|
||
unset OPTIND | ||
while getopts ":b:r:n:" option; do | ||
case $option in | ||
b) BRANCH=$OPTARG ;; | ||
n) BUILD_NUMBER=$OPTARG ;; | ||
r) PR_NUMBER=$OPTARG ;; | ||
esac | ||
done && shift $(($OPTIND - 1)) | ||
|
||
# we're in llvm.obj dir | ||
BUILD_DIR=${PWD} | ||
|
||
make check-llvm-spirv VERBOSE=1 LIT_ARGS="-v -j `nproc`" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
BRANCH= | ||
BUILD_NUMBER= | ||
PR_NUMBER= | ||
|
||
# $1 exit code | ||
# $2 error message | ||
exit_if_err() | ||
{ | ||
if [ $1 -ne 0 ]; then | ||
echo "Error: $2" | ||
exit $1 | ||
fi | ||
} | ||
|
||
unset OPTIND | ||
while getopts ":b:r:n:" option; do | ||
case $option in | ||
b) BRANCH=$OPTARG ;; | ||
n) BUILD_NUMBER=$OPTARG ;; | ||
r) PR_NUMBER=$OPTARG ;; | ||
esac | ||
done && shift $(($OPTIND - 1)) | ||
|
||
# we're in llvm.obj dir | ||
BUILD_DIR=${PWD} | ||
|
||
make check-llvm VERBOSE=1 LIT_ARGS="-v -j `nproc`" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
BRANCH= | ||
BUILD_NUMBER= | ||
PR_NUMBER= | ||
|
||
# $1 exit code | ||
# $2 error message | ||
exit_if_err() | ||
{ | ||
if [ $1 -ne 0 ]; then | ||
echo "Error: $2" | ||
exit $1 | ||
fi | ||
} | ||
|
||
unset OPTIND | ||
while getopts ":b:r:n:" option; do | ||
case $option in | ||
b) BRANCH=$OPTARG ;; | ||
n) BUILD_NUMBER=$OPTARG ;; | ||
r) PR_NUMBER=$OPTARG ;; | ||
esac | ||
done && shift $(($OPTIND - 1)) | ||
|
||
# we're in llvm.obj dir | ||
BUILD_DIR=${PWD} | ||
|
||
make check-sycl VERBOSE=1 LIT_ARGS="-v -j `nproc`" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no difference between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vladimirlaz could you please help comment on this. I think one of the advantage of seperate script is easy customization. Anyway, we can combine them if needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch from my perspective. We can have check.sh script which accepts exact target as command line and environment variable |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
BRANCH= | ||
BUILD_NUMBER= | ||
PR_NUMBER= | ||
|
||
# $1 exit code | ||
# $2 error message | ||
exit_if_err() | ||
{ | ||
if [ $1 -ne 0 ]; then | ||
echo "Error: $2" | ||
exit $1 | ||
fi | ||
} | ||
|
||
unset OPTIND | ||
while getopts ":b:r:n:" option; do | ||
case $option in | ||
b) BRANCH=$OPTARG ;; | ||
n) BUILD_NUMBER=$OPTARG ;; | ||
r) PR_NUMBER=$OPTARG ;; | ||
esac | ||
done && shift $(($OPTIND - 1)) | ||
|
||
if [ -z "${PR_NUMBER}" ]; then | ||
echo "No PR number provided" | ||
exit 1 | ||
fi | ||
|
||
# we're in llvm.src dir | ||
SRC_DIR=${PWD} | ||
BUILDER_DIR=$(cd ..; pwd) | ||
|
||
# Get changed files | ||
base_commit=`git merge-base origin/sycl refs/pull/${PR_NUMBER}/merge` | ||
exit_if_err $? "fail to get base commit" | ||
|
||
path_list_file=${BUILDER_DIR}/changed_files.txt | ||
git --no-pager diff ${base_commit} refs/pull/${PR_NUMBER}/merge --name-only > ${path_list_file} | ||
cat ${path_list_file} | ||
|
||
# Run clang-tidy | ||
while IFS='' read -r line ; do | ||
file_name=$(basename ${line}) | ||
file_ext=${file_name##*.} | ||
if [[ "${file_ext}" == "h" || "${file_ext}" == "hpp" || "${file_ext}" == "c" || "${file_ext}" == "cc" || "${file_ext}" == "cpp" ]]; then | ||
${BUILDER_DIR}/llvm.obj/bin/clang-tidy ${line} | ||
fi | ||
done < "${path_list_file}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
BRANCH= | ||
BUILD_NUMBER= | ||
PR_NUMBER= | ||
|
||
# $1 exit code | ||
# $2 error message | ||
exit_if_err() | ||
{ | ||
if [ $1 -ne 0 ]; then | ||
echo "Error: $2" | ||
exit $1 | ||
fi | ||
} | ||
|
||
unset OPTIND | ||
while getopts ":b:r:n:" option; do | ||
case $option in | ||
b) BRANCH=$OPTARG ;; | ||
n) BUILD_NUMBER=$OPTARG ;; | ||
r) PR_NUMBER=$OPTARG ;; | ||
esac | ||
done && shift $(($OPTIND - 1)) | ||
|
||
# we're in llvm.obj dir | ||
BUILD_DIR=${PWD} | ||
|
||
make -j`nproc` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
BRANCH= | ||
BUILD_NUMBER= | ||
PR_NUMBER= | ||
|
||
# $1 exit code | ||
# $2 error message | ||
exit_if_err() | ||
{ | ||
if [ $1 -ne 0 ]; then | ||
echo "Error: $2" | ||
exit $1 | ||
fi | ||
} | ||
|
||
unset OPTIND | ||
while getopts ":b:r:n:" option; do | ||
case $option in | ||
b) BRANCH=$OPTARG ;; | ||
n) BUILD_NUMBER=$OPTARG ;; | ||
r) PR_NUMBER=$OPTARG ;; | ||
esac | ||
done && shift $(($OPTIND - 1)) | ||
|
||
# we're in llvm.obj dir | ||
BUILD_DIR=${PWD} | ||
|
||
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=clang -DLLVM_EXTERNAL_PROJECTS="sycl;llvm-spirv" \ | ||
-DLLVM_EXTERNAL_SYCL_SOURCE_DIR=../llvm.src/sycl -DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=../llvm.src/llvm-spirv \ | ||
-DLLVM_TOOL_SYCL_BUILD=ON -DLLVM_TOOL_LLVM_SPIRV_BUILD=ON -DOpenCL_INCLUDE_DIR="OpenCL-Headers" \ | ||
-DOpenCL_LIBRARY="OpenCL-ICD-Loader/build/lib/libOpenCL.so" ../llvm.src/llvm |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
BRANCH= | ||
BUILD_NUMBER= | ||
PR_NUMBER= | ||
|
||
# $1 exit code | ||
# $2 error message | ||
exit_if_err() | ||
{ | ||
if [ $1 -ne 0 ]; then | ||
echo "Error: $2" | ||
exit $1 | ||
fi | ||
} | ||
|
||
unset OPTIND | ||
while getopts ":b:r:n:" option; do | ||
case $option in | ||
b) BRANCH=$OPTARG ;; | ||
n) BUILD_NUMBER=$OPTARG ;; | ||
r) PR_NUMBER=$OPTARG ;; | ||
esac | ||
done && shift $(($OPTIND - 1)) | ||
|
||
# we're in llvm.obj dir | ||
BUILD_DIR=${PWD} | ||
|
||
## GET dependencies | ||
if [ ! -d "OpenCL-Headers" ]; then | ||
git clone https://github.com/KhronosGroup/OpenCL-Headers OpenCL-Headers | ||
exit_if_err $? "failed to clone OpenCL-Headers" | ||
else | ||
cd OpenCL-Headers | ||
git pull --ff --ff-only origin | ||
exit_if_err $? "failed to update OpenCL-Headers" | ||
fi | ||
|
||
OPENCL_HEADERS=${BUILD_DIR}/OpenCL-Headers | ||
|
||
cd ${BUILD_DIR} | ||
if [ ! -d "OpenCL-ICD-Loader" ]; then | ||
git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader OpenCL-ICD-Loader | ||
exit_if_err $? "failed to clone OpenCL-ICD-Loader" | ||
else | ||
cd OpenCL-ICD-Loader | ||
git pull --ff --ff-only origin | ||
exit_if_err $? "failed to update OpenCL-ICD-Loader" | ||
fi | ||
|
||
cd ${BUILD_DIR}/OpenCL-ICD-Loader | ||
make C_INCLUDE_PATH=${OPENCL_HEADERS} | ||
exit_if_err $? "failed to build OpenCL-ICD-Loader" |
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.
Is it possible to make this utility configurable?
I use ninja to build LLVM and run the tests and I'd like to use these scripts on my local machine to reproduce the results/debug/etc.
I think you can re-use cmake for this:
cmake --build <> --taget <>
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.
I think the scripts are for builders on Buildbot, Buildbot will run these scripts during build. As per @vladimirlaz , developer will control these scripts, you can change to ninja as you wish, but you need to change all of the scripts, e.g. conigure.sh, compile.sh
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.
Do we need these complication? If you want to reproduce failure it is better to have exact the same configuration including tooling.
Locally developer can use any tools chain he needs.