mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 02:34:01 +08:00
linux-kselftest-kunit-5.6-rc4
This Kselftest kunit update consists of fixes to documentation and run-time tool from Brendan Higgins and Heidi Fahim. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAl5VuwUACgkQCwJExA0N QxwJiw/+OgVUhIVw4GNvuyDfRruZBR77h41brG3yIlkiJeswxrJBvv6mgQWP69nu 3V2MO7DrJ/Y4LINZ4ElGyiSMpoY+Tpex7GBX0WZy31FVrmOAd4AhZ/fHZar1k4ye 7rnts9Py6PwIYVxO3hcuDAfpIhEa98qKTKhVrLfHxR2CxbcvKDXIWfvz1gcp5M3y n4D3KVXwmb6yy7q85l8VjwxXevdaFp/bGmRW5HwzpMPJkrtBJWQrFJBGxeX1LVTY IcNKGu61Efd2KP6K9WF6EyS/seD+GbyuFOMq9xOG3WM6f65EILq6K6A24EGZtUxV IpJySFvewf+in8lzQql6F0flCvThYXkf2Dofi3yoQAda0XrwcL+Z/rugeLMQoEHN bYgCKzwW/otwLpJHlWJLPxEnWfuY7A1025xG7Ly+k7qBVsKy2aMZk70gP9uPr6hh lCp+zRRrnMAwFgKNSD6hVC+yblw0ACXv0UmL+ccUtX5KtSa+yYJ3JFZhOFzhhHug vwXCF5eLYdGuBVNWAO39kyLyV02nUwXiNaoVW5NF9fNpq6HdA6XWcofcV70AM6WZ l3s2MDBq7hc7edYknnTHCgaFlHqIlWkFAm828HtJXBV3IpHAagPRFWUVWnkfPlU9 FCQXfnbkteB2ZUlHQwjUGBZzh07ZV0iafzNZcYzgyFCjDlVeHDw= =Q7Zl -----END PGP SIGNATURE----- Merge tag 'linux-kselftest-kunit-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest Pull Kunit fixes from Shuah Khan: "This Kselftest kunit update consists of fixes to documentation and the run-time tool from Brendan Higgins and Heidi Fahim" * tag 'linux-kselftest-kunit-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: kunit: run kunit_tool from any directory kunit: test: Improve error messages for kunit_tool when kunitconfig is invalid Documentation: kunit: fixed sphinx error in code block
This commit is contained in:
commit
b98cce1ef5
@ -551,6 +551,7 @@ options to your ``.config``:
|
||||
Once the kernel is built and installed, a simple
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
modprobe example-test
|
||||
|
||||
...will run the tests.
|
||||
|
@ -24,6 +24,8 @@ KunitResult = namedtuple('KunitResult', ['status','result'])
|
||||
|
||||
KunitRequest = namedtuple('KunitRequest', ['raw_output','timeout', 'jobs', 'build_dir', 'defconfig'])
|
||||
|
||||
KernelDirectoryPath = sys.argv[0].split('tools/testing/kunit/')[0]
|
||||
|
||||
class KunitStatus(Enum):
|
||||
SUCCESS = auto()
|
||||
CONFIG_FAILURE = auto()
|
||||
@ -35,6 +37,13 @@ def create_default_kunitconfig():
|
||||
shutil.copyfile('arch/um/configs/kunit_defconfig',
|
||||
kunit_kernel.kunitconfig_path)
|
||||
|
||||
def get_kernel_root_path():
|
||||
parts = sys.argv[0] if not __file__ else __file__
|
||||
parts = os.path.realpath(parts).split('tools/testing/kunit')
|
||||
if len(parts) != 2:
|
||||
sys.exit(1)
|
||||
return parts[0]
|
||||
|
||||
def run_tests(linux: kunit_kernel.LinuxSourceTree,
|
||||
request: KunitRequest) -> KunitResult:
|
||||
config_start = time.time()
|
||||
@ -114,6 +123,9 @@ def main(argv, linux=None):
|
||||
cli_args = parser.parse_args(argv)
|
||||
|
||||
if cli_args.subcommand == 'run':
|
||||
if get_kernel_root_path():
|
||||
os.chdir(get_kernel_root_path())
|
||||
|
||||
if cli_args.build_dir:
|
||||
if not os.path.exists(cli_args.build_dir):
|
||||
os.mkdir(cli_args.build_dir)
|
||||
|
@ -93,6 +93,20 @@ class LinuxSourceTree(object):
|
||||
return False
|
||||
return True
|
||||
|
||||
def validate_config(self, build_dir):
|
||||
kconfig_path = get_kconfig_path(build_dir)
|
||||
validated_kconfig = kunit_config.Kconfig()
|
||||
validated_kconfig.read_from_file(kconfig_path)
|
||||
if not self._kconfig.is_subset_of(validated_kconfig):
|
||||
invalid = self._kconfig.entries() - validated_kconfig.entries()
|
||||
message = 'Provided Kconfig is not contained in validated .config. Following fields found in kunitconfig, ' \
|
||||
'but not in .config: %s' % (
|
||||
', '.join([str(e) for e in invalid])
|
||||
)
|
||||
logging.error(message)
|
||||
return False
|
||||
return True
|
||||
|
||||
def build_config(self, build_dir):
|
||||
kconfig_path = get_kconfig_path(build_dir)
|
||||
if build_dir and not os.path.exists(build_dir):
|
||||
@ -103,12 +117,7 @@ class LinuxSourceTree(object):
|
||||
except ConfigError as e:
|
||||
logging.error(e)
|
||||
return False
|
||||
validated_kconfig = kunit_config.Kconfig()
|
||||
validated_kconfig.read_from_file(kconfig_path)
|
||||
if not self._kconfig.is_subset_of(validated_kconfig):
|
||||
logging.error('Provided Kconfig is not contained in validated .config!')
|
||||
return False
|
||||
return True
|
||||
return self.validate_config(build_dir)
|
||||
|
||||
def build_reconfig(self, build_dir):
|
||||
"""Creates a new .config if it is not a subset of the .kunitconfig."""
|
||||
@ -133,12 +142,7 @@ class LinuxSourceTree(object):
|
||||
except (ConfigError, BuildError) as e:
|
||||
logging.error(e)
|
||||
return False
|
||||
used_kconfig = kunit_config.Kconfig()
|
||||
used_kconfig.read_from_file(get_kconfig_path(build_dir))
|
||||
if not self._kconfig.is_subset_of(used_kconfig):
|
||||
logging.error('Provided Kconfig is not contained in final config!')
|
||||
return False
|
||||
return True
|
||||
return self.validate_config(build_dir)
|
||||
|
||||
def run_kernel(self, args=[], timeout=None, build_dir=''):
|
||||
args.extend(['mem=256M'])
|
||||
|
Loading…
Reference in New Issue
Block a user