Skip to content
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

fix(kbuild): Do not build kselftest if not set in jobfilter #2729

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
4 changes: 4 additions & 0 deletions kernelci/kbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@


CROS_CONFIG_URL = \
"https://chromium.googlesource.com/chromiumos/third_party/kernel/+archive/refs/heads/{branch}/chromeos/config.tar.gz" # noqa

Check warning on line 42 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

Line too long (129/100)
LEGACY_CONFIG = [
'config/core/build-configs.yaml',
'/etc/kernelci/core/build-configs.yaml',
]
FW_GIT = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git" # noqa

# TODO: find a way to automatically fetch this information

Check warning on line 49 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

TODO: find a way to automatically fetch this information
LATEST_LTS_MAJOR = 6
LATEST_LTS_MINOR = 6

Expand Down Expand Up @@ -156,6 +156,10 @@
self._kfselftest = False
else:
self._kfselftest = True
if node['jobfilter'] and self._kfselftest is True:
kselftest_name = node['name'] + "-kselftest"
if kselftest_name not in node['jobfilter']:
self._kfselftest = False
self._apijobname = jobname
self._steps = []
self._artifacts = []
Expand Down Expand Up @@ -452,8 +456,8 @@
sys.exit(1)

print(f"Searching for fragment {fragname} in {cfg_path}")
if 'fragments' in yml:

Check failure on line 459 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

Value 'yml' doesn't support membership test
frag = yml['fragments']

Check failure on line 460 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

Value 'yml' is unsubscriptable
else:
print("No fragments section in config file")
self.submit_failure("No fragments section in config file")
Expand All @@ -479,7 +483,7 @@
elif fragment.startswith("CONFIG_"):
content = fragment + '\n'
else:
# TODO: implement 'path' option properly

Check warning on line 486 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

TODO: implement 'path' option properly
content = self.add_legacy_fragment(fragment)

fragfile = os.path.join(self._fragments_dir, f"{num}.config")
Expand Down Expand Up @@ -528,8 +532,8 @@
for i in range(0, fragnum):
self.addcmd("./scripts/kconfig/merge_config.sh" +
f" -m .config {self._fragments_dir}/{i}.config")
# TODO: olddefconfig should be optional/configurable

Check warning on line 535 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

TODO: olddefconfig should be optional/configurable
# TODO: log all warnings/errors of olddefconfig to separate file

Check warning on line 536 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

TODO: log all warnings/errors of olddefconfig to separate file
self.addcmd("make olddefconfig")
self.addcmd(f"cp .config {self._af_dir}/")
self.addcmd("cd ..")
Expand All @@ -537,12 +541,12 @@

def _generate_script(self):
""" Generate shell script for complete build """
# TODO(nuclearcat): Fetch firmware only if needed

Check warning on line 544 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

TODO(nuclearcat): Fetch firmware only if needed
print("Generating shell script")
fragnum = self._parse_fragments(firmware=True)
self._merge_frags(fragnum)
if not self._dtbs_check:
# TODO: verify if CONFIG_EXTRA_FIRMWARE have any files

Check warning on line 549 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

TODO: verify if CONFIG_EXTRA_FIRMWARE have any files
# We can check that if fragments have CONFIG_EXTRA_FIRMWARE
self._fetch_firmware()
self._build_kernel()
Expand Down Expand Up @@ -640,7 +644,7 @@
""" Add kernel image packaging steps """
self.startjob("package_kimage")
self.addcmd("cd " + self._srcdir)
# TODO(nuclearcat): Not all images might be present

Check warning on line 647 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

TODO(nuclearcat): Not all images might be present
for img in KERNEL_IMAGE_NAMES[self._arch]:
self.addcmd("cp arch/" + self._arch + "/boot/" + img + " ../artifacts", False)
# add image to artifacts relative to artifacts dir
Expand Down Expand Up @@ -709,7 +713,7 @@

def serialize(self, filename):
""" Serialize class to json """
# TODO(nuclearcat): Implement to_json method?

Check warning on line 716 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

TODO(nuclearcat): Implement to_json method?
data = json.dumps(self, default=lambda o: o.__dict__,
sort_keys=True, indent=4)
with open(filename, 'w') as f:
Expand Down Expand Up @@ -772,7 +776,7 @@
'''
Upload artifacts to storage
'''
# TODO: Upload not using upload_single, but upload as multiple files

Check warning on line 779 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

TODO: Upload not using upload_single, but upload as multiple files
print("[_upload_artifacts] Uploading artifacts to storage")
node_af = {}
storage = self._get_storage()
Expand Down Expand Up @@ -854,7 +858,7 @@
api.node.update(node)
except requests.exceptions.HTTPError as err:
err_msg = json.loads(err.response.content).get("detail", [])
self.log.error(err_msg)

Check failure on line 861 in kernelci/kbuild.py

View workflow job for this annotation

GitHub Actions / Lint

Instance of 'KBuild' has no 'log' member
return

def submit(self, retcode, dry_run=False):
Expand Down
Loading