linux_kselftest-kunit-6.14-rc1
- fixes struct completion warning - introduces autorun option - adds fallback for os.sched_getaffinity - enables hardware acceleration when available -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAmeQDEwACgkQCwJExA0N QxzsahAAod2fq5NoQ+SY/x5oc5v0k8tV8pbrdcJBMDx5iKAf/B+EBmqsKHs5VuBi /fUkSQiTndFjXTxZbS1zTRN4XfO5H6AUVmazfHAGhIL4QEsyOocGXIEHwlhHYmLP YwOA2UTS7FilIZA0Z9slKiKnxCZga7pp6Et11rwnydDro2XvPhsnsi9FHchjYmXx lQyaO17RHf5z+LfNAH3j8wsYU910z/Vg5AE1kZ7ckcftFgPXpiK2P2XtDTAKZz4D p7qW6kntUQ9994HbhCa+fw5YIFdSy8fL9QG9uBdWb0x03dQzNkW8mOs8I6DWr4Kw cVp06829K/fpwy3P15mVFjv8cO7W8t74LBGq/EipjQ8eA2RhfkZdwNE/awH9GBDS kjjlNfIh+U4wY6++SAF58k1bZorVgpZfRtpl1anfftEOlex+JPKXaJpoZloMZ/P9 Jh8BtZ+yc16tDkNQlqT24CeSGiC4GvtqUBytXvwGjEdUFzIS+bXGPwHpKrVlHWVV lpntJiUEqIbgZ+XS4UxDHBqXbYKRv7sUlToMJNkMEO5Hz5ok57NjxuPmbfS+LJdk uc6gEH3aAlyI52uJZqotcRmmea52S1HZSUO9E80yl/cS5PHysTlivTXCm85PI7GV a6T43DgnpBqqWPHafnm93DSvlx/wl1LU2JsRYeXp59CkXonlNUk= =caDL -----END PGP SIGNATURE----- Merge tag 'linux_kselftest-kunit-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest Pull kunit updates from Shuah Khan: - fix struct completion warning - introduce autorun option - add fallback for os.sched_getaffinity - enable hardware acceleration when available * tag 'linux_kselftest-kunit-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: kunit: Introduce autorun option kunit: enable hardware acceleration when available kunit: add fallback for os.sched_getaffinity kunit: platform: Resolve 'struct completion' warning
This commit is contained in:
commit
e8f17cb6f5
9 changed files with 54 additions and 8 deletions
|
@ -2,6 +2,7 @@
|
|||
#ifndef _KUNIT_PLATFORM_DRIVER_H
|
||||
#define _KUNIT_PLATFORM_DRIVER_H
|
||||
|
||||
struct completion;
|
||||
struct kunit;
|
||||
struct platform_device;
|
||||
struct platform_driver;
|
||||
|
|
|
@ -312,6 +312,7 @@ static inline void kunit_set_failure(struct kunit *test)
|
|||
}
|
||||
|
||||
bool kunit_enabled(void);
|
||||
bool kunit_autorun(void);
|
||||
const char *kunit_action(void);
|
||||
const char *kunit_filter_glob(void);
|
||||
char *kunit_filter(void);
|
||||
|
@ -334,7 +335,8 @@ kunit_filter_suites(const struct kunit_suite_set *suite_set,
|
|||
int *err);
|
||||
void kunit_free_suite_set(struct kunit_suite_set suite_set);
|
||||
|
||||
int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_suites);
|
||||
int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_suites,
|
||||
bool run_tests);
|
||||
|
||||
void __kunit_test_suites_exit(struct kunit_suite **suites, int num_suites);
|
||||
|
||||
|
|
|
@ -81,4 +81,16 @@ config KUNIT_DEFAULT_ENABLED
|
|||
In most cases this should be left as Y. Only if additional opt-in
|
||||
behavior is needed should this be set to N.
|
||||
|
||||
config KUNIT_AUTORUN_ENABLED
|
||||
bool "Default value of kunit.autorun"
|
||||
default y
|
||||
help
|
||||
Sets the default value of kunit.autorun. If set to N then KUnit
|
||||
tests will not run after initialization unless kunit.autorun=1 is
|
||||
passed to the kernel command line. The test can still be run manually
|
||||
via debugfs interface.
|
||||
|
||||
In most cases this should be left as Y. Only if additional opt-in
|
||||
behavior is needed should this be set to N.
|
||||
|
||||
endif # KUNIT
|
||||
|
|
|
@ -145,7 +145,7 @@ static ssize_t debugfs_run(struct file *file,
|
|||
struct inode *f_inode = file->f_inode;
|
||||
struct kunit_suite *suite = (struct kunit_suite *) f_inode->i_private;
|
||||
|
||||
__kunit_test_suites_init(&suite, 1);
|
||||
__kunit_test_suites_init(&suite, 1, true);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,22 @@ const char *kunit_action(void)
|
|||
return action_param;
|
||||
}
|
||||
|
||||
/*
|
||||
* Run KUnit tests after initialization
|
||||
*/
|
||||
#ifdef CONFIG_KUNIT_AUTORUN_ENABLED
|
||||
static bool autorun_param = true;
|
||||
#else
|
||||
static bool autorun_param;
|
||||
#endif
|
||||
module_param_named(autorun, autorun_param, bool, 0);
|
||||
MODULE_PARM_DESC(autorun, "Run KUnit tests after initialization");
|
||||
|
||||
bool kunit_autorun(void)
|
||||
{
|
||||
return autorun_param;
|
||||
}
|
||||
|
||||
static char *filter_glob_param;
|
||||
static char *filter_param;
|
||||
static char *filter_action_param;
|
||||
|
@ -260,13 +276,14 @@ free_copy:
|
|||
void kunit_exec_run_tests(struct kunit_suite_set *suite_set, bool builtin)
|
||||
{
|
||||
size_t num_suites = suite_set->end - suite_set->start;
|
||||
bool autorun = kunit_autorun();
|
||||
|
||||
if (builtin || num_suites) {
|
||||
if (autorun && (builtin || num_suites)) {
|
||||
pr_info("KTAP version 1\n");
|
||||
pr_info("1..%zu\n", num_suites);
|
||||
}
|
||||
|
||||
__kunit_test_suites_init(suite_set->start, num_suites);
|
||||
__kunit_test_suites_init(suite_set->start, num_suites, autorun);
|
||||
}
|
||||
|
||||
void kunit_exec_list_tests(struct kunit_suite_set *suite_set, bool include_attr)
|
||||
|
|
|
@ -708,7 +708,8 @@ bool kunit_enabled(void)
|
|||
return enable_param;
|
||||
}
|
||||
|
||||
int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_suites)
|
||||
int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_suites,
|
||||
bool run_tests)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
@ -731,7 +732,8 @@ int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_
|
|||
|
||||
for (i = 0; i < num_suites; i++) {
|
||||
kunit_init_suite(suites[i]);
|
||||
kunit_run_tests(suites[i]);
|
||||
if (run_tests)
|
||||
kunit_run_tests(suites[i]);
|
||||
}
|
||||
|
||||
static_branch_dec(&kunit_running);
|
||||
|
|
|
@ -312,7 +312,16 @@ def massage_argv(argv: Sequence[str]) -> Sequence[str]:
|
|||
return list(map(massage_arg, argv))
|
||||
|
||||
def get_default_jobs() -> int:
|
||||
return len(os.sched_getaffinity(0))
|
||||
if sys.version_info >= (3, 13):
|
||||
if (ncpu := os.process_cpu_count()) is not None:
|
||||
return ncpu
|
||||
raise RuntimeError("os.process_cpu_count() returned None")
|
||||
# See https://github.com/python/cpython/blob/b61fece/Lib/os.py#L1175-L1186.
|
||||
if sys.platform != "darwin":
|
||||
return len(os.sched_getaffinity(0))
|
||||
if (ncpu := os.cpu_count()) is not None:
|
||||
return ncpu
|
||||
raise RuntimeError("os.cpu_count() returned None")
|
||||
|
||||
def add_common_opts(parser: argparse.ArgumentParser) -> None:
|
||||
parser.add_argument('--build_dir',
|
||||
|
|
|
@ -125,6 +125,9 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations):
|
|||
'-append', ' '.join(params + [self._kernel_command_line]),
|
||||
'-no-reboot',
|
||||
'-nographic',
|
||||
'-accel', 'kvm',
|
||||
'-accel', 'hvf',
|
||||
'-accel', 'tcg',
|
||||
'-serial', self._serial] + self._extra_qemu_params
|
||||
# Note: shlex.join() does what we want, but requires python 3.8+.
|
||||
print('Running tests with:\n$', ' '.join(shlex.quote(arg) for arg in qemu_command))
|
||||
|
|
|
@ -9,4 +9,4 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y''',
|
|||
qemu_arch='aarch64',
|
||||
kernel_path='arch/arm64/boot/Image.gz',
|
||||
kernel_command_line='console=ttyAMA0',
|
||||
extra_qemu_params=['-machine', 'virt', '-cpu', 'max,pauth-impdef=on'])
|
||||
extra_qemu_params=['-machine', 'virt', '-cpu', 'max'])
|
||||
|
|
Loading…
Add table
Reference in a new issue