test_clang.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. --
  2. -- tests/test_clang.lua
  3. -- Automated test suite for the GCC toolset interface.
  4. -- Copyright (c) 2009-2013 Jason Perkins and the Premake project
  5. --
  6. local p = premake
  7. local suite = test.declare("tools_clang")
  8. local clang = p.tools.clang
  9. local project = p.project
  10. --
  11. -- Setup/teardown
  12. --
  13. local wks, prj, cfg
  14. function suite.setup()
  15. wks, prj = test.createWorkspace()
  16. system "Linux"
  17. end
  18. local function prepare()
  19. cfg = test.getconfig(prj, "Debug")
  20. end
  21. --
  22. -- Check Mac OS X deployment target flags
  23. --
  24. function suite.cflags_macosx_systemversion()
  25. system "MacOSX"
  26. systemversion "10.9"
  27. prepare()
  28. test.contains({ "-mmacosx-version-min=10.9" }, clang.getcflags(cfg))
  29. end
  30. function suite.cxxflags_macosx_systemversion()
  31. system "MacOSX"
  32. systemversion "10.9"
  33. prepare()
  34. test.contains({ "-mmacosx-version-min=10.9" }, clang.getcxxflags(cfg))
  35. end
  36. function suite.cxxflags_macosx_systemversion_unspecified()
  37. system "MacOSX"
  38. prepare()
  39. test.excludes({ "-mmacosx-version-min=10.9" }, clang.getcxxflags(cfg))
  40. end
  41. --
  42. -- Check iOS deployment target flags
  43. --
  44. function suite.cflags_ios_systemversion()
  45. system "iOS"
  46. systemversion "12.1"
  47. prepare()
  48. test.contains({ "-miphoneos-version-min=12.1" }, clang.getcflags(cfg))
  49. end
  50. function suite.cxxflags_ios_systemversion()
  51. system "iOS"
  52. systemversion "5.0"
  53. prepare()
  54. test.contains({ "-miphoneos-version-min=5.0" }, clang.getcxxflags(cfg))
  55. end