Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,9 @@ def create_test_list_kernel(ci_data):
# BuildKernel32
test_list.append(ci.BuildKernel32(ci_data, kernel_config=kernel_config))

# CheckKernelLLVM
test_list.append(ci.CheckKernelLLVM(ci_data, kernel_config=kernel_config))

# TestRunnerSetup
tester_config = os.path.join(ci_data.config['bluez_dir'],
"doc", "tester.config")
Expand Down
1 change: 1 addition & 0 deletions ci/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
from .checksparse import CheckSparse
from .checkallwarning import CheckAllWarning
from .checksmatch import CheckSmatch
from .checkkernelllvm import CheckKernelLLVM

18 changes: 12 additions & 6 deletions ci/checkallwarning.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class CheckAllWarning(GenericKernelBuild):
This class runs the kernel build with all warning enabled.
"""

def __init__(self, ci_data, kernel_config=None, src_dir=None, dry_run=None):
def __init__(self, ci_data, kernel_config=None, src_dir=None, dry_run=None,
make_params=None):

self.name = "CheckAllWarning"
self.desc = "Run linux kernel with all warning enabled"
Expand All @@ -30,8 +31,13 @@ def __init__(self, ci_data, kernel_config=None, src_dir=None, dry_run=None):
self.log_dbg(f"Override the dry_run flag: {dry_run}")
self.dry_run = dry_run

if make_params:
make_params = ['W=1'] + make_params
Copy link
Copy Markdown
Contributor

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.

else:
make_params = ['W=1']

super().__init__(kernel_config=kernel_config, simple_build=True,
make_params=['W=1'], work_dir=self.src_dir)
make_params=make_params, work_dir=self.src_dir)

self.log_dbg("Initialization completed")

Expand All @@ -52,7 +58,7 @@ def run(self):
if self.verdict == Verdict.FAIL:
submit_pw_check(self.ci_data.pw, self.ci_data.patch_1,
self.name, Verdict.FAIL,
"CheckAllWarning: FAIL: " + self.output,
f"{self.name}: FAIL: " + self.output,
None, self.dry_run)
# Test verdict and output is already set by the super().run().
# Just raising EndTest exception is enough here
Expand All @@ -64,7 +70,7 @@ def run(self):
# Build success
submit_pw_check(self.ci_data.pw, self.ci_data.patch_1,
self.name, Verdict.PASS,
"CheckAllWarning PASS",
f"{self.name} PASS",
None, self.dry_run)
# Actually no need to call success() here. But add it here just for
# reference
Expand All @@ -86,15 +92,15 @@ def run(self):
# Found error and return warning
submit_pw_check(self.ci_data.pw, self.ci_data.patch_1,
self.name, Verdict.WARNING,
"CheckSparse WARNING " + output_str,
f"{self.name} WARNING " + output_str,
None, self.dry_run)
self.warning(output_str)
return

# Build success
submit_pw_check(self.ci_data.pw, self.ci_data.patch_1,
self.name, Verdict.PASS,
"CheckSparse PASS",
f"{self.name} PASS",
None, self.dry_run)
# Actually no need to call success() here. But add it here just for
# reference
Expand Down
33 changes: 33 additions & 0 deletions ci/checkkernelllvm.py
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
2 changes: 2 additions & 0 deletions ci/generickernelbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def run(self):
# Update .config
self.log_info("GenericKernelBuild: Run make olddefconfig")
cmd = ["make", "olddefconfig"]
if self.make_params:
cmd += self.make_params
(ret, stdout, stderr) = cmd_run(cmd, cwd=self.work_dir)
if ret:
self.log_err("GenericKernelBuild: Failed to config the kernel")
Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

export PATH=/opt/llvm/bin:$PATH
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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"
Expand Down