Coverage for important strings
Coverage for important strings
Posted Oct 29, 2024 20:46 UTC (Tue) by tialaramex (subscriber, #21167)In reply to: Coverage for important strings by iabervon
Parent article: A new approach to validating test suites
On the other hand, I always check what I'm about to commit, because I know I will read the changes sometimes, and if they're full of stray garbage that's a problem. Likewise if I turn out to have changed more than I realised, my log message should reflect the actual work, not just the last thing I did before I typed commit. So if I made a correct change but also mangled a string, that string is likely to stick out when examining the git diff.
Posted Oct 29, 2024 21:27 UTC (Tue)
by iabervon (subscriber, #722)
[Link] (3 responses)
Posted Oct 30, 2024 12:15 UTC (Wed)
by epa (subscriber, #39769)
[Link] (2 responses)
Posted Oct 31, 2024 9:50 UTC (Thu)
by taladar (subscriber, #68407)
[Link] (1 responses)
Posted Oct 31, 2024 13:08 UTC (Thu)
by epa (subscriber, #39769)
[Link]
Posted Oct 29, 2024 23:30 UTC (Tue)
by mathstuf (subscriber, #69389)
[Link] (1 responses)
I'd be interested to also drive mutation two ways: CI first smoke tests those that have been discovered to be sensitive to the code in question (you still want the full test suite eventually). Also, run the tests under mutation of the patched code to find issues. I think it's a tool in the toolbox and, with some plumbing between git and CI, could be very powerful to help find issues before maintainer time is spent looking at diffs.
Posted Oct 31, 2024 17:00 UTC (Thu)
by mbp (subscriber, #2737)
[Link]
It does not yet comment on your PRs, but I'd like to add that.
Posted Oct 30, 2024 8:56 UTC (Wed)
by taladar (subscriber, #68407)
[Link]
There is a tool called https://crates.io/crates/typos-cli that you can put into your pre-commit hook to avoid committing mistakes like that. The main issue with it is that it only supports English so if you have other languages in your source code you might get false positives (but there are ways to add to the list of words accepted or to exclude files).
Posted Oct 31, 2024 23:09 UTC (Thu)
by himi (subscriber, #340)
[Link]
I've also found gitui a useful tool for giving me a different view of what I've changed - I rarely end up using it to drive the actual commit process (I use it more often as a friendly way of doing `git add -i`), but it gives a different perspective which can help get past that tl;dr issue.
For the specific case of mutating strings in the code, this seems like a situation where fuzzing would be useful - it'd need to be aware of things like format string mini-languages as well as potentially the distinction between a "plain" string and something like a path (in Python you could target mutations at pathlib.Path objects, for example), but just throwing mutations at any constant/hard-coded string value would be a useful starting point. Though you'd need to run your tests in a sandboxed environment, since the semantics of `subprocess.run(["nm", objfile])` and `subprocess.run(["rm", objfile])` are kind of different . . .
Coverage for important strings
Coverage for important strings
Coverage for important strings
Coverage for important strings
Coverage for important strings
Coverage for important strings
Coverage for important strings
Coverage for important strings
