How Far Must a Test Explore? Certifying Composable Read-Write Interfaces from Their Own Random Edits
Organizations: Stanford University · The Chinese University of Hong Kong · University of Maryland, College Park
Abstract
Random tests of stateful code check laws, like reading back a written value, at states that random writes reach. The laws hold at every state exactly when the code behaves like a record with hidden data, so a pass is taken as evidence. This can fail: the laws can hold at every sample while the code is far from any record. The laws are local, but behaving like a record is global. Self-testing and stability theorems bridge this gap when the query distribution is controlled by the tester or preserved by the tested maps, but here it is generated by the tested writes, which need not be invertible. We ask how far a test must explore. An interface has binary variables, each with a read and two writes; in a record, reads return their bits and writes set only their bits. Samples are the ends of geometric runs of mean of uniformly random writes from a start distribution; a tester adds its own write chains of depth . The distance is the least, over records with hidden data, of the largest probability that a read or write differs from it at a sample. From one start state, law checks at samples certify, at fixed confidence, any threshold after geometric runs of every positive mean, while runs of fixed positive length can pass at distance . For the worst start distribution, take with fixed . For with fixed , a polynomial budget of samples and writes exists exactly when , where law checks suffice. With no runs, the least depth for this budget is . Counting samples alone, in the worst case at and , the critical mean for a polynomial budget is , by exhaustive search. So one start state needs only law checks, and the worst case at these thresholds needs exploration linear in if writes are counted.
Figures & tables
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
Automated Software Testing
Automated software testing uses tools and algorithms to generate, run, and evaluate tests that find defects and prevent regressions.
See all 143 papers