Skip to main content

Verifying Code Generation Tools for the B-Method Using Tests: A Case Study

  • Conference paper
  • First Online:
Tests and Proofs (TAP 2015)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 9154))

Included in the following conference series:

  • 574 Accesses

Abstract

In this paper, we present a case study where two code generators for the B-Method were validated using software testing techniques. Our testing strategy is a combination of Grammar-Based Testing (GBT) and Model-Based Testing (MBT) techniques. The strategy consists of two steps. In the first step, grammar-based coverage criteria are used to generate a wide and meaningful set of test input models to validate the parsing capabilities of the code generators. In the second step, a MBT tool is used to validate the correctness of the output produced by these tools. The MBT tool generates a set of tests based on the same input model used by the code generation tools. The generated code is considered correct (consistent with the input model) if it passes this set of tests. Using this testing strategy, we were able to find problems in both code generation tools with moderate effort.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Abrial, J.-R.: The B-book: assigning programs to meanings. Cambridge University Press (1996)

    Google Scholar 

  2. Ammann, P., Offutt, J.: Introduction to Software Testing. Cambridge University Press, New York (2008)

    Book  Google Scholar 

  3. ClearSy. Atelier B User Manual Version 4.0. Clearsy System Engineering (2009)

    Google Scholar 

  4. Déharbe, D., Medeiros, Jr., V.: Proposal: Translation of B Implementations to LLVM-IR. In: SBMF, Brasília - DF, SBMF (2013)

    Google Scholar 

  5. Goerigk, W., Dold, A., Gaul, T., Goos, G., Heberle, A., Von Henke, F.W., Hoffmann, U., Langmaack, H., Pfeifer, H., Ruess, H., et al.: Compiler correctness and implementation verification: The verifix approach (1996)

    Google Scholar 

  6. Gogolla, M., Vallecillo, A.: Tractable model transformation testing. In: France, R.B., Kuester, J.M., Bordbar, B., Paige, R.F. (eds.) ECMFA 2011. LNCS, vol. 6698, pp. 221–235. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  7. Härtel, J., Härtel, L., Lämmel, R.: Test-Data generation for Xtext. In: Combemale, B., Pearce, D.J., Barais, O., Vinju, J.J. (eds.) SLE 2014. LNCS, vol. 8706, pp. 342–351. Springer, Heidelberg (2014)

    Google Scholar 

  8. Hentz, C.: Automatic Generation of Tests from Language Descriptions (Text in Portuguese). Master’s thesis, UFRN, Natal, Brazil (2010)

    Google Scholar 

  9. Hoffman, D.M., Ly-Gagnon, D., Strooper, P., Wang, H.-Y.: Grammar-based test generation with yougen. Software: Practice and Experience 41(4), 427–447 (2011)

    Google Scholar 

  10. Kossatchev, A.S., Posypkin, M.A.: Survey of compiler testing methods. Program. Comput. Softw. 31(1), 10–19 (2005)

    Article  Google Scholar 

  11. Lämmel, R.: Grammar testing. In: Hussmann, H. (ed.) FASE 2001. LNCS, vol. 2029, pp. 201–216. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  12. Lämmel, R., Schulte, W.: Controllable combinatorial coverage in grammar-based testing. In: Uyar, M.U., Duale, A.Y., Fecko, M.A. (eds.) TestCom 2006. LNCS, vol. 3964, pp. 19–38. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  13. Lattner, C., Adve, V.S.: LLVM: A compilation framework for lifelong program analysis & transformation. In: 2nd IEEE/ACM International Symposium on Code Generation and Optimization, pp. 75–88 (2004)

    Google Scholar 

  14. Leroy, X.: Formal verification of a realistic compiler. Commun. ACM 52(7), 107–115 (2009)

    Article  Google Scholar 

  15. Li, N., Offutt, J.: An empirical analysis of test oracle strategies for model-based testing. In: IEEE 7th International Conference on Software Testing, Verification and Validation (April 2014)

    Google Scholar 

  16. Moreira, A.M., Hentz, C., Ramalho, V.: Application of a Syntax-based Testing Method and Tool to Software Product Lines. In: 7th Brazilian Workshop on Systematic and Automated Software Testing, Brasília - DF (2013)

    Google Scholar 

  17. Necula, G.C.: Translation validation for an optimizing compiler. ACM Sigplan Notices 35(5), 83–94 (2000)

    Article  Google Scholar 

  18. Purdom, P.: A sentence generator for testing parsers. BIT Numerical Mathematics 12(4), 366–375 (1972)

    Article  MathSciNet  Google Scholar 

  19. Stuermer, I., Conrad, M., Doerr, H., Pepper, P.: Systematic testing of model-based code generators. IEEE Transactions on Software Engineering 33(9), 622–634 (2007)

    Article  Google Scholar 

  20. Wimmer, M., Burgueño, L.: Testing M2T/T2M transformations. In: Moreira, A., Schätz, B., Gray, J., Vallecillo, A., Clarke, P. (eds.) MODELS 2013. LNCS, vol. 8107, pp. 203–219. Springer, Heidelberg (2013)

    Chapter  Google Scholar 

  21. Zuck, L., Pnueli, A., Fang, Y., Goldberg, B.: VOC: A Methodology for the Translation Validation of Optimizing Compilers. Journal of Universal Computer Science 9(3), 223–247 (2003)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ernesto C. B. de Matos .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Moreira, A.M., Hentz, C., Déharbe, D., de Matos, E.C.B., Neto, J.B.S., de Medeiros, V. (2015). Verifying Code Generation Tools for the B-Method Using Tests: A Case Study. In: Blanchette, J., Kosmatov, N. (eds) Tests and Proofs. TAP 2015. Lecture Notes in Computer Science(), vol 9154. Springer, Cham. https://doi.org/10.1007/978-3-319-21215-9_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-21215-9_5

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-21214-2

  • Online ISBN: 978-3-319-21215-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics