How is the Linux kernel tested ?
How do the Linux kernel developers test their code locally and after they have it committed? Do they use some kind of unit testing, build automation? test plans?
linux linux-kernel
|
show 2 more comments
How do the Linux kernel developers test their code locally and after they have it committed? Do they use some kind of unit testing, build automation? test plans?
linux linux-kernel
15
youtube.com/watch?v=L2SED6sewRw , somewhere, I cant remember exactly, but I think in the QA section this is being talked about.
– Anders
Jul 21 '10 at 15:03
6
Anders' link is great - a Google Tech Talk by one of the top kernel developers, Greg Kroah Hartman. He validates the answer given below by kernel developer @adobriyan. Greg notes the fun thing about the kernel - no good way to test without running it - hard to do unit tests etc - many permutations. "We rely on the development community to test. We want as many functional tests as we can get, and performance tests also." A link straight to the testing discussion is youtube.com/…
– nealmcb
Feb 27 '12 at 3:40
With the popularity of VMs, wouldn't it be possible to automate this by building the kernel with a bunch of config permutations and trying to boot up on them? It wouldn't be a "unit" test by any means, but it could catch bugs.
– Daniel Kaplan
Aug 27 '14 at 0:16
@DanielKaplan: If you assume there's about 1000 motherboards that each has one of 10 CPUs, plus 3 of 1000 PCI devices, plus 3 of 1000 USB devices; and that the kernel has 1000 different possibly compile time options; then you're looking at about 1000*10*1000*999*9981000*999*998*1000 possible permutations to test. If you do a nice 8-hour burn in test for each permutation and have a pool of 100 servers to run 400 VMs in parallel at the same time; then by the time you've got 1 millionth of it tested the results will all be obsolete because someone changed the code and you have to start again.
– Brendan
Jun 18 '15 at 17:39
There is a little discussion about unit tests on ycombinator.
– joeytwiddle
Apr 12 '16 at 2:48
|
show 2 more comments
How do the Linux kernel developers test their code locally and after they have it committed? Do they use some kind of unit testing, build automation? test plans?
linux linux-kernel
How do the Linux kernel developers test their code locally and after they have it committed? Do they use some kind of unit testing, build automation? test plans?
linux linux-kernel
linux linux-kernel
edited May 24 '16 at 5:08
Ezequiel Garcia
736418
736418
asked Jul 5 '10 at 5:15
اشکان نظریاشکان نظری
8,099123155
8,099123155
15
youtube.com/watch?v=L2SED6sewRw , somewhere, I cant remember exactly, but I think in the QA section this is being talked about.
– Anders
Jul 21 '10 at 15:03
6
Anders' link is great - a Google Tech Talk by one of the top kernel developers, Greg Kroah Hartman. He validates the answer given below by kernel developer @adobriyan. Greg notes the fun thing about the kernel - no good way to test without running it - hard to do unit tests etc - many permutations. "We rely on the development community to test. We want as many functional tests as we can get, and performance tests also." A link straight to the testing discussion is youtube.com/…
– nealmcb
Feb 27 '12 at 3:40
With the popularity of VMs, wouldn't it be possible to automate this by building the kernel with a bunch of config permutations and trying to boot up on them? It wouldn't be a "unit" test by any means, but it could catch bugs.
– Daniel Kaplan
Aug 27 '14 at 0:16
@DanielKaplan: If you assume there's about 1000 motherboards that each has one of 10 CPUs, plus 3 of 1000 PCI devices, plus 3 of 1000 USB devices; and that the kernel has 1000 different possibly compile time options; then you're looking at about 1000*10*1000*999*9981000*999*998*1000 possible permutations to test. If you do a nice 8-hour burn in test for each permutation and have a pool of 100 servers to run 400 VMs in parallel at the same time; then by the time you've got 1 millionth of it tested the results will all be obsolete because someone changed the code and you have to start again.
– Brendan
Jun 18 '15 at 17:39
There is a little discussion about unit tests on ycombinator.
– joeytwiddle
Apr 12 '16 at 2:48
|
show 2 more comments
15
youtube.com/watch?v=L2SED6sewRw , somewhere, I cant remember exactly, but I think in the QA section this is being talked about.
– Anders
Jul 21 '10 at 15:03
6
Anders' link is great - a Google Tech Talk by one of the top kernel developers, Greg Kroah Hartman. He validates the answer given below by kernel developer @adobriyan. Greg notes the fun thing about the kernel - no good way to test without running it - hard to do unit tests etc - many permutations. "We rely on the development community to test. We want as many functional tests as we can get, and performance tests also." A link straight to the testing discussion is youtube.com/…
– nealmcb
Feb 27 '12 at 3:40
With the popularity of VMs, wouldn't it be possible to automate this by building the kernel with a bunch of config permutations and trying to boot up on them? It wouldn't be a "unit" test by any means, but it could catch bugs.
– Daniel Kaplan
Aug 27 '14 at 0:16
@DanielKaplan: If you assume there's about 1000 motherboards that each has one of 10 CPUs, plus 3 of 1000 PCI devices, plus 3 of 1000 USB devices; and that the kernel has 1000 different possibly compile time options; then you're looking at about 1000*10*1000*999*9981000*999*998*1000 possible permutations to test. If you do a nice 8-hour burn in test for each permutation and have a pool of 100 servers to run 400 VMs in parallel at the same time; then by the time you've got 1 millionth of it tested the results will all be obsolete because someone changed the code and you have to start again.
– Brendan
Jun 18 '15 at 17:39
There is a little discussion about unit tests on ycombinator.
– joeytwiddle
Apr 12 '16 at 2:48
15
15
youtube.com/watch?v=L2SED6sewRw , somewhere, I cant remember exactly, but I think in the QA section this is being talked about.
– Anders
Jul 21 '10 at 15:03
youtube.com/watch?v=L2SED6sewRw , somewhere, I cant remember exactly, but I think in the QA section this is being talked about.
– Anders
Jul 21 '10 at 15:03
6
6
Anders' link is great - a Google Tech Talk by one of the top kernel developers, Greg Kroah Hartman. He validates the answer given below by kernel developer @adobriyan. Greg notes the fun thing about the kernel - no good way to test without running it - hard to do unit tests etc - many permutations. "We rely on the development community to test. We want as many functional tests as we can get, and performance tests also." A link straight to the testing discussion is youtube.com/…
– nealmcb
Feb 27 '12 at 3:40
Anders' link is great - a Google Tech Talk by one of the top kernel developers, Greg Kroah Hartman. He validates the answer given below by kernel developer @adobriyan. Greg notes the fun thing about the kernel - no good way to test without running it - hard to do unit tests etc - many permutations. "We rely on the development community to test. We want as many functional tests as we can get, and performance tests also." A link straight to the testing discussion is youtube.com/…
– nealmcb
Feb 27 '12 at 3:40
With the popularity of VMs, wouldn't it be possible to automate this by building the kernel with a bunch of config permutations and trying to boot up on them? It wouldn't be a "unit" test by any means, but it could catch bugs.
– Daniel Kaplan
Aug 27 '14 at 0:16
With the popularity of VMs, wouldn't it be possible to automate this by building the kernel with a bunch of config permutations and trying to boot up on them? It wouldn't be a "unit" test by any means, but it could catch bugs.
– Daniel Kaplan
Aug 27 '14 at 0:16
@DanielKaplan: If you assume there's about 1000 motherboards that each has one of 10 CPUs, plus 3 of 1000 PCI devices, plus 3 of 1000 USB devices; and that the kernel has 1000 different possibly compile time options; then you're looking at about 1000*10*1000*999*9981000*999*998*1000 possible permutations to test. If you do a nice 8-hour burn in test for each permutation and have a pool of 100 servers to run 400 VMs in parallel at the same time; then by the time you've got 1 millionth of it tested the results will all be obsolete because someone changed the code and you have to start again.
– Brendan
Jun 18 '15 at 17:39
@DanielKaplan: If you assume there's about 1000 motherboards that each has one of 10 CPUs, plus 3 of 1000 PCI devices, plus 3 of 1000 USB devices; and that the kernel has 1000 different possibly compile time options; then you're looking at about 1000*10*1000*999*9981000*999*998*1000 possible permutations to test. If you do a nice 8-hour burn in test for each permutation and have a pool of 100 servers to run 400 VMs in parallel at the same time; then by the time you've got 1 millionth of it tested the results will all be obsolete because someone changed the code and you have to start again.
– Brendan
Jun 18 '15 at 17:39
There is a little discussion about unit tests on ycombinator.
– joeytwiddle
Apr 12 '16 at 2:48
There is a little discussion about unit tests on ycombinator.
– joeytwiddle
Apr 12 '16 at 2:48
|
show 2 more comments
12 Answers
12
active
oldest
votes
The linux kernel has a heavy emphasis on community testing.
Typically any developer will test their own code before submitting, and quite often they will be using a development version of the kernel from Linus, or one of the other unstable/development trees for a project relevant to their work. This means they are often testing both their changes and other people's changes.
There tend not to be much in the way of formal test plans, but extra testing may be asked for before features are merged into upstream trees.
As Dean pointed out, there's also some automated testing, the linux test project and the kernel autotest (good overview).
Developers will often also write automated tests targetted to test their change, but I'm not sure there's a (often used) mechanism to centrally collect these adhoc tests.
It depends a lot on which area of the kernel is being changed of course - the testing you'd do for a new network driver is quite different to the testing you'd do when replacing the core scheduling algorithm.
8
+1, half the battle is simply not breaking something that drivers depend on, hence the persistence of the BKL over the years. The other thing to consider is testing many sub systems on many different architectures, which is only practically feasible with the kind of community abuse, err testing, that Linux receives.
– Tim Post♦
Jul 5 '10 at 15:52
There is 0day project as well nowadays. lwn.net/Articles/514278
– 0andriy
Jul 27 '15 at 17:44
add a comment |
Naturally, the kernel itself and its parts are tested prior to the release, but these tests cover only the basic functionality. There are some testing systems which perform testing of Linux Kernel:
The Linux Test Project (LTP) delivers test suites to the open source community that validate the reliability and stability of Linux. The LTP test suite contains a collection of tools for testing the Linux kernel and related features. https://github.com/linux-test-project/ltp
Autotest -- a framework for fully automated testing. It is designed primarily to test the Linux kernel, though it is useful for many other purposes such as qualifying new hardware, virtualization testing, and other general user space program testing under Linux platforms. It's an open-source project under the GPL and is used and developed by a number of organizations, including Google, IBM, Red Hat, and many others. http://autotest.github.io/
Also there are certification systems developed by some major GNU/Linux distribution companies. These systems usually check complete GNU/Linux distributions for compatibility with hardware. There are certification systems developed by Novell, Red Hat, Oracle, Canonical, Google.
There are also systems for dynamic analysis of Linux kernel:
Kmemleak is a memory leak detector included in the Linux kernel. It provides a way of detecting possible kernel memory leaks in a way similar to a tracing garbage collector with the difference that the orphan objects are not freed but only reported via /sys/kernel/debug/kmemleak.
Kmemcheck traps every read and write to memory that was allocated dynamically (i.e. with kmalloc()). If a memory address is read that has not previously been written to, a message is printed to the kernel log. Also is a part of Linux Kernel
Fault Injection Framework (included in Linux kernel) allows for infusing errors and exceptions into an application's logic to achieve a higher coverage and fault tolerance of the system.
add a comment |
How do the Linux kernel developers test their code locally and after they have it committed?
Do they use some kind of unit testing, build automation?
In classic sense of words, no.
E. g. Ingo Molnar is running the following workload:
1. build new kernel with random set of config options
2. boot into it
3. goto 1
Every build fail, boot fail, BUG or runtime warning is dealt with. 24/7.
Multiply by several boxes, and one can uncover quite a lot of problems.
test plans?
No.
There may be misunderstanding that there is central testing facility, there is none.
Everyone does what he wants.
6
Given the existence of sites such as this and this I also would question the validity of this answer.
– Dean Harding
Jul 5 '10 at 7:12
3
I think the core of adobriyan's answer "there is central testing facility, there is none." is about right. However different groups do varying levels of testing, it's not as though the kernel is completely untested.
– stsquad
Jul 5 '10 at 11:08
2
I think both SUSE and RedHat in addition to testing their own kernels, test vanilla often. There is no central testing per se, but there is a testing going on nevertheless - by the major users of Linux. Otherwise the comment stands. Were it written less sarcastically I would have even modded it up.
– Dummy00001
Jul 5 '10 at 23:09
51
Errr, do you all people realize that Alexey Dobriyan is a Linux kernel developer?
– ninjalj
Aug 1 '10 at 20:40
5
As another kernel developer, I must say this is the most honest answer to the question: the kernel is NOT tested in the classic sense, simply because it's impossible. There are more combinations of configuration and hardware than available developer time to test. Very few people has the required skills to test certain devices, and in some cases very few people actually own certain devices.
– Ezequiel Garcia
May 24 '16 at 4:47
|
show 3 more comments
Its not very easy to automate kernel testing. Most Linux developers do the testing on their own, much like adobriyan mentioned.
However, there are a few things that help with debugging the Linux Kernel:
kexec: A system call that allows you to put another kernel into memory and reboot without going back to the BIOS, and if it fails, reboot back.
dmesg: Definitely the place to look for information about what happened during the kernel boot and whether it works/doesn't work.
Kernel Instrumentation: In addition to printk's (and an option called 'CONFIG_PRINTK_TIME' which allows you to see (to microsecond accuracy) when the kernel output what), the kernel configuration allows you to turn on a LOT of tracers that enable them to debug what is happening.
Then, developers usually have others review their patches. Once the patches are reviewed locally and seen not to interfere with anything else, and the patches are tested to work with the latest kernel from Linus without breaking anything, the patches are pushed upstream.
Edit: Here's a nice video detailing the process a patch goes through before it is integrated into the kernel.
add a comment |
In-tree tools
A good way to find test tools in the kernel is to:
make helpand read all targets- look under tools/testing
In v4.0, this leads me to:
kselftest under tools/testing/selftests. Run with
make kselftest. Must be running built kernel already. See also: Documentation/kselftest.txt , https://kselftest.wiki.kernel.org/ktest under tools/testing/ktest. See also: http://elinux.org/Ktest , http://www.slideshare.net/satorutakeuchi18/kernel-auto-testbyktest
Static analysers section of
make help, which contains targets like:
checkstack: Perl: what does checkstack.pl in linux source do?
coccicheckfor Coccinelle (mentioned by askb)
Kernel CI
https://kernelci.org/ is a project that aims to make kernel testing more automated and visible.
It appears to do only build and boot tests (TODO how to test automatically that boot worked Source should be at https://github.com/kernelci/).
Linaro seems to be the main maintainer of the project, with contributions from many big companies: https://kernelci.org/sponsors/
Linaro Lava
http://www.linaro.org/initiatives/lava/ looks like a CI system with focus on development board bringup and the Linux kernel.
ARM LISA
https://github.com/ARM-software/lisa
Not sure what it does in detail, but it is by ARM and Apache Licensed, so likely worth a look.
Demo: https://www.youtube.com/watch?v=yXZzzUEngiU
Step debuggers
Not really unit testing, but may help once your tests start failing:
- QEMU + GDB: https://stackoverflow.com/a/42316607/895245
- KGDB: https://stackoverflow.com/a/44226360/895245
My own QEMU + Buildroot + Python setup
I also started a setup focused on ease of development, but I ended up adding some simple testing capabilities to it as well: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/8217e5508782827320209644dcbaf9a6b3141724#test-this-repo
I haven't analyzed all the other setups in great detail, and they likely do much more than mine, however I believe that my setup is very easy to get started with quickly because it has a lot of documentation and automation.
add a comment |
In addition to above/below points, which emphasis more on the functionality testing, hardware certification testing and performance testing the Linux kernel.
A lot a testing actually happen through, actually scripts, static code analysis tools, code reviews etc. which is very efficient in catching bugs, which would otherwise break something in the application.
Sparse – An open-source tool designed to find faults in the Linux kernel.
Coccinelle is another program does matching and transformation engine which provides the language SmPL (Semantic Patch Language) for specifying desired matches and transformations in C code.
checkpatch.pl and other scripts - coding style issues can be found in the file Documentation/CodingStyle in the kernel source tree. The important thing to remember when reading it is not that this style is somehow better than any other style, just that it is consistent. this helps developers easily find and fix coding style issues, the script scripts/checkpatch.pl in the kernel source tree has been developed. This script can point out problems easily, and should always be run by a developer on their changes, instead of having a reviewer waste their time by pointing out problems later on.
add a comment |
There also are:
MMTests which is collection of benchmarks and scripts to analyze the results
https://github.com/gormanm/mmtests
Trinity which is Linux system call fuzz tester
http://codemonkey.org.uk/projects/trinity/
Also the LTP pages at the sourceforge are quite outdated and the project has moved to GitHub
https://github.com/linux-test-project/ltp
add a comment |
I would imagine they use virtualization to do quick tests, something like QEMU, VirtualBox or Xen, and some scripts to perform configurations and automated tests.
Automated testing is probably done by trying either many random configurations or a few specific ones (if they are working with a specific issue). Linux has a lot of low-level tools (such as dmesg) to monitor and log debug data from the kernel, so I imagine that is used as well.
You are definitely right. When I did my kernel module development, I heavily depended on VirtualBox + KGDB to LINE-BY-LINE trace the kernel execution. Yes, gdb to see the whole kernel execute line-by-line is really cool. Same with Valerie Aurora, famous kernel developer, eg: youtube.com/watch?v=Tach2CheAc8. Inside the video u can see how she use UserModeLinux virtualization to step through the kernel.
– Peter Teoh
Oct 31 '11 at 5:00
add a comment |
As far as I know, there is an automatically performance regression check tool(named lkp/0 day) running/funding by the Intel, it will test each valid patch sent to the mailing list and check the scores changed from different microbenchmarks such as hackbench, fio, unixbench, netperf, etc, once there is a performance regression/improvement, a corresponding report will be sent directly to the patch author and Cc related maintainers.
add a comment |
LTP and Memtests are generally preferred tools.
add a comment |
adobriyan mentioned Ingo's loop of random config build testing. That is pretty much now covered by the 0-day test bot (aka kbuild test bot). A nice article about the infrastructure is presented here:Kernel Build/boot testing
The idea behind this set-up is to notify the developers ASAP so that they can rectify the errors soon enough. (before the patches make it into Linus' tree in some cases as the kbuild infrastructure also tests against maintainer's subsystem trees)
add a comment |
I had done linux kernel compilation and done some Modifications for android(Marshmallow and Nougat) in which I use linux version 3. I cross-compiled it in linux system, debug the errors manually and then run its boot image file in Android and check if it was going in loop-hole or not. If it runs perfect then it means it is compiled perfectly according to system requirements.
For MotoG kernel Compilation
NOTE:- Linux Kernel will change according to requirements which depend on System Hardware
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3177338%2fhow-is-the-linux-kernel-tested%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
12 Answers
12
active
oldest
votes
12 Answers
12
active
oldest
votes
active
oldest
votes
active
oldest
votes
The linux kernel has a heavy emphasis on community testing.
Typically any developer will test their own code before submitting, and quite often they will be using a development version of the kernel from Linus, or one of the other unstable/development trees for a project relevant to their work. This means they are often testing both their changes and other people's changes.
There tend not to be much in the way of formal test plans, but extra testing may be asked for before features are merged into upstream trees.
As Dean pointed out, there's also some automated testing, the linux test project and the kernel autotest (good overview).
Developers will often also write automated tests targetted to test their change, but I'm not sure there's a (often used) mechanism to centrally collect these adhoc tests.
It depends a lot on which area of the kernel is being changed of course - the testing you'd do for a new network driver is quite different to the testing you'd do when replacing the core scheduling algorithm.
8
+1, half the battle is simply not breaking something that drivers depend on, hence the persistence of the BKL over the years. The other thing to consider is testing many sub systems on many different architectures, which is only practically feasible with the kind of community abuse, err testing, that Linux receives.
– Tim Post♦
Jul 5 '10 at 15:52
There is 0day project as well nowadays. lwn.net/Articles/514278
– 0andriy
Jul 27 '15 at 17:44
add a comment |
The linux kernel has a heavy emphasis on community testing.
Typically any developer will test their own code before submitting, and quite often they will be using a development version of the kernel from Linus, or one of the other unstable/development trees for a project relevant to their work. This means they are often testing both their changes and other people's changes.
There tend not to be much in the way of formal test plans, but extra testing may be asked for before features are merged into upstream trees.
As Dean pointed out, there's also some automated testing, the linux test project and the kernel autotest (good overview).
Developers will often also write automated tests targetted to test their change, but I'm not sure there's a (often used) mechanism to centrally collect these adhoc tests.
It depends a lot on which area of the kernel is being changed of course - the testing you'd do for a new network driver is quite different to the testing you'd do when replacing the core scheduling algorithm.
8
+1, half the battle is simply not breaking something that drivers depend on, hence the persistence of the BKL over the years. The other thing to consider is testing many sub systems on many different architectures, which is only practically feasible with the kind of community abuse, err testing, that Linux receives.
– Tim Post♦
Jul 5 '10 at 15:52
There is 0day project as well nowadays. lwn.net/Articles/514278
– 0andriy
Jul 27 '15 at 17:44
add a comment |
The linux kernel has a heavy emphasis on community testing.
Typically any developer will test their own code before submitting, and quite often they will be using a development version of the kernel from Linus, or one of the other unstable/development trees for a project relevant to their work. This means they are often testing both their changes and other people's changes.
There tend not to be much in the way of formal test plans, but extra testing may be asked for before features are merged into upstream trees.
As Dean pointed out, there's also some automated testing, the linux test project and the kernel autotest (good overview).
Developers will often also write automated tests targetted to test their change, but I'm not sure there's a (often used) mechanism to centrally collect these adhoc tests.
It depends a lot on which area of the kernel is being changed of course - the testing you'd do for a new network driver is quite different to the testing you'd do when replacing the core scheduling algorithm.
The linux kernel has a heavy emphasis on community testing.
Typically any developer will test their own code before submitting, and quite often they will be using a development version of the kernel from Linus, or one of the other unstable/development trees for a project relevant to their work. This means they are often testing both their changes and other people's changes.
There tend not to be much in the way of formal test plans, but extra testing may be asked for before features are merged into upstream trees.
As Dean pointed out, there's also some automated testing, the linux test project and the kernel autotest (good overview).
Developers will often also write automated tests targetted to test their change, but I'm not sure there's a (often used) mechanism to centrally collect these adhoc tests.
It depends a lot on which area of the kernel is being changed of course - the testing you'd do for a new network driver is quite different to the testing you'd do when replacing the core scheduling algorithm.
edited Nov 5 '14 at 11:27
Mendhak
4,68133853
4,68133853
answered Jul 5 '10 at 15:26
JosephHJosephH
31.7k18114137
31.7k18114137
8
+1, half the battle is simply not breaking something that drivers depend on, hence the persistence of the BKL over the years. The other thing to consider is testing many sub systems on many different architectures, which is only practically feasible with the kind of community abuse, err testing, that Linux receives.
– Tim Post♦
Jul 5 '10 at 15:52
There is 0day project as well nowadays. lwn.net/Articles/514278
– 0andriy
Jul 27 '15 at 17:44
add a comment |
8
+1, half the battle is simply not breaking something that drivers depend on, hence the persistence of the BKL over the years. The other thing to consider is testing many sub systems on many different architectures, which is only practically feasible with the kind of community abuse, err testing, that Linux receives.
– Tim Post♦
Jul 5 '10 at 15:52
There is 0day project as well nowadays. lwn.net/Articles/514278
– 0andriy
Jul 27 '15 at 17:44
8
8
+1, half the battle is simply not breaking something that drivers depend on, hence the persistence of the BKL over the years. The other thing to consider is testing many sub systems on many different architectures, which is only practically feasible with the kind of community abuse, err testing, that Linux receives.
– Tim Post♦
Jul 5 '10 at 15:52
+1, half the battle is simply not breaking something that drivers depend on, hence the persistence of the BKL over the years. The other thing to consider is testing many sub systems on many different architectures, which is only practically feasible with the kind of community abuse, err testing, that Linux receives.
– Tim Post♦
Jul 5 '10 at 15:52
There is 0day project as well nowadays. lwn.net/Articles/514278
– 0andriy
Jul 27 '15 at 17:44
There is 0day project as well nowadays. lwn.net/Articles/514278
– 0andriy
Jul 27 '15 at 17:44
add a comment |
Naturally, the kernel itself and its parts are tested prior to the release, but these tests cover only the basic functionality. There are some testing systems which perform testing of Linux Kernel:
The Linux Test Project (LTP) delivers test suites to the open source community that validate the reliability and stability of Linux. The LTP test suite contains a collection of tools for testing the Linux kernel and related features. https://github.com/linux-test-project/ltp
Autotest -- a framework for fully automated testing. It is designed primarily to test the Linux kernel, though it is useful for many other purposes such as qualifying new hardware, virtualization testing, and other general user space program testing under Linux platforms. It's an open-source project under the GPL and is used and developed by a number of organizations, including Google, IBM, Red Hat, and many others. http://autotest.github.io/
Also there are certification systems developed by some major GNU/Linux distribution companies. These systems usually check complete GNU/Linux distributions for compatibility with hardware. There are certification systems developed by Novell, Red Hat, Oracle, Canonical, Google.
There are also systems for dynamic analysis of Linux kernel:
Kmemleak is a memory leak detector included in the Linux kernel. It provides a way of detecting possible kernel memory leaks in a way similar to a tracing garbage collector with the difference that the orphan objects are not freed but only reported via /sys/kernel/debug/kmemleak.
Kmemcheck traps every read and write to memory that was allocated dynamically (i.e. with kmalloc()). If a memory address is read that has not previously been written to, a message is printed to the kernel log. Also is a part of Linux Kernel
Fault Injection Framework (included in Linux kernel) allows for infusing errors and exceptions into an application's logic to achieve a higher coverage and fault tolerance of the system.
add a comment |
Naturally, the kernel itself and its parts are tested prior to the release, but these tests cover only the basic functionality. There are some testing systems which perform testing of Linux Kernel:
The Linux Test Project (LTP) delivers test suites to the open source community that validate the reliability and stability of Linux. The LTP test suite contains a collection of tools for testing the Linux kernel and related features. https://github.com/linux-test-project/ltp
Autotest -- a framework for fully automated testing. It is designed primarily to test the Linux kernel, though it is useful for many other purposes such as qualifying new hardware, virtualization testing, and other general user space program testing under Linux platforms. It's an open-source project under the GPL and is used and developed by a number of organizations, including Google, IBM, Red Hat, and many others. http://autotest.github.io/
Also there are certification systems developed by some major GNU/Linux distribution companies. These systems usually check complete GNU/Linux distributions for compatibility with hardware. There are certification systems developed by Novell, Red Hat, Oracle, Canonical, Google.
There are also systems for dynamic analysis of Linux kernel:
Kmemleak is a memory leak detector included in the Linux kernel. It provides a way of detecting possible kernel memory leaks in a way similar to a tracing garbage collector with the difference that the orphan objects are not freed but only reported via /sys/kernel/debug/kmemleak.
Kmemcheck traps every read and write to memory that was allocated dynamically (i.e. with kmalloc()). If a memory address is read that has not previously been written to, a message is printed to the kernel log. Also is a part of Linux Kernel
Fault Injection Framework (included in Linux kernel) allows for infusing errors and exceptions into an application's logic to achieve a higher coverage and fault tolerance of the system.
add a comment |
Naturally, the kernel itself and its parts are tested prior to the release, but these tests cover only the basic functionality. There are some testing systems which perform testing of Linux Kernel:
The Linux Test Project (LTP) delivers test suites to the open source community that validate the reliability and stability of Linux. The LTP test suite contains a collection of tools for testing the Linux kernel and related features. https://github.com/linux-test-project/ltp
Autotest -- a framework for fully automated testing. It is designed primarily to test the Linux kernel, though it is useful for many other purposes such as qualifying new hardware, virtualization testing, and other general user space program testing under Linux platforms. It's an open-source project under the GPL and is used and developed by a number of organizations, including Google, IBM, Red Hat, and many others. http://autotest.github.io/
Also there are certification systems developed by some major GNU/Linux distribution companies. These systems usually check complete GNU/Linux distributions for compatibility with hardware. There are certification systems developed by Novell, Red Hat, Oracle, Canonical, Google.
There are also systems for dynamic analysis of Linux kernel:
Kmemleak is a memory leak detector included in the Linux kernel. It provides a way of detecting possible kernel memory leaks in a way similar to a tracing garbage collector with the difference that the orphan objects are not freed but only reported via /sys/kernel/debug/kmemleak.
Kmemcheck traps every read and write to memory that was allocated dynamically (i.e. with kmalloc()). If a memory address is read that has not previously been written to, a message is printed to the kernel log. Also is a part of Linux Kernel
Fault Injection Framework (included in Linux kernel) allows for infusing errors and exceptions into an application's logic to achieve a higher coverage and fault tolerance of the system.
Naturally, the kernel itself and its parts are tested prior to the release, but these tests cover only the basic functionality. There are some testing systems which perform testing of Linux Kernel:
The Linux Test Project (LTP) delivers test suites to the open source community that validate the reliability and stability of Linux. The LTP test suite contains a collection of tools for testing the Linux kernel and related features. https://github.com/linux-test-project/ltp
Autotest -- a framework for fully automated testing. It is designed primarily to test the Linux kernel, though it is useful for many other purposes such as qualifying new hardware, virtualization testing, and other general user space program testing under Linux platforms. It's an open-source project under the GPL and is used and developed by a number of organizations, including Google, IBM, Red Hat, and many others. http://autotest.github.io/
Also there are certification systems developed by some major GNU/Linux distribution companies. These systems usually check complete GNU/Linux distributions for compatibility with hardware. There are certification systems developed by Novell, Red Hat, Oracle, Canonical, Google.
There are also systems for dynamic analysis of Linux kernel:
Kmemleak is a memory leak detector included in the Linux kernel. It provides a way of detecting possible kernel memory leaks in a way similar to a tracing garbage collector with the difference that the orphan objects are not freed but only reported via /sys/kernel/debug/kmemleak.
Kmemcheck traps every read and write to memory that was allocated dynamically (i.e. with kmalloc()). If a memory address is read that has not previously been written to, a message is printed to the kernel log. Also is a part of Linux Kernel
Fault Injection Framework (included in Linux kernel) allows for infusing errors and exceptions into an application's logic to achieve a higher coverage and fault tolerance of the system.
edited Feb 25 '15 at 19:06
dnozay
18.4k26386
18.4k26386
answered Jun 7 '12 at 12:31
Karen TsirunyanKaren Tsirunyan
1,04631423
1,04631423
add a comment |
add a comment |
How do the Linux kernel developers test their code locally and after they have it committed?
Do they use some kind of unit testing, build automation?
In classic sense of words, no.
E. g. Ingo Molnar is running the following workload:
1. build new kernel with random set of config options
2. boot into it
3. goto 1
Every build fail, boot fail, BUG or runtime warning is dealt with. 24/7.
Multiply by several boxes, and one can uncover quite a lot of problems.
test plans?
No.
There may be misunderstanding that there is central testing facility, there is none.
Everyone does what he wants.
6
Given the existence of sites such as this and this I also would question the validity of this answer.
– Dean Harding
Jul 5 '10 at 7:12
3
I think the core of adobriyan's answer "there is central testing facility, there is none." is about right. However different groups do varying levels of testing, it's not as though the kernel is completely untested.
– stsquad
Jul 5 '10 at 11:08
2
I think both SUSE and RedHat in addition to testing their own kernels, test vanilla often. There is no central testing per se, but there is a testing going on nevertheless - by the major users of Linux. Otherwise the comment stands. Were it written less sarcastically I would have even modded it up.
– Dummy00001
Jul 5 '10 at 23:09
51
Errr, do you all people realize that Alexey Dobriyan is a Linux kernel developer?
– ninjalj
Aug 1 '10 at 20:40
5
As another kernel developer, I must say this is the most honest answer to the question: the kernel is NOT tested in the classic sense, simply because it's impossible. There are more combinations of configuration and hardware than available developer time to test. Very few people has the required skills to test certain devices, and in some cases very few people actually own certain devices.
– Ezequiel Garcia
May 24 '16 at 4:47
|
show 3 more comments
How do the Linux kernel developers test their code locally and after they have it committed?
Do they use some kind of unit testing, build automation?
In classic sense of words, no.
E. g. Ingo Molnar is running the following workload:
1. build new kernel with random set of config options
2. boot into it
3. goto 1
Every build fail, boot fail, BUG or runtime warning is dealt with. 24/7.
Multiply by several boxes, and one can uncover quite a lot of problems.
test plans?
No.
There may be misunderstanding that there is central testing facility, there is none.
Everyone does what he wants.
6
Given the existence of sites such as this and this I also would question the validity of this answer.
– Dean Harding
Jul 5 '10 at 7:12
3
I think the core of adobriyan's answer "there is central testing facility, there is none." is about right. However different groups do varying levels of testing, it's not as though the kernel is completely untested.
– stsquad
Jul 5 '10 at 11:08
2
I think both SUSE and RedHat in addition to testing their own kernels, test vanilla often. There is no central testing per se, but there is a testing going on nevertheless - by the major users of Linux. Otherwise the comment stands. Were it written less sarcastically I would have even modded it up.
– Dummy00001
Jul 5 '10 at 23:09
51
Errr, do you all people realize that Alexey Dobriyan is a Linux kernel developer?
– ninjalj
Aug 1 '10 at 20:40
5
As another kernel developer, I must say this is the most honest answer to the question: the kernel is NOT tested in the classic sense, simply because it's impossible. There are more combinations of configuration and hardware than available developer time to test. Very few people has the required skills to test certain devices, and in some cases very few people actually own certain devices.
– Ezequiel Garcia
May 24 '16 at 4:47
|
show 3 more comments
How do the Linux kernel developers test their code locally and after they have it committed?
Do they use some kind of unit testing, build automation?
In classic sense of words, no.
E. g. Ingo Molnar is running the following workload:
1. build new kernel with random set of config options
2. boot into it
3. goto 1
Every build fail, boot fail, BUG or runtime warning is dealt with. 24/7.
Multiply by several boxes, and one can uncover quite a lot of problems.
test plans?
No.
There may be misunderstanding that there is central testing facility, there is none.
Everyone does what he wants.
How do the Linux kernel developers test their code locally and after they have it committed?
Do they use some kind of unit testing, build automation?
In classic sense of words, no.
E. g. Ingo Molnar is running the following workload:
1. build new kernel with random set of config options
2. boot into it
3. goto 1
Every build fail, boot fail, BUG or runtime warning is dealt with. 24/7.
Multiply by several boxes, and one can uncover quite a lot of problems.
test plans?
No.
There may be misunderstanding that there is central testing facility, there is none.
Everyone does what he wants.
answered Jul 5 '10 at 6:59
adobriyanadobriyan
2,226118
2,226118
6
Given the existence of sites such as this and this I also would question the validity of this answer.
– Dean Harding
Jul 5 '10 at 7:12
3
I think the core of adobriyan's answer "there is central testing facility, there is none." is about right. However different groups do varying levels of testing, it's not as though the kernel is completely untested.
– stsquad
Jul 5 '10 at 11:08
2
I think both SUSE and RedHat in addition to testing their own kernels, test vanilla often. There is no central testing per se, but there is a testing going on nevertheless - by the major users of Linux. Otherwise the comment stands. Were it written less sarcastically I would have even modded it up.
– Dummy00001
Jul 5 '10 at 23:09
51
Errr, do you all people realize that Alexey Dobriyan is a Linux kernel developer?
– ninjalj
Aug 1 '10 at 20:40
5
As another kernel developer, I must say this is the most honest answer to the question: the kernel is NOT tested in the classic sense, simply because it's impossible. There are more combinations of configuration and hardware than available developer time to test. Very few people has the required skills to test certain devices, and in some cases very few people actually own certain devices.
– Ezequiel Garcia
May 24 '16 at 4:47
|
show 3 more comments
6
Given the existence of sites such as this and this I also would question the validity of this answer.
– Dean Harding
Jul 5 '10 at 7:12
3
I think the core of adobriyan's answer "there is central testing facility, there is none." is about right. However different groups do varying levels of testing, it's not as though the kernel is completely untested.
– stsquad
Jul 5 '10 at 11:08
2
I think both SUSE and RedHat in addition to testing their own kernels, test vanilla often. There is no central testing per se, but there is a testing going on nevertheless - by the major users of Linux. Otherwise the comment stands. Were it written less sarcastically I would have even modded it up.
– Dummy00001
Jul 5 '10 at 23:09
51
Errr, do you all people realize that Alexey Dobriyan is a Linux kernel developer?
– ninjalj
Aug 1 '10 at 20:40
5
As another kernel developer, I must say this is the most honest answer to the question: the kernel is NOT tested in the classic sense, simply because it's impossible. There are more combinations of configuration and hardware than available developer time to test. Very few people has the required skills to test certain devices, and in some cases very few people actually own certain devices.
– Ezequiel Garcia
May 24 '16 at 4:47
6
6
Given the existence of sites such as this and this I also would question the validity of this answer.
– Dean Harding
Jul 5 '10 at 7:12
Given the existence of sites such as this and this I also would question the validity of this answer.
– Dean Harding
Jul 5 '10 at 7:12
3
3
I think the core of adobriyan's answer "there is central testing facility, there is none." is about right. However different groups do varying levels of testing, it's not as though the kernel is completely untested.
– stsquad
Jul 5 '10 at 11:08
I think the core of adobriyan's answer "there is central testing facility, there is none." is about right. However different groups do varying levels of testing, it's not as though the kernel is completely untested.
– stsquad
Jul 5 '10 at 11:08
2
2
I think both SUSE and RedHat in addition to testing their own kernels, test vanilla often. There is no central testing per se, but there is a testing going on nevertheless - by the major users of Linux. Otherwise the comment stands. Were it written less sarcastically I would have even modded it up.
– Dummy00001
Jul 5 '10 at 23:09
I think both SUSE and RedHat in addition to testing their own kernels, test vanilla often. There is no central testing per se, but there is a testing going on nevertheless - by the major users of Linux. Otherwise the comment stands. Were it written less sarcastically I would have even modded it up.
– Dummy00001
Jul 5 '10 at 23:09
51
51
Errr, do you all people realize that Alexey Dobriyan is a Linux kernel developer?
– ninjalj
Aug 1 '10 at 20:40
Errr, do you all people realize that Alexey Dobriyan is a Linux kernel developer?
– ninjalj
Aug 1 '10 at 20:40
5
5
As another kernel developer, I must say this is the most honest answer to the question: the kernel is NOT tested in the classic sense, simply because it's impossible. There are more combinations of configuration and hardware than available developer time to test. Very few people has the required skills to test certain devices, and in some cases very few people actually own certain devices.
– Ezequiel Garcia
May 24 '16 at 4:47
As another kernel developer, I must say this is the most honest answer to the question: the kernel is NOT tested in the classic sense, simply because it's impossible. There are more combinations of configuration and hardware than available developer time to test. Very few people has the required skills to test certain devices, and in some cases very few people actually own certain devices.
– Ezequiel Garcia
May 24 '16 at 4:47
|
show 3 more comments
Its not very easy to automate kernel testing. Most Linux developers do the testing on their own, much like adobriyan mentioned.
However, there are a few things that help with debugging the Linux Kernel:
kexec: A system call that allows you to put another kernel into memory and reboot without going back to the BIOS, and if it fails, reboot back.
dmesg: Definitely the place to look for information about what happened during the kernel boot and whether it works/doesn't work.
Kernel Instrumentation: In addition to printk's (and an option called 'CONFIG_PRINTK_TIME' which allows you to see (to microsecond accuracy) when the kernel output what), the kernel configuration allows you to turn on a LOT of tracers that enable them to debug what is happening.
Then, developers usually have others review their patches. Once the patches are reviewed locally and seen not to interfere with anything else, and the patches are tested to work with the latest kernel from Linus without breaking anything, the patches are pushed upstream.
Edit: Here's a nice video detailing the process a patch goes through before it is integrated into the kernel.
add a comment |
Its not very easy to automate kernel testing. Most Linux developers do the testing on their own, much like adobriyan mentioned.
However, there are a few things that help with debugging the Linux Kernel:
kexec: A system call that allows you to put another kernel into memory and reboot without going back to the BIOS, and if it fails, reboot back.
dmesg: Definitely the place to look for information about what happened during the kernel boot and whether it works/doesn't work.
Kernel Instrumentation: In addition to printk's (and an option called 'CONFIG_PRINTK_TIME' which allows you to see (to microsecond accuracy) when the kernel output what), the kernel configuration allows you to turn on a LOT of tracers that enable them to debug what is happening.
Then, developers usually have others review their patches. Once the patches are reviewed locally and seen not to interfere with anything else, and the patches are tested to work with the latest kernel from Linus without breaking anything, the patches are pushed upstream.
Edit: Here's a nice video detailing the process a patch goes through before it is integrated into the kernel.
add a comment |
Its not very easy to automate kernel testing. Most Linux developers do the testing on their own, much like adobriyan mentioned.
However, there are a few things that help with debugging the Linux Kernel:
kexec: A system call that allows you to put another kernel into memory and reboot without going back to the BIOS, and if it fails, reboot back.
dmesg: Definitely the place to look for information about what happened during the kernel boot and whether it works/doesn't work.
Kernel Instrumentation: In addition to printk's (and an option called 'CONFIG_PRINTK_TIME' which allows you to see (to microsecond accuracy) when the kernel output what), the kernel configuration allows you to turn on a LOT of tracers that enable them to debug what is happening.
Then, developers usually have others review their patches. Once the patches are reviewed locally and seen not to interfere with anything else, and the patches are tested to work with the latest kernel from Linus without breaking anything, the patches are pushed upstream.
Edit: Here's a nice video detailing the process a patch goes through before it is integrated into the kernel.
Its not very easy to automate kernel testing. Most Linux developers do the testing on their own, much like adobriyan mentioned.
However, there are a few things that help with debugging the Linux Kernel:
kexec: A system call that allows you to put another kernel into memory and reboot without going back to the BIOS, and if it fails, reboot back.
dmesg: Definitely the place to look for information about what happened during the kernel boot and whether it works/doesn't work.
Kernel Instrumentation: In addition to printk's (and an option called 'CONFIG_PRINTK_TIME' which allows you to see (to microsecond accuracy) when the kernel output what), the kernel configuration allows you to turn on a LOT of tracers that enable them to debug what is happening.
Then, developers usually have others review their patches. Once the patches are reviewed locally and seen not to interfere with anything else, and the patches are tested to work with the latest kernel from Linus without breaking anything, the patches are pushed upstream.
Edit: Here's a nice video detailing the process a patch goes through before it is integrated into the kernel.
edited Apr 19 '12 at 20:15
answered Jul 21 '10 at 15:01
VanwarilVanwaril
4,58452745
4,58452745
add a comment |
add a comment |
In-tree tools
A good way to find test tools in the kernel is to:
make helpand read all targets- look under tools/testing
In v4.0, this leads me to:
kselftest under tools/testing/selftests. Run with
make kselftest. Must be running built kernel already. See also: Documentation/kselftest.txt , https://kselftest.wiki.kernel.org/ktest under tools/testing/ktest. See also: http://elinux.org/Ktest , http://www.slideshare.net/satorutakeuchi18/kernel-auto-testbyktest
Static analysers section of
make help, which contains targets like:
checkstack: Perl: what does checkstack.pl in linux source do?
coccicheckfor Coccinelle (mentioned by askb)
Kernel CI
https://kernelci.org/ is a project that aims to make kernel testing more automated and visible.
It appears to do only build and boot tests (TODO how to test automatically that boot worked Source should be at https://github.com/kernelci/).
Linaro seems to be the main maintainer of the project, with contributions from many big companies: https://kernelci.org/sponsors/
Linaro Lava
http://www.linaro.org/initiatives/lava/ looks like a CI system with focus on development board bringup and the Linux kernel.
ARM LISA
https://github.com/ARM-software/lisa
Not sure what it does in detail, but it is by ARM and Apache Licensed, so likely worth a look.
Demo: https://www.youtube.com/watch?v=yXZzzUEngiU
Step debuggers
Not really unit testing, but may help once your tests start failing:
- QEMU + GDB: https://stackoverflow.com/a/42316607/895245
- KGDB: https://stackoverflow.com/a/44226360/895245
My own QEMU + Buildroot + Python setup
I also started a setup focused on ease of development, but I ended up adding some simple testing capabilities to it as well: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/8217e5508782827320209644dcbaf9a6b3141724#test-this-repo
I haven't analyzed all the other setups in great detail, and they likely do much more than mine, however I believe that my setup is very easy to get started with quickly because it has a lot of documentation and automation.
add a comment |
In-tree tools
A good way to find test tools in the kernel is to:
make helpand read all targets- look under tools/testing
In v4.0, this leads me to:
kselftest under tools/testing/selftests. Run with
make kselftest. Must be running built kernel already. See also: Documentation/kselftest.txt , https://kselftest.wiki.kernel.org/ktest under tools/testing/ktest. See also: http://elinux.org/Ktest , http://www.slideshare.net/satorutakeuchi18/kernel-auto-testbyktest
Static analysers section of
make help, which contains targets like:
checkstack: Perl: what does checkstack.pl in linux source do?
coccicheckfor Coccinelle (mentioned by askb)
Kernel CI
https://kernelci.org/ is a project that aims to make kernel testing more automated and visible.
It appears to do only build and boot tests (TODO how to test automatically that boot worked Source should be at https://github.com/kernelci/).
Linaro seems to be the main maintainer of the project, with contributions from many big companies: https://kernelci.org/sponsors/
Linaro Lava
http://www.linaro.org/initiatives/lava/ looks like a CI system with focus on development board bringup and the Linux kernel.
ARM LISA
https://github.com/ARM-software/lisa
Not sure what it does in detail, but it is by ARM and Apache Licensed, so likely worth a look.
Demo: https://www.youtube.com/watch?v=yXZzzUEngiU
Step debuggers
Not really unit testing, but may help once your tests start failing:
- QEMU + GDB: https://stackoverflow.com/a/42316607/895245
- KGDB: https://stackoverflow.com/a/44226360/895245
My own QEMU + Buildroot + Python setup
I also started a setup focused on ease of development, but I ended up adding some simple testing capabilities to it as well: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/8217e5508782827320209644dcbaf9a6b3141724#test-this-repo
I haven't analyzed all the other setups in great detail, and they likely do much more than mine, however I believe that my setup is very easy to get started with quickly because it has a lot of documentation and automation.
add a comment |
In-tree tools
A good way to find test tools in the kernel is to:
make helpand read all targets- look under tools/testing
In v4.0, this leads me to:
kselftest under tools/testing/selftests. Run with
make kselftest. Must be running built kernel already. See also: Documentation/kselftest.txt , https://kselftest.wiki.kernel.org/ktest under tools/testing/ktest. See also: http://elinux.org/Ktest , http://www.slideshare.net/satorutakeuchi18/kernel-auto-testbyktest
Static analysers section of
make help, which contains targets like:
checkstack: Perl: what does checkstack.pl in linux source do?
coccicheckfor Coccinelle (mentioned by askb)
Kernel CI
https://kernelci.org/ is a project that aims to make kernel testing more automated and visible.
It appears to do only build and boot tests (TODO how to test automatically that boot worked Source should be at https://github.com/kernelci/).
Linaro seems to be the main maintainer of the project, with contributions from many big companies: https://kernelci.org/sponsors/
Linaro Lava
http://www.linaro.org/initiatives/lava/ looks like a CI system with focus on development board bringup and the Linux kernel.
ARM LISA
https://github.com/ARM-software/lisa
Not sure what it does in detail, but it is by ARM and Apache Licensed, so likely worth a look.
Demo: https://www.youtube.com/watch?v=yXZzzUEngiU
Step debuggers
Not really unit testing, but may help once your tests start failing:
- QEMU + GDB: https://stackoverflow.com/a/42316607/895245
- KGDB: https://stackoverflow.com/a/44226360/895245
My own QEMU + Buildroot + Python setup
I also started a setup focused on ease of development, but I ended up adding some simple testing capabilities to it as well: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/8217e5508782827320209644dcbaf9a6b3141724#test-this-repo
I haven't analyzed all the other setups in great detail, and they likely do much more than mine, however I believe that my setup is very easy to get started with quickly because it has a lot of documentation and automation.
In-tree tools
A good way to find test tools in the kernel is to:
make helpand read all targets- look under tools/testing
In v4.0, this leads me to:
kselftest under tools/testing/selftests. Run with
make kselftest. Must be running built kernel already. See also: Documentation/kselftest.txt , https://kselftest.wiki.kernel.org/ktest under tools/testing/ktest. See also: http://elinux.org/Ktest , http://www.slideshare.net/satorutakeuchi18/kernel-auto-testbyktest
Static analysers section of
make help, which contains targets like:
checkstack: Perl: what does checkstack.pl in linux source do?
coccicheckfor Coccinelle (mentioned by askb)
Kernel CI
https://kernelci.org/ is a project that aims to make kernel testing more automated and visible.
It appears to do only build and boot tests (TODO how to test automatically that boot worked Source should be at https://github.com/kernelci/).
Linaro seems to be the main maintainer of the project, with contributions from many big companies: https://kernelci.org/sponsors/
Linaro Lava
http://www.linaro.org/initiatives/lava/ looks like a CI system with focus on development board bringup and the Linux kernel.
ARM LISA
https://github.com/ARM-software/lisa
Not sure what it does in detail, but it is by ARM and Apache Licensed, so likely worth a look.
Demo: https://www.youtube.com/watch?v=yXZzzUEngiU
Step debuggers
Not really unit testing, but may help once your tests start failing:
- QEMU + GDB: https://stackoverflow.com/a/42316607/895245
- KGDB: https://stackoverflow.com/a/44226360/895245
My own QEMU + Buildroot + Python setup
I also started a setup focused on ease of development, but I ended up adding some simple testing capabilities to it as well: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/8217e5508782827320209644dcbaf9a6b3141724#test-this-repo
I haven't analyzed all the other setups in great detail, and they likely do much more than mine, however I believe that my setup is very easy to get started with quickly because it has a lot of documentation and automation.
edited Jan 22 at 16:40
answered May 21 '15 at 8:05
Ciro Santilli 新疆改造中心 六四事件 法轮功Ciro Santilli 新疆改造中心 六四事件 法轮功
141k33543459
141k33543459
add a comment |
add a comment |
In addition to above/below points, which emphasis more on the functionality testing, hardware certification testing and performance testing the Linux kernel.
A lot a testing actually happen through, actually scripts, static code analysis tools, code reviews etc. which is very efficient in catching bugs, which would otherwise break something in the application.
Sparse – An open-source tool designed to find faults in the Linux kernel.
Coccinelle is another program does matching and transformation engine which provides the language SmPL (Semantic Patch Language) for specifying desired matches and transformations in C code.
checkpatch.pl and other scripts - coding style issues can be found in the file Documentation/CodingStyle in the kernel source tree. The important thing to remember when reading it is not that this style is somehow better than any other style, just that it is consistent. this helps developers easily find and fix coding style issues, the script scripts/checkpatch.pl in the kernel source tree has been developed. This script can point out problems easily, and should always be run by a developer on their changes, instead of having a reviewer waste their time by pointing out problems later on.
add a comment |
In addition to above/below points, which emphasis more on the functionality testing, hardware certification testing and performance testing the Linux kernel.
A lot a testing actually happen through, actually scripts, static code analysis tools, code reviews etc. which is very efficient in catching bugs, which would otherwise break something in the application.
Sparse – An open-source tool designed to find faults in the Linux kernel.
Coccinelle is another program does matching and transformation engine which provides the language SmPL (Semantic Patch Language) for specifying desired matches and transformations in C code.
checkpatch.pl and other scripts - coding style issues can be found in the file Documentation/CodingStyle in the kernel source tree. The important thing to remember when reading it is not that this style is somehow better than any other style, just that it is consistent. this helps developers easily find and fix coding style issues, the script scripts/checkpatch.pl in the kernel source tree has been developed. This script can point out problems easily, and should always be run by a developer on their changes, instead of having a reviewer waste their time by pointing out problems later on.
add a comment |
In addition to above/below points, which emphasis more on the functionality testing, hardware certification testing and performance testing the Linux kernel.
A lot a testing actually happen through, actually scripts, static code analysis tools, code reviews etc. which is very efficient in catching bugs, which would otherwise break something in the application.
Sparse – An open-source tool designed to find faults in the Linux kernel.
Coccinelle is another program does matching and transformation engine which provides the language SmPL (Semantic Patch Language) for specifying desired matches and transformations in C code.
checkpatch.pl and other scripts - coding style issues can be found in the file Documentation/CodingStyle in the kernel source tree. The important thing to remember when reading it is not that this style is somehow better than any other style, just that it is consistent. this helps developers easily find and fix coding style issues, the script scripts/checkpatch.pl in the kernel source tree has been developed. This script can point out problems easily, and should always be run by a developer on their changes, instead of having a reviewer waste their time by pointing out problems later on.
In addition to above/below points, which emphasis more on the functionality testing, hardware certification testing and performance testing the Linux kernel.
A lot a testing actually happen through, actually scripts, static code analysis tools, code reviews etc. which is very efficient in catching bugs, which would otherwise break something in the application.
Sparse – An open-source tool designed to find faults in the Linux kernel.
Coccinelle is another program does matching and transformation engine which provides the language SmPL (Semantic Patch Language) for specifying desired matches and transformations in C code.
checkpatch.pl and other scripts - coding style issues can be found in the file Documentation/CodingStyle in the kernel source tree. The important thing to remember when reading it is not that this style is somehow better than any other style, just that it is consistent. this helps developers easily find and fix coding style issues, the script scripts/checkpatch.pl in the kernel source tree has been developed. This script can point out problems easily, and should always be run by a developer on their changes, instead of having a reviewer waste their time by pointing out problems later on.
answered Nov 5 '14 at 13:59
askbaskb
4,2451431
4,2451431
add a comment |
add a comment |
There also are:
MMTests which is collection of benchmarks and scripts to analyze the results
https://github.com/gormanm/mmtests
Trinity which is Linux system call fuzz tester
http://codemonkey.org.uk/projects/trinity/
Also the LTP pages at the sourceforge are quite outdated and the project has moved to GitHub
https://github.com/linux-test-project/ltp
add a comment |
There also are:
MMTests which is collection of benchmarks and scripts to analyze the results
https://github.com/gormanm/mmtests
Trinity which is Linux system call fuzz tester
http://codemonkey.org.uk/projects/trinity/
Also the LTP pages at the sourceforge are quite outdated and the project has moved to GitHub
https://github.com/linux-test-project/ltp
add a comment |
There also are:
MMTests which is collection of benchmarks and scripts to analyze the results
https://github.com/gormanm/mmtests
Trinity which is Linux system call fuzz tester
http://codemonkey.org.uk/projects/trinity/
Also the LTP pages at the sourceforge are quite outdated and the project has moved to GitHub
https://github.com/linux-test-project/ltp
There also are:
MMTests which is collection of benchmarks and scripts to analyze the results
https://github.com/gormanm/mmtests
Trinity which is Linux system call fuzz tester
http://codemonkey.org.uk/projects/trinity/
Also the LTP pages at the sourceforge are quite outdated and the project has moved to GitHub
https://github.com/linux-test-project/ltp
answered Feb 13 '14 at 14:34
metanmetan
661
661
add a comment |
add a comment |
I would imagine they use virtualization to do quick tests, something like QEMU, VirtualBox or Xen, and some scripts to perform configurations and automated tests.
Automated testing is probably done by trying either many random configurations or a few specific ones (if they are working with a specific issue). Linux has a lot of low-level tools (such as dmesg) to monitor and log debug data from the kernel, so I imagine that is used as well.
You are definitely right. When I did my kernel module development, I heavily depended on VirtualBox + KGDB to LINE-BY-LINE trace the kernel execution. Yes, gdb to see the whole kernel execute line-by-line is really cool. Same with Valerie Aurora, famous kernel developer, eg: youtube.com/watch?v=Tach2CheAc8. Inside the video u can see how she use UserModeLinux virtualization to step through the kernel.
– Peter Teoh
Oct 31 '11 at 5:00
add a comment |
I would imagine they use virtualization to do quick tests, something like QEMU, VirtualBox or Xen, and some scripts to perform configurations and automated tests.
Automated testing is probably done by trying either many random configurations or a few specific ones (if they are working with a specific issue). Linux has a lot of low-level tools (such as dmesg) to monitor and log debug data from the kernel, so I imagine that is used as well.
You are definitely right. When I did my kernel module development, I heavily depended on VirtualBox + KGDB to LINE-BY-LINE trace the kernel execution. Yes, gdb to see the whole kernel execute line-by-line is really cool. Same with Valerie Aurora, famous kernel developer, eg: youtube.com/watch?v=Tach2CheAc8. Inside the video u can see how she use UserModeLinux virtualization to step through the kernel.
– Peter Teoh
Oct 31 '11 at 5:00
add a comment |
I would imagine they use virtualization to do quick tests, something like QEMU, VirtualBox or Xen, and some scripts to perform configurations and automated tests.
Automated testing is probably done by trying either many random configurations or a few specific ones (if they are working with a specific issue). Linux has a lot of low-level tools (such as dmesg) to monitor and log debug data from the kernel, so I imagine that is used as well.
I would imagine they use virtualization to do quick tests, something like QEMU, VirtualBox or Xen, and some scripts to perform configurations and automated tests.
Automated testing is probably done by trying either many random configurations or a few specific ones (if they are working with a specific issue). Linux has a lot of low-level tools (such as dmesg) to monitor and log debug data from the kernel, so I imagine that is used as well.
answered Jul 5 '10 at 7:05
emceeemcee
5381511
5381511
You are definitely right. When I did my kernel module development, I heavily depended on VirtualBox + KGDB to LINE-BY-LINE trace the kernel execution. Yes, gdb to see the whole kernel execute line-by-line is really cool. Same with Valerie Aurora, famous kernel developer, eg: youtube.com/watch?v=Tach2CheAc8. Inside the video u can see how she use UserModeLinux virtualization to step through the kernel.
– Peter Teoh
Oct 31 '11 at 5:00
add a comment |
You are definitely right. When I did my kernel module development, I heavily depended on VirtualBox + KGDB to LINE-BY-LINE trace the kernel execution. Yes, gdb to see the whole kernel execute line-by-line is really cool. Same with Valerie Aurora, famous kernel developer, eg: youtube.com/watch?v=Tach2CheAc8. Inside the video u can see how she use UserModeLinux virtualization to step through the kernel.
– Peter Teoh
Oct 31 '11 at 5:00
You are definitely right. When I did my kernel module development, I heavily depended on VirtualBox + KGDB to LINE-BY-LINE trace the kernel execution. Yes, gdb to see the whole kernel execute line-by-line is really cool. Same with Valerie Aurora, famous kernel developer, eg: youtube.com/watch?v=Tach2CheAc8. Inside the video u can see how she use UserModeLinux virtualization to step through the kernel.
– Peter Teoh
Oct 31 '11 at 5:00
You are definitely right. When I did my kernel module development, I heavily depended on VirtualBox + KGDB to LINE-BY-LINE trace the kernel execution. Yes, gdb to see the whole kernel execute line-by-line is really cool. Same with Valerie Aurora, famous kernel developer, eg: youtube.com/watch?v=Tach2CheAc8. Inside the video u can see how she use UserModeLinux virtualization to step through the kernel.
– Peter Teoh
Oct 31 '11 at 5:00
add a comment |
As far as I know, there is an automatically performance regression check tool(named lkp/0 day) running/funding by the Intel, it will test each valid patch sent to the mailing list and check the scores changed from different microbenchmarks such as hackbench, fio, unixbench, netperf, etc, once there is a performance regression/improvement, a corresponding report will be sent directly to the patch author and Cc related maintainers.
add a comment |
As far as I know, there is an automatically performance regression check tool(named lkp/0 day) running/funding by the Intel, it will test each valid patch sent to the mailing list and check the scores changed from different microbenchmarks such as hackbench, fio, unixbench, netperf, etc, once there is a performance regression/improvement, a corresponding report will be sent directly to the patch author and Cc related maintainers.
add a comment |
As far as I know, there is an automatically performance regression check tool(named lkp/0 day) running/funding by the Intel, it will test each valid patch sent to the mailing list and check the scores changed from different microbenchmarks such as hackbench, fio, unixbench, netperf, etc, once there is a performance regression/improvement, a corresponding report will be sent directly to the patch author and Cc related maintainers.
As far as I know, there is an automatically performance regression check tool(named lkp/0 day) running/funding by the Intel, it will test each valid patch sent to the mailing list and check the scores changed from different microbenchmarks such as hackbench, fio, unixbench, netperf, etc, once there is a performance regression/improvement, a corresponding report will be sent directly to the patch author and Cc related maintainers.
answered Sep 14 '17 at 8:46
Yu ChenYu Chen
111
111
add a comment |
add a comment |
LTP and Memtests are generally preferred tools.
add a comment |
LTP and Memtests are generally preferred tools.
add a comment |
LTP and Memtests are generally preferred tools.
LTP and Memtests are generally preferred tools.
answered Aug 31 '15 at 12:39
Pradeep GoswamiPradeep Goswami
998921
998921
add a comment |
add a comment |
adobriyan mentioned Ingo's loop of random config build testing. That is pretty much now covered by the 0-day test bot (aka kbuild test bot). A nice article about the infrastructure is presented here:Kernel Build/boot testing
The idea behind this set-up is to notify the developers ASAP so that they can rectify the errors soon enough. (before the patches make it into Linus' tree in some cases as the kbuild infrastructure also tests against maintainer's subsystem trees)
add a comment |
adobriyan mentioned Ingo's loop of random config build testing. That is pretty much now covered by the 0-day test bot (aka kbuild test bot). A nice article about the infrastructure is presented here:Kernel Build/boot testing
The idea behind this set-up is to notify the developers ASAP so that they can rectify the errors soon enough. (before the patches make it into Linus' tree in some cases as the kbuild infrastructure also tests against maintainer's subsystem trees)
add a comment |
adobriyan mentioned Ingo's loop of random config build testing. That is pretty much now covered by the 0-day test bot (aka kbuild test bot). A nice article about the infrastructure is presented here:Kernel Build/boot testing
The idea behind this set-up is to notify the developers ASAP so that they can rectify the errors soon enough. (before the patches make it into Linus' tree in some cases as the kbuild infrastructure also tests against maintainer's subsystem trees)
adobriyan mentioned Ingo's loop of random config build testing. That is pretty much now covered by the 0-day test bot (aka kbuild test bot). A nice article about the infrastructure is presented here:Kernel Build/boot testing
The idea behind this set-up is to notify the developers ASAP so that they can rectify the errors soon enough. (before the patches make it into Linus' tree in some cases as the kbuild infrastructure also tests against maintainer's subsystem trees)
answered Feb 2 '16 at 19:51
krisharavkrisharav
301211
301211
add a comment |
add a comment |
I had done linux kernel compilation and done some Modifications for android(Marshmallow and Nougat) in which I use linux version 3. I cross-compiled it in linux system, debug the errors manually and then run its boot image file in Android and check if it was going in loop-hole or not. If it runs perfect then it means it is compiled perfectly according to system requirements.
For MotoG kernel Compilation
NOTE:- Linux Kernel will change according to requirements which depend on System Hardware
add a comment |
I had done linux kernel compilation and done some Modifications for android(Marshmallow and Nougat) in which I use linux version 3. I cross-compiled it in linux system, debug the errors manually and then run its boot image file in Android and check if it was going in loop-hole or not. If it runs perfect then it means it is compiled perfectly according to system requirements.
For MotoG kernel Compilation
NOTE:- Linux Kernel will change according to requirements which depend on System Hardware
add a comment |
I had done linux kernel compilation and done some Modifications for android(Marshmallow and Nougat) in which I use linux version 3. I cross-compiled it in linux system, debug the errors manually and then run its boot image file in Android and check if it was going in loop-hole or not. If it runs perfect then it means it is compiled perfectly according to system requirements.
For MotoG kernel Compilation
NOTE:- Linux Kernel will change according to requirements which depend on System Hardware
I had done linux kernel compilation and done some Modifications for android(Marshmallow and Nougat) in which I use linux version 3. I cross-compiled it in linux system, debug the errors manually and then run its boot image file in Android and check if it was going in loop-hole or not. If it runs perfect then it means it is compiled perfectly according to system requirements.
For MotoG kernel Compilation
NOTE:- Linux Kernel will change according to requirements which depend on System Hardware
edited Sep 2 '17 at 15:53
answered Aug 25 '17 at 17:12
Vineet JainVineet Jain
91841129
91841129
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3177338%2fhow-is-the-linux-kernel-tested%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
15
youtube.com/watch?v=L2SED6sewRw , somewhere, I cant remember exactly, but I think in the QA section this is being talked about.
– Anders
Jul 21 '10 at 15:03
6
Anders' link is great - a Google Tech Talk by one of the top kernel developers, Greg Kroah Hartman. He validates the answer given below by kernel developer @adobriyan. Greg notes the fun thing about the kernel - no good way to test without running it - hard to do unit tests etc - many permutations. "We rely on the development community to test. We want as many functional tests as we can get, and performance tests also." A link straight to the testing discussion is youtube.com/…
– nealmcb
Feb 27 '12 at 3:40
With the popularity of VMs, wouldn't it be possible to automate this by building the kernel with a bunch of config permutations and trying to boot up on them? It wouldn't be a "unit" test by any means, but it could catch bugs.
– Daniel Kaplan
Aug 27 '14 at 0:16
@DanielKaplan: If you assume there's about 1000 motherboards that each has one of 10 CPUs, plus 3 of 1000 PCI devices, plus 3 of 1000 USB devices; and that the kernel has 1000 different possibly compile time options; then you're looking at about 1000*10*1000*999*9981000*999*998*1000 possible permutations to test. If you do a nice 8-hour burn in test for each permutation and have a pool of 100 servers to run 400 VMs in parallel at the same time; then by the time you've got 1 millionth of it tested the results will all be obsolete because someone changed the code and you have to start again.
– Brendan
Jun 18 '15 at 17:39
There is a little discussion about unit tests on ycombinator.
– joeytwiddle
Apr 12 '16 at 2:48