Abstract
In multithreaded programs both environment input data and the nondeterministic interleavings of concurrent events can affect the behavior of the program. One approach to systematically explore the nondeterminism caused by input data is dynamic symbolic execution. For testing multithreaded programs we present a new approach that combines dynamic symbolic execution with unfoldings, a method originally developed for Petri nets but also applied to many other models of concurrency. We provide an experimental comparison of our new approach with existing algorithms combining dynamic symbolic execution and partial order reductions and show that the new algorithm can explore the reachable control states of each thread with a significantly smaller number of test runs. In some cases the reduction to the number of test runs can be even exponential allowing programs with long test executions or hard-to-solve constraints generated by symbolic execution to be tested more efficiently. In addition we show that our algorithm generates a structure describing different interleavings from which deadlocks can be detected efficiently as well.
















Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.Notes
Thread join can be implemented similarly as locks by assuming that a thread holds a shared resource initially and releases it upon termination. If we assume that wait and notify can be called only if a corresponding lock is held by a thread, then the algorithm explores all possible orders of wait and notify calls because the algorithm executes all interleavings of acquires of related locks.
References
Abdulla, P.A., Aronis, S., Jonsson, B., Sagonas, K.F.: Optimal dynamic partial order reduction. In: Jagannathan, S., Sewell, P. (eds.) POPL, pp. 373–384. ACM, New York (2014)
Agarwal, R., Stoller, S.D.: Run-time detection of potential deadlocks for programs with locks, semaphores, and condition variables. In: Ur, S., Farchi, E. (eds.) PADTAD, pp. 51–60. ACM, New York (2006)
Cadar, C., Dunbar, D., Engler, D.R.: KLEE: Unassisted and automatic generation of high-coverage tests for complex systems programs. In: Proceedings of the 8th USENIX Symposium on Operating Systems Design and Implementation (OSDI 2008). USENIX Association, Berkely, CA (2008)
de Moura L.M., Bjørner N.: Z3: An efficient SMT solver. In: Proceedings of the 14th International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS 2008). Lecture Notes in Computer Science, vol. 4963, pp. 337–340. Springer, Berlin (2008)
Diekert, V.: The Book of Traces. World Scientific Publishing Co. Inc., River Edge, NJ (1995)
Esparza, J., Heljanko, K.: Unfoldings—A Partial-Order Approach to Model Checking. EATCS Monographs in Theoretical Computer Science. Springer, Berlin (2008)
Farzan, A., Madhusudan, P.: Causal atomicity. In: Ball, T., Jones, R.B. (eds.) CAV. Lecture Notes in Computer Science, pp. 315–328. Springer, Berlin (2006)
Flanagan, C., Freund, S.N.: Fasttrack: efficient and precise dynamic race detection. Commun. ACM 53(11), 93–101 (2010)
Flanagan, C., Godefroid, P.: Dynamic partial-order reduction for model checking software. In: Palsberg, J., Abadi, M. (eds.) POPL. ACM, New York (2005)
Godefroid, P.: Partial-Order Methods for the Verification of Concurrent Systems: An Approach to the State-Explosion Problem. Springer, Secaucus, NJ (1996)
Godefroid, P., Klarlund, N., Sen, K.: DART: directed automated random testing. In: Proceedings of the ACM SIGPLAN 2005 Conference on Programming Language Design and Implementation (PLDI 2005), pp. 213–223. ACM, New York (2005)
Kähkönen, K., Saarikivi, O., Heljanko, K.: Using unfoldings in automated testing of multithreaded programs. In: Proceedings of the 27th IEEE/ACM International Conference Automated Software Engineering (ASE 2012), pp. 150–159 (2012)
Khomenko, V., Koutny, M.: Towards an efficient algorithm for unfolding Petri nets. In: Larsen, K.G., Nielsen, M. (eds.) CONCUR. Lecture Notes in Computer Science, pp. 366–380. Springer, Berlin (2001)
Lauterburg, S., Karmani, R.K., Marinov, D., Agha, G.: Evaluating ordering heuristics for dynamic partial-order reduction techniques. In: 13th International Conference of Fundamental Approaches to Software Engineering, pp. 308–322 (2010)
McMillan, K.L.: Using unfoldings to avoid the state explosion problem in the verification of asynchronous circuits. In: von Bochmann, G., Probst, D.K. (eds.) CAV. Lecture Notes in Computer Science, pp. 164–177. Springer, Berlin (1992)
Musuvathi, M., Qadeer, S., Ball, T., Basler, G., Nainar, P.A., Neamtiu, I.: Finding and reproducing heisenbugs in concurrent programs. In: Draves, R., van Renesse, R. (eds.) OSDI, pp. 267–280. USENIX Association, Berkeley, CA (2008)
Pasareanu, C.S., Mehlitz, P.C., Bushnell, D.H., Gundy-Burlet, K., Lowry, M.R., Person, S., Pape, M.: Combining unit-level symbolic execution and system-level concrete execution for testing nasa software. In: Ryder, B.G., Zeller, A. (eds.) ISSTA, pp. 15–26. ACM, New York (2008)
Peled, D.: All from one, one for all: on model checking using representatives. In: Courcoubetis, C. (ed.) CAV. Lecture Notes in Computer Science, pp. 409–423. Springer, Berlin (1993)
Saarikivi, O., Kähkönen, K., Heljanko, K.: Improving dynamic partial order reductions for concolic testing. In: Proceedings of the 12th International Conference on Application of Concurrency to System Design (ACSD 2012), pp. 132–141 (2012)
Sen, K.: Scalable automated methods for dynamic program analysis. Doctoral Thesis, University of Illinois (2006)
Sen, K., Agha, G.: CUTE and jCUTE: concolic unit testing and explicit path model-checking tools. In: Proceedings of the 18th International Conference on Computer Aided Verification (CAV 2006). Lecture Notes in Computer Science, vol. 4144, pp. 419–423, (Tool Paper). Springer, Berlin (2006a)
Sen, K., Agha, G.: A race-detection and flipping algorithm for automated testing of multi-threaded programs. In: Haifa Verification Conference. Lecture Notes in Computer Science, vol. 4383, pp. 166–182. Springer, New York (2006b)
Tillmann, N., de Halleux, J.: Pex—white box test generation for .NET. In: Proceedings of the Second International Conference on Tests and Proofs (TAP 2008). Lecture Notes in Computer Science, vol. 4966, pp. 134–153. Springer, New York (2008)
Vallée-Rai, R., Co, P., Gagnon, E., Hendren, L.J., Lam, P., Sundaresan, V.: Soot—a Java bytecode optimization framework. In: Proceedings of the 1999 conference of the Centre for Advanced Studies on Collaborative Research (CASCON 1999), p. 13. IBM, New York (1999)
Valmari, A.: Stubborn sets for reduced state space generation. In: Proceedings of the 10th International Conference on Applications and Theory of Petri Nets: Advances in Petri Nets 1990, pp. 491–515. Springer, London (1991)
Vogler, W., Semenov, A.L., Yakovlev, A.: Unfolding and finite prefix for nets with read arcs. In: Sangiorgi, D., de Simone, R. (eds.) CONCUR. Lecture Notes in Computer Science, pp. 501–516. Springer, Berlin (1998)
Wang, C., Limaye, R., Ganai, M.K., Gupta, A.: Trace-based symbolic analysis for atomicity violations. In: Esparza, J., Majumdar, R. (eds.) TACAS. Lecture Notes in Computer Science, pp. 328–342. Springer, Berlin (2010)
Acknowledgments
This work has been financially supported by Tekes - Finnish Agency for Technology and Innovation, ARTEMIS-JU and Academy of Finland (Projects 128050 and 139402).
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Kähkönen, K., Saarikivi, O. & Heljanko, K. Unfolding based automated testing of multithreaded programs. Autom Softw Eng 22, 475–515 (2015). https://doi.org/10.1007/s10515-014-0150-6
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10515-014-0150-6