-
Notifications
You must be signed in to change notification settings - Fork 2
ci: add CheckKernelLLVM #4
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
base: main
Are you sure you want to change the base?
Changes from 2 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,33 @@ | ||
| import os | ||
| import sys | ||
| import re | ||
|
|
||
| from ci import Verdict, EndTest, submit_pw_check | ||
| from ci import CheckAllWarning | ||
|
|
||
| class CheckKernelLLVM(CheckAllWarning): | ||
| """Build kernel with LLVM + context analysis | ||
| """ | ||
|
|
||
| def __init__(self, ci_data, kernel_config=None, src_dir=None, dry_run=None): | ||
| # Enable context analysis unconditionally | ||
| kernel_config = self.make_kernel_config(kernel_config) | ||
|
|
||
| super().__init__(ci_data, kernel_config=kernel_config, src_dir=src_dir, | ||
| dry_run=dry_run, make_params=["LLVM=1"]) | ||
|
|
||
| self.name = "CheckKernelLLVM" | ||
| self.desc = "Build kernel with LLVM + context analysis" | ||
|
|
||
| def make_kernel_config(self, old_kernel_config): | ||
| kernel_config = "/build_kernel_llvm.config" | ||
| if not old_kernel_config: | ||
| old_kernel_config = '/bluetooth_build.config' | ||
|
|
||
| with open(old_kernel_config, "r") as f: | ||
| config_text = f.read() | ||
| config_text += "\n\nCONFIG_WARN_CONTEXT_ANALYSIS=y" | ||
| with open(kernel_config, "w") as f: | ||
| f.write(config_text) | ||
|
|
||
| return kernel_config |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |
|
|
||
| set -e | ||
|
|
||
| export PATH=/opt/llvm/bin:$PATH | ||
|
Contributor
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. This wouldn't be needed if we used llvm from the distribution, see BluezTestBot/docker-bluez-build#2 (comment)
Contributor
Author
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. As long as the CONTEXT_ANALYSIS is a bit of a moving target vs Clang versions, I think it's better to pick manually the compiler we want |
||
|
|
||
| echo "Environment Variables:" | ||
| echo " Workflow: $GITHUB_WORKFLOW" | ||
| echo " Action: $GITHUB_ACTION" | ||
|
|
@@ -171,9 +173,62 @@ case $TASK in | |
| exit 1 | ||
| fi | ||
| ;; | ||
| localci) | ||
| echo "Task: local CI" | ||
| mkdir -p /work | ||
| mkdir -p /work/base | ||
| GITHUB_WORKSPACE=/work | ||
| BASE_DIR=base | ||
|
|
||
| SPACE="$2" | ||
| GITHUB_REPOSITORY="$3" | ||
| PR="$4" | ||
|
|
||
| git config --global user.name "local" | ||
| git config --global user.email "local@users.noreply.github.com" | ||
|
|
||
| echo "Target ($SPACE): $GITHUB_REPOSITORY PR: $PR" | ||
|
|
||
| ls -l "$GITHUB_WORKSPACE/$BASE_DIR" | ||
| if ! test -d "$GITHUB_WORKSPACE/$BASE_DIR/src"; then | ||
| echo "Cloning https://github.com/$GITHUB_REPOSITORY" | ||
| git clone --depth 1 "https://github.com/$GITHUB_REPOSITORY" \ | ||
| $GITHUB_WORKSPACE/$BASE_DIR/src | ||
|
Contributor
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. You'll probably want to run shellcheck on that portion of the script, see also #5 which does that for the rest of the script. |
||
| fi | ||
| set_git_safe_dir $GITHUB_WORKSPACE/$BASE_DIR/src | ||
|
|
||
| if ! test -d "$GITHUB_WORKSPACE/$BASE_DIR/ell"; then | ||
| clone_ell $GITHUB_WORKSPACE/$BASE_DIR/ell | ||
| fi | ||
| set_git_safe_dir $GITHUB_WORKSPACE/$BASE_DIR/ell | ||
|
|
||
| mkdir $GITHUB_WORKSPACE/$BASE_DIR/patch | ||
|
|
||
| if [ $SPACE == "kernel" ]; then | ||
| if ! test -d "$GITHUB_WORKSPACE/$BASE_DIR/bluez"; then | ||
| clone_bluez $GITHUB_WORKSPACE/$BASE_DIR/bluez | ||
| fi | ||
| set_git_safe_dir $GITHUB_WORKSPACE/$BASE_DIR/bluez | ||
| /ci.py -c /config.json -z $GITHUB_WORKSPACE/$BASE_DIR/bluez \ | ||
| -e $GITHUB_WORKSPACE/$BASE_DIR/ell \ | ||
| -k $GITHUB_WORKSPACE/$BASE_DIR/src \ | ||
| -p $GITHUB_WORKSPACE/$BASE_DIR/patch \ | ||
| kernel $GITHUB_REPOSITORY $PR \ | ||
| --dry-run | ||
| elif [ $SPACE == "user" ]; then | ||
| /ci.py -c /config.json -z $GITHUB_WORKSPACE/$BASE_DIR/src \ | ||
| -e $GITHUB_WORKSPACE/$BASE_DIR/ell \ | ||
| -p $GITHUB_WORKSPACE/$BASE_DIR/patch \ | ||
| user $GITHUB_REPOSITORY $PR \ | ||
| --dry-run | ||
| else | ||
| echo "Unknown SPACE: $SPACE" | ||
| exit 1 | ||
| fi | ||
| ;; | ||
| *) | ||
| echo "Unknown TASK: $TASK" | ||
| eixt 1 | ||
| exit 1 | ||
|
Contributor
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. I've fixed this separately in #5 |
||
| ;; | ||
| esac | ||
|
|
||
|
|
||
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.
Don't know if it's too early to ask for that, but would it be possible to only have "generic" make params be added to the make params? I'm thinking of the (eventual) meson support which wouldn't know what to do with
W=1.