News for hackers. Stuff that matters.
Re:How the GNU coreutils are tested by pmezard on Monday December 06, 2021 @12:52PM (#29463100)
Re:How the GNU coreutils are tested by rectang on Monday December 06, 2021 @01:30PM (#29463656)
That's awesome.

I've had to resort to grotesque hacks before to simulate full disks in test suites — e.g. replacing a file descriptor with a nonsense number to trigger an error at the call site where a write would have failed.

Now that I know /dev/full exists, I can write a test which, although it works only on a subset of operating systems, still exercises a code path which applies to all of them.

Re:How the GNU coreutils are tested by viraptor on Monday December 06, 2021 @07:49PM (#29467840)
You can also create a tiny filesystem in a file, set root user reservation to 100%, mount the file with `-o loop`. That should give you a "real" full device.
Re:How the GNU coreutils are tested by monocasa on Monday December 06, 2021 @07:53PM (#29467885)
I typically use LD_PRELOAD hacks to simulate failure conditions. That way you can get deeper into your code than simply something that always fails.