Automated Test-Case Reduction
Adrian Sampson explains automated test-case reduction techniques using the Shrinkray reducer to debug an interpreter bug. He emphasizes the importance of effective test scripts and occasional manual intervention for efficient bug identification and resolution.
Read original articleAdrian Sampson from Cornell University discusses automated test-case reduction techniques in a blog post. He explains how automated reducers can quickly and blindly try different approaches to reduce test cases, potentially in parallel, compared to manual methods. The reduction process involves picking code to delete, checking the output to decide whether to backtrack, and determining when to stop reducing. Sampson demonstrates using the Shrinkray reducer to debug an interpreter bug, emphasizing the importance of writing an effective interestingness test script. Tricks like shell negation, including a "not bogus" check, and using grep to search for specific error messages help in crafting robust test scripts. The post highlights the need for occasional manual intervention to guide the reduction process effectively. By combining automated reduction with manual adjustments, users can efficiently identify and address bugs in their code.
Related
Chasing a Bug in a SAT Solver
Adolfo Ochagavía and Prefix.dev swiftly resolved a bug in the SAT-based dependency solver, resolvo, with community input. The incident emphasizes open-source collaboration and potential debugging tool enhancements for software quality.
Mix-testing: revealing a new class of compiler bugs
A new "mix testing" approach uncovers compiler bugs by compiling test fragments with different compilers. Examples show issues in x86 and Arm architectures, emphasizing the importance of maintaining instruction ordering. Luke Geeson developed a tool to explore compiler combinations, identifying bugs and highlighting the need for clearer guidelines.
Refined Input, Degraded Output: The Counterintuitive World of Compiler Behavior
The study delves into compiler behavior when given extra information for program optimization. Surprisingly, more data can sometimes lead to poorer optimization due to intricate compiler interactions. Testing identified 59 cases in popular compilers, emphasizing the need for better understanding.
The Transformation Priority Premise (2013)
The Clean Coder Blog discusses Transformations in code development, distinguishing them from Refactorings. It emphasizes maintaining a preferred order of Transformations to enhance the red/green/refactor cycle efficiency. Examples illustrate transitioning from specific to generic code.
Boosting Compiler Testing by Injecting Real-World Code
The research introduces a method to enhance compiler testing by using real-world code snippets to create diverse test programs. The approach, implemented in the Creal tool, identified and reported 132 bugs in GCC and LLVM, contributing to compiler testing practices.
Before leaving compiler team, I wanted to find a way to do this one the AST level (so parens always go in pairs, etc), but that could also complect with the bug.
I wonder if LLMs could accelerate this by more intelligently removing stuff first, iteratively?
1. Reduce the test data by property-based tests' auto shrinking a là QuickCheck [1]
2. Reduce the change set to a codebase, a là delta debugging [2]
The reducer is able to do both at the same time in a pretty generic way, with some restrictions on the expressivity. Seems to be a good fit for end-to-end tests.
Also, if you happen to be reducing an LLVM case you can use llvm-reduce [2].
https://pldi24.sigplan.org/home/egraphs-2024#program
Specifically, the EGSTRA paper.
Maybe it’s more critical when you’re dealing with “research-quality” code. This post seems to ignore the underlying problem: it’s rare to see research code with any tests.
Related
Chasing a Bug in a SAT Solver
Adolfo Ochagavía and Prefix.dev swiftly resolved a bug in the SAT-based dependency solver, resolvo, with community input. The incident emphasizes open-source collaboration and potential debugging tool enhancements for software quality.
Mix-testing: revealing a new class of compiler bugs
A new "mix testing" approach uncovers compiler bugs by compiling test fragments with different compilers. Examples show issues in x86 and Arm architectures, emphasizing the importance of maintaining instruction ordering. Luke Geeson developed a tool to explore compiler combinations, identifying bugs and highlighting the need for clearer guidelines.
Refined Input, Degraded Output: The Counterintuitive World of Compiler Behavior
The study delves into compiler behavior when given extra information for program optimization. Surprisingly, more data can sometimes lead to poorer optimization due to intricate compiler interactions. Testing identified 59 cases in popular compilers, emphasizing the need for better understanding.
The Transformation Priority Premise (2013)
The Clean Coder Blog discusses Transformations in code development, distinguishing them from Refactorings. It emphasizes maintaining a preferred order of Transformations to enhance the red/green/refactor cycle efficiency. Examples illustrate transitioning from specific to generic code.
Boosting Compiler Testing by Injecting Real-World Code
The research introduces a method to enhance compiler testing by using real-world code snippets to create diverse test programs. The approach, implemented in the Creal tool, identified and reported 132 bugs in GCC and LLVM, contributing to compiler testing practices.