TY - GEN
T1 - Real-World Fault Detection for C-Extended Python Projects with Automated Unit Test Generation
AU - Berg, Lucas
AU - Krodinger, Lukas
AU - Lukasczyk, Stephan
AU - Panichella, Annibale
AU - Fraser, Gordon
AU - Vanhoof, Wim
AU - Devroey, Xavier
PY - 2026
Y1 - 2026
N2 - Many popular Python libraries use C-extensions for performance-critical operations allowing users to combine the best of the two worlds: The simplicity and versatility of Python and the performance of C. A drawback of this approach is that exceptions raised in C can bypass Python's exception handling and cause the entire interpreter to crash. These crashes are real faults if they occur when calling a public API. While automated test generation should, in principle, detect such faults, crashes in native code can halt the test process entirely, preventing detection or reproduction of the underlying errors and inhibiting coverage of non-crashing parts of the code. To overcome this problem, we propose separating the generation and execution stages of the testgeneration process. We therefore adapt Pynguin, an automated test case generation tool for Python, to use subprocess-execution. Executing each generated test in an isolated subprocess prevents a crash from halting the test generation process itself. This allows us to (1) detect such faults, (2) generate reproducible crash-revealing test cases for them, (3) allow studying the underlying faults, and (4) enable test generation for non-crashing parts of the code. To evaluate our approach, we created a dataset consisting of 1648 modules from 21 popular Python libraries with C-extensions. Subprocess-execution allowed automated testing of up to 56.5% more modules and discovered 213 unique crash causes, revealing 32 previously unknown faults.
AB - Many popular Python libraries use C-extensions for performance-critical operations allowing users to combine the best of the two worlds: The simplicity and versatility of Python and the performance of C. A drawback of this approach is that exceptions raised in C can bypass Python's exception handling and cause the entire interpreter to crash. These crashes are real faults if they occur when calling a public API. While automated test generation should, in principle, detect such faults, crashes in native code can halt the test process entirely, preventing detection or reproduction of the underlying errors and inhibiting coverage of non-crashing parts of the code. To overcome this problem, we propose separating the generation and execution stages of the testgeneration process. We therefore adapt Pynguin, an automated test case generation tool for Python, to use subprocess-execution. Executing each generated test in an isolated subprocess prevents a crash from halting the test generation process itself. This allows us to (1) detect such faults, (2) generate reproducible crash-revealing test cases for them, (3) allow studying the underlying faults, and (4) enable test generation for non-crashing parts of the code. To evaluate our approach, we created a dataset consisting of 1648 modules from 21 popular Python libraries with C-extensions. Subprocess-execution allowed automated testing of up to 56.5% more modules and discovered 213 unique crash causes, revealing 32 previously unknown faults.
KW - C-Extension
KW - Fault Detection
KW - Foreign Function Interface
KW - Python
KW - Subprocess
KW - Test Generation
UR - https://www.scopus.com/pages/publications/105047202760
U2 - 10.1109/ICST69053.2026.00061
DO - 10.1109/ICST69053.2026.00061
M3 - Conference contribution
AN - SCOPUS:105047202760
T3 - Proceedings - 2026 IEEE International Conference on Software Testing, Verification and Validation, ICST 2026
SP - 417
EP - 428
BT - Proceedings - 2026 IEEE International Conference on Software Testing, Verification and Validation, ICST 2026
PB - IEEE
CY - Piscataway, NJ, USA
T2 - 19th IEEE International Conference on Software Testing, Verification and Validation, ICST 2026
Y2 - 18 May 2026 through 22 May 2026
ER -