test_objdirs.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ---
  2. -- tests/oven/test_objdirs.lua
  3. -- Test the per-configuration object directory assignments.
  4. -- Copyright (c) 2014-2015 Jason Perkins and the Premake project
  5. ---
  6. local p = premake
  7. local suite = test.declare("oven_objdirs")
  8. local oven = p.oven
  9. ---
  10. -- Setup
  11. ---
  12. local wks, prj
  13. function suite.setup()
  14. wks = workspace("MyWorkspace")
  15. configurations { "Debug", "Release" }
  16. prj = project "MyProject"
  17. end
  18. local function prepare(buildcfg, platform)
  19. cfg = test.getconfig(prj, buildcfg, platform)
  20. end
  21. function suite.singleProject_noPlatforms()
  22. prepare("Debug")
  23. test.isequal(path.getabsolute("obj/Debug"), cfg.objdir)
  24. prepare("Release")
  25. test.isequal(path.getabsolute("obj/Release"), cfg.objdir)
  26. end
  27. function suite.multipleProjects_noPlatforms()
  28. project "MyProject2"
  29. prepare("Debug")
  30. test.createproject(wks)
  31. test.isequal(path.getabsolute("obj/Debug/MyProject"), cfg.objdir)
  32. end
  33. function suite.singleProject_withPlatforms()
  34. platforms { "x86", "x86_64" }
  35. prepare("Debug", "x86")
  36. test.isequal(path.getabsolute("obj/x86/Debug"), cfg.objdir)
  37. end
  38. function suite.singleProject_uniqueByTokens_noPlatforms()
  39. objdir "obj/%{cfg.buildcfg}"
  40. prepare("Debug")
  41. test.isequal(path.getabsolute("obj/Debug"), cfg.objdir)
  42. end
  43. function suite.singleProject_uniqueByTokens_withPlatforms()
  44. platforms { "x86", "x86_64" }
  45. objdir "obj/%{cfg.buildcfg}_%{cfg.platform}"
  46. prepare("Debug", "x86")
  47. test.isequal(path.getabsolute("obj/Debug_x86"), cfg.objdir)
  48. end
  49. function suite.allowOverlap_onPrefixCode()
  50. platforms { "x86", "x86_64" }
  51. objdir "!obj/%{cfg.buildcfg}"
  52. prepare("Debug", "x86")
  53. test.isequal(path.getabsolute("obj/Debug"), cfg.objdir)
  54. end
  55. function suite.allowOverlap_onPrefixCode_withEnvironmentVariable()
  56. platforms { "x86", "x86_64" }
  57. objdir "!$(SolutionDir)/%{cfg.buildcfg}"
  58. prepare("Debug", "x86")
  59. test.isequal("$(SolutionDir)/Debug", cfg.objdir)
  60. end