Automatic Generation of Unit Tests for Correlated Variables in Parallel Programs

  • Ali JannesariEmail author
  • Felix Wolf


A notorious class of concurrency bugs are race condition related to correlated variables, which make up about 30 % of all non-deadlock concurrency bugs. A solution to prevent this problem is the automatic generation of parallel unit tests. This paper presents an approach to generate parallel unit tests for variable correlations in multithreaded code. We introduce a hybrid approach for identifying correlated variables. Furthermore, we estimate the number of potentially violated correlations for methods executed in parallel. In this way, we are capable of creating unit tests that are suited for race detectors considering correlated variables. We were able to identify more than 85 % of all race conditions on correlated variables in eight applications after applying our parallel unit tests. At the same time, we reduced the number of unnecessary generated unit tests. In comparison to a test generator unaware of variable correlations, redundant unit tests are reduced by up to 50 %, while maintaining the same precision and accuracy in terms of the number of detected races.


Unit tests Automatic testing Parallel programming Debugging Race detection Program analysis  Correlated variables 


  1. 1.
    Lu, S., Park, S., Seo, E., Zhou, Y.: Learning from mistakes: a comprehensive study on real world concurrency bug characteristics. In: ASPLOS XIII: Proceedings of the 13th International Conference on Architectural Support for Programming Languages and Operating Systems, pp. 329–339. ACM, New York, NY (2008)Google Scholar
  2. 2.
    Schimmel, J., Molitorisz, K., Jannesari, A., Tichy, W.F.: Automatic generation of parallel unit tests. In: 8th IEEE/ACM International Workshop on Automation of Software Test (AST) (2013)Google Scholar
  3. 3.
    Jannesari, A., Westphal-Furuya, M., Tichy, W.F.: Dynamic data race detection for correlated variables. In: Proceedings of the 11th International Conference on Algorithms and Architectures for Parallel Processing, vol. Part I. ICA3PP’11, pp. 14–26. Springer, Berlin (2011)Google Scholar
  4. 4.
    Lu, S., Park, S., Hu, C., Ma, X., Jiang, W., Li, Z., Popa, R.A., Zhou, Y.: MUVI: automatically inferring multi-variable access correlations and detecting related semantic and concurrency bugs. In: SOSP ’07: Proceedings of Twenty-First ACM SIGOPS Symposium on Operating Systems Principles, pp. 103–116. ACM, New York, NY (2007)Google Scholar
  5. 5.
    Jannesari, A., Tichy, W.F.: Library-independent data race detection. IEEE Transactions on Parallel and Distributed Systems (TPDS), pp. 1–11 (2013)Google Scholar
  6. 6.
    Jannesari, A., Tichy, W.F.: Identifying ad-hoc synchronization for enhanced race detection. In: IEEE International Symposium on Parallel Distributed Processing (IPDPS), pp. 1–10 (2010)Google Scholar
  7. 7.
    Jannesari, A., Bao, K., Pankratius, V., Tichy, W.F.: Helgrind+: an efficient dynamic race detector. In: IEEE International Symposium on Parallel Distributed Processing (IPDPS), pp. 1–13 (2009)Google Scholar
  8. 8.
    Jannesari, A., Tichy, W.F.: On-the-fly race detection in multi-threaded programs. In: Proceedings of the 6th Workshop on Parallel and Distributed Systems: Testing, Analysis, and Debugging. PADTAD ’08, pp. 6:1–6:10. ACM, New York, NY (2008)Google Scholar
  9. 9.
    Nethercote, N., Seward, J.: Valgrind: a framework for heavyweight dynamic binary instrumentation. Sigplan Not. 42, 89–100 (2007)CrossRefGoogle Scholar
  10. 10.
    Luo, Q., Zhang, S., Zhao, J., Hu, M.: A lightweight and portable approach to making concurrent failures reproducible. In: Proceedings of the 13th International Conference on Fundamental Approaches to Software Engineering. FASE’10, pp. 323–337. Springer, Berlin (2010)Google Scholar
  11. 11.
    Katayama, T., Itoh, E., Ushijima, K., Furukawa, Z.: Test-case generation for concurrent programs with the testing criteria using interaction sequences. In: Proceedings of the Sixth Asia Pacific Software Engineering Conference (APSEC ’99). IEEE Computer Society, Washington, DC (1999)Google Scholar
  12. 12.
    Wong, W.E., Lei, Y., Ma, Y.: Effective generation of test sequences for structural testing of concurrent programs. In: 10th IEEE International Conference on Engineering of Complex Computer Systems (ICECCS 2005), pp. 539–548. IEEE Computer Society, Richardson, TX (2005)Google Scholar
  13. 13.
    Nistor, A., Luo, Q., Pradel, M., Gross, T.R., Marinov, D.: Ballerina: automatic generation and clustering of efficient random unit tests for multithreaded code. In: Proceedings of the 2012 International Conference on Software Engineering (ICSE 2012), pp. 727–737. IEEE Press, Piscataway, NJ (2012)Google Scholar
  14. 14.
    Cooper, K.D., Harvey, T.J., Kennedy, K.: A Simple, Fast Dominance Algorithm. Technical Report TR06-38870, Computer Science Department, Rice University, Houston, TX (2006)Google Scholar
  15. 15.
    Musuvathi, M., Qadeer, S.: Chess: systematic stress testing of concurrent software. In: Puebla, G. (ed.) Logic-Based Program Synthesis and Transformation. Lecture Notes in Computer Science, vol. 4407, pp. 15–16. Springer, Berlin (2007)CrossRefGoogle Scholar
  16. 16.
    Musuvathi, M., Qadeer, S., Ball, T., Basler, G., Nainar, P.A., Neamtiu, I.: Finding and reproducing heisenbugs in concurrent programs. In: Proceedings of the 8th USENIX Conference on Operating Systems Design and Implementation. OSDI’08, pp. 267–280. USENIX Association, Berkeley, CA (2008)Google Scholar
  17. 17.
    Microsoft Code gallery for parallel programs.
  18. 18.
    Butler, N.: Petridish: multi-threading for performance in c#.
  19. 19.
    Reichl, D.: Keepass password safe.
  20. 20.
  21. 21.
    Xu, M., Bodík, R., Hill, M.D.: A serializability violation detector for shared-memory server programs. Sigplan Not. 40, 1–14 (2005)Google Scholar
  22. 22.
    Vaziri, M., Tip, F., Dolby, J.: Associating synchronization constraints with data in an object-oriented language. In: POPL ’06: Conference Record of the 33rd ACM SIGPLAN–SIGACT Symposium on Principles of Programming Languages, pp. 334–345. ACM, New York, NY (2006)Google Scholar

Copyright information

© Springer Science+Business Media New York 2015

Authors and Affiliations

  1. 1.German Research School for Simulation SciencesAachenGermany
  2. 2.RWTH Aachen UniversityAachenGermany

Personalised recommendations