Skip to content

Commit

Permalink
feat(kbuild): Add kselftest disable option
Browse files Browse the repository at this point in the history
Some kernel builds does not require to build kselftest.
Also remove disable_modules option as its dynamic now.

Signed-off-by: Denys Fedoryshchenko <[email protected]>
  • Loading branch information
nuclearcat committed Oct 16, 2024
1 parent 510a989 commit 535d19f
Showing 1 changed file with 47 additions and 38 deletions.
85 changes: 47 additions & 38 deletions kernelci/kbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- cross_compile: cross compile prefix
- cross_compile_compat: cross compile compat prefix
- dtbs_check: run "make dtbs_check" ONLY, it is actually a separate test
- kselftest: false - do not build kselftest
"""

import os
Expand Down Expand Up @@ -151,7 +152,10 @@ def __init__(self, node=None, jobname=None, params=None, jsonobj=None, apiconfig
self._dtbs_check = params['dtbs_check']
else:
self._dtbs_check = False
self._disable_modules = params.get('disable_modules', False)
if params.get('kselftest') == 'disable':
self._kfselftest = False
else:
self._kfselftest = True
self._apijobname = jobname
self._steps = []
self._artifacts = []
Expand Down Expand Up @@ -205,7 +209,7 @@ def __init__(self, node=None, jobname=None, params=None, jsonobj=None, apiconfig
)
self._full_artifacts = jsonobj['full_artifacts']
self._dtbs_check = jsonobj['dtbs_check']
self._disable_modules = jsonobj['disable_modules']
self._kfselftest = jsonobj['kfselftest']
return
raise ValueError("No valid arguments provided")

Expand Down Expand Up @@ -303,11 +307,11 @@ def init_steps(self):
if not self._dtbs_check:
self._artifacts.append("build_kimage.log")
self._artifacts.append("build_kimage_stderr.log")
if not self._disable_modules:
self._artifacts.append("build_modules.log")
self._artifacts.append("build_modules_stderr.log")
self._artifacts.append("build_kselftest.log")
self._artifacts.append("build_kselftest_stderr.log")
self._artifacts.append("build_modules.log")
self._artifacts.append("build_modules_stderr.log")
if self._kfselftest:
self._artifacts.append("build_kselftest.log")
self._artifacts.append("build_kselftest_stderr.log")
# disable DTBS for some archs
if self._arch not in DTBS_DISABLED:
self._artifacts.append("build_dtbs.log")
Expand Down Expand Up @@ -542,15 +546,15 @@ def _generate_script(self):
# We can check that if fragments have CONFIG_EXTRA_FIRMWARE
self._fetch_firmware()
self._build_kernel()
if not self._disable_modules:
self._build_modules()
self._build_kselftest()
self._build_modules()
if self._kfselftest:
self._build_kselftest()
if self._arch not in DTBS_DISABLED:
self._build_dtbs()
self._package_kimage()
if not self._disable_modules:
self._package_modules()
self._package_kselftest()
self._package_modules()
if self._kfselftest:
self._package_kselftest()
if self._arch not in DTBS_DISABLED:
self._package_dtbs()
else:
Expand Down Expand Up @@ -923,11 +927,12 @@ def submit(self, retcode, dry_run=False):
# TODO(nuclearcat):
# Add child_nodes for each sub-step
# do we have kselftest_tar_gz in artifact keys? then node is ok
kselftest_result = 'fail'
for artifact in af_uri:
if artifact == 'kselftest_tar_gz':
kselftest_result = 'pass'
break
if self._kfselftest:
kselftest_result = 'fail'
for artifact in af_uri:
if artifact == 'kselftest_tar_gz':
kselftest_result = 'pass'
break

results = {
'node': {
Expand All @@ -953,26 +958,30 @@ def submit(self, retcode, dry_run=False):
results['node']['data']['fragments'] = self._fragments
results['node']['data']['config_full'] = self._config_full

kselftest_node = self._node.copy()
# remove id to not have same as parent
kselftest_node.pop('id')
kselftest_node['name'] = kselftest_node['name'] + "-kselftest"
kselftest_node['kind'] = 'test'
existing_path = kselftest_node.get('path')
if existing_path and isinstance(existing_path, list):
kselftest_node['path'] = existing_path.append(kselftest_node['name'])
kselftest_node['parent'] = self._node['id']
kselftest_node['data'] = results['node']['data'].copy()
kselftest_node['artifacts'] = None
kselftest_node['state'] = 'done'
kselftest_node['result'] = kselftest_result

child_nodes = [
{
'node': kselftest_node,
'child_nodes': []
}
]
# if we have kselftest, we need to add child node
if self._kfselftest:
kselftest_node = self._node.copy()
# remove id to not have same as parent
kselftest_node.pop('id')
kselftest_node['name'] = kselftest_node['name'] + "-kselftest"
kselftest_node['kind'] = 'test'
existing_path = kselftest_node.get('path')
if existing_path and isinstance(existing_path, list):
kselftest_node['path'] = existing_path.append(kselftest_node['name'])
kselftest_node['parent'] = self._node['id']
kselftest_node['data'] = results['node']['data'].copy()
kselftest_node['artifacts'] = None
kselftest_node['state'] = 'done'
kselftest_node['result'] = kselftest_result

child_nodes = [
{
'node': kselftest_node,
'child_nodes': []
}
]
else:
child_nodes = []

results['child_nodes'] = child_nodes
api_helper = kernelci.api.helper.APIHelper(api)
Expand Down

0 comments on commit 535d19f

Please sign in to comment.