Re:Ask HN: Why the Linux Kernel doesn't have unit tests?
by sph on Friday November 25, 2022 @10:16AM
(#33743094)
> Maybe that's why the most recent commit as of right now is loaded with fixes of broken things
Are you saying that if Linux had tests, there would be no bugs?
Re:Ask HN: Why the Linux Kernel doesn't have unit tests?
by agent281 on Friday November 25, 2022 @10:38AM
(#33743333)
I think that's a bit of a strawman. I don't think anyone says tests prevent all bugs. They can help fix some parts of the contract down and give you a place to check against regressions.
Re:Ask HN: Why the Linux Kernel doesn't have unit tests?
by sph on Friday November 25, 2022 @11:58AM
(#33744336)
GP pointed out to a bug fix commit as proof that the kernel would benefit from having tests, so it's not that much of a straw man.
Re:Ask HN: Why the Linux Kernel doesn't have unit tests?
by svenpeter on Friday November 25, 2022 @01:01PM
(#33745071)
That merge only has fixed because of how the development model works: there’s a merge window where new features are merged and which then becomes -rc1.
After that only fixes are allowed until the final release of that version and then the merge window opens again.
Re:Ask HN: Why the Linux Kernel doesn't have unit tests?
by thunky on Friday November 25, 2022 @01:20PM
(#33745262)
That makes sense, so I just picked another commit at random without a -rc tag:
https://github.com/torvalds/linux/commit/c60c152230828825c06...
The fix is to change && to ||
This seems like the exact type of bug that a unit test could prevent.
Maybe not, but isn't it true that any new code that is being added to the kernel has been run on exactly 0 devices? And new code is being added all the time.
Maybe that's why the most recent commit as of right now is loaded with fixes of broken things: https://github.com/torvalds/linux/commit/08ad43d554bacb9769c...
It's one thing to say that it's impossible to test effectively locally before release (which I'm not sure if that's true or not). But you're saying it's just not worth testing because it'll break in real life and that's even better, which I"m not sure I can agree with.