Re:Ask HN: Why the Linux Kernel doesn't have unit tests?
by icedchai on Friday November 25, 2022 @10:01AM
(#33742962)
I worked at one place that had so many mocks, your tests were barely testing any real code. In one case, a dude checked in a 5000 line test suite for an "internal API." The server was mocked. All the tests were doing was checking that calls echoed back their own parameters. What was the point? Well, the API client now had 100% coverage.
[ Parent
| on HN ]
Re:Ask HN: Why the Linux Kernel doesn't have unit tests?
by hinkley on Friday November 25, 2022 @01:31PM
(#33745348)
Going into new segments of our code, I’ve had to rewrite an awful lot of tests. It was a mess, and each one had at least a few tests that were only testing the mocks. Hand written mocks at that. Those people need to be stopped.
Re:Ask HN: Why the Linux Kernel doesn't have unit tests?
by closeparen on Friday November 25, 2022 @03:05PM
(#33746233)
This is 95% of tests I read and write at my job.
Re:Ask HN: Why the Linux Kernel doesn't have unit tests?
by icedchai on Friday November 25, 2022 @04:04PM
(#33746728)
It wasn't that bad at a previous job, but it was close. The sad part is nobody else would comment on the useless nature of these tests that didn't actually test anything.
Re:Ask HN: Why the Linux Kernel doesn't have unit tests?
by closeparen on Saturday November 26, 2022 @03:35PM
(#33756438)
I’ve had other engineers make very condescending remarks about these kinds of questions, as if I don’t understand the value testing or quality at all. It makes them look mature and responsible, and me immature and short-termist. I quickly learned not to bring it up, especially not in front of management.
Re:Ask HN: Why the Linux Kernel doesn't have unit tests?
by icedchai on Saturday November 26, 2022 @06:32PM
(#33758106)
It's true. I mean, I wouldn't comment on them either. I'd just roll my eyes when asked to review another 4000 line "test suite" that upped the coverage but did not test anything meaningful. I wrote many useless tests myself, assigned tasks like "upping test coverage for module XYZ." They'd all get thumbs up and looks-good in reviews.