]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
kunit: tool: Build GDB scripts
authorBrendan Jackman <jackmanb@google.com>
Tue, 21 Jan 2025 13:01:40 +0000 (13:01 +0000)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 18 Feb 2025 21:28:01 +0000 (14:28 -0700)
Following a similar rationale as commit e4835f1da425f ("kunit: tool:
Build compile_commands.json"), make a common developer tool available by
default for KUnit users.

Compared to compile_commands.json, there is a little more work to be
done to build the GDB scripts. Is it enough to affect development cycle
duration? Unscientific evaluation:

rm -rf .kunit; time tools/testing/kunit/kunit.py build --kunitconfig ./lib/kunit/.kunitconfig --jobs 96

Without this patch it took 14.77s, with this patch it took 14.83. So,
although `make scripts_gdb` is pretty slow, presumably most of that is
just the overhead of running Kbuild at all, actually building the
scripts is approximately free.

Note also, to actually get the GDB scripts the user needs to enable
CONFIG_SCRIPTS_GDB, but building the scripts_gdb target without that is
still harmless.

Link: https://lore.kernel.org/r/20250121-kunit-gdb-v1-1-faedfd0653ef@google.com
Signed-off-by: Brendan Jackman <jackmanb@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/kunit/kunit_kernel.py

index d30f90eae9a4237e85910fd36f7f1c731d952319..d3f39bc1ceec7eab23925ff1b852e996a715f3d5 100644 (file)
@@ -72,8 +72,8 @@ class LinuxSourceTreeOperations:
                        raise ConfigError(e.output.decode())
 
        def make(self, jobs: int, build_dir: str, make_options: Optional[List[str]]) -> None:
-               command = ['make', 'all', 'compile_commands.json', 'ARCH=' + self._linux_arch,
-                          'O=' + build_dir, '--jobs=' + str(jobs)]
+               command = ['make', 'all', 'compile_commands.json', 'scripts_gdb',
+                          'ARCH=' + self._linux_arch, 'O=' + build_dir, '--jobs=' + str(jobs)]
                if make_options:
                        command.extend(make_options)
                if self._cross_compile: