2012-02-17 00:51:14 +00:00
|
|
|
--
|
|
|
|
-- tests/test_snc.lua
|
|
|
|
-- Automated test suite for the SNC toolset interface.
|
|
|
|
-- Copyright (c) 2012 Jason Perkins and the Premake project
|
|
|
|
--
|
|
|
|
|
|
|
|
T.tools_snc = {}
|
|
|
|
local suite = T.tools_snc
|
|
|
|
|
|
|
|
local snc = premake.tools.snc
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup/teardown
|
|
|
|
--
|
|
|
|
|
|
|
|
local sln, prj, cfg
|
|
|
|
|
|
|
|
function suite.setup()
|
|
|
|
sln, prj = test.createsolution()
|
|
|
|
system "PS3"
|
|
|
|
end
|
|
|
|
|
|
|
|
local function prepare()
|
2013-09-13 15:15:36 +00:00
|
|
|
cfg = premake.project.getconfig(prj, "Debug")
|
2012-02-17 00:51:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-09-28 14:35:13 +00:00
|
|
|
--
|
|
|
|
-- Check the selection of tools based on the target system.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.tools_onDefaults()
|
|
|
|
prepare()
|
|
|
|
test.isnil(snc.gettoolname(cfg, "cc"))
|
|
|
|
test.isnil(snc.gettoolname(cfg, "cxx"))
|
|
|
|
test.isnil(snc.gettoolname(cfg, "ar"))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.tools_onPS3()
|
|
|
|
system "PS3"
|
|
|
|
prepare()
|
|
|
|
test.isnil(snc.gettoolname(cfg, "cc"))
|
|
|
|
test.isnil(snc.gettoolname(cfg, "cxx"))
|
|
|
|
test.isnil(snc.gettoolname(cfg, "ar"))
|
|
|
|
end
|
2013-09-11 14:57:44 +00:00
|
|
|
|
2012-09-28 14:35:13 +00:00
|
|
|
|
2012-02-17 00:51:14 +00:00
|
|
|
--
|
|
|
|
-- By default, the -MMD -MP are used to generate dependencies.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cppflags_defaultWithMMD()
|
|
|
|
prepare()
|
|
|
|
test.isequal({ "-MMD", "-MP" }, snc.getcppflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Check the translation of CFLAGS.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cflags_onFatalWarnings()
|
|
|
|
flags { "FatalWarnings" }
|
|
|
|
prepare()
|
|
|
|
test.isequal({ "-Xquit=2" }, snc.getcflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Turn on exceptions and RTTI by default, to match the other Premake supported toolsets.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cxxflags_onDefault()
|
|
|
|
prepare()
|
|
|
|
test.isequal({ "-Xc+=exceptions", "-Xc+=rtti" }, snc.getcxxflags(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Check the translation of LDFLAGS.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.cflags_onDefaults()
|
|
|
|
prepare()
|
|
|
|
test.isequal({ "-s" }, snc.getldflags(cfg))
|
|
|
|
end
|
2012-02-28 21:15:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Check the formatting of linked libraries.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.links_onSystemLibs()
|
|
|
|
links { "fs_stub", "net_stub" }
|
|
|
|
prepare()
|
|
|
|
test.isequal({ "-lfs_stub", "-lnet_stub" }, snc.getlinks(cfg))
|
|
|
|
end
|
2012-02-28 22:14:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- When linking to a static sibling library, the relative path to the library
|
|
|
|
-- should be used instead of the "-l" flag. This prevents linking against a
|
|
|
|
-- shared library of the same name, should one be present.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.links_onStaticSiblingLibrary()
|
|
|
|
links { "MyProject2" }
|
2012-06-28 19:48:05 +00:00
|
|
|
|
2012-02-28 22:14:28 +00:00
|
|
|
test.createproject(sln)
|
2012-06-28 19:48:05 +00:00
|
|
|
system "Linux"
|
2012-02-28 22:14:28 +00:00
|
|
|
kind "StaticLib"
|
|
|
|
location "MyProject2"
|
|
|
|
targetdir "lib"
|
2012-06-28 19:48:05 +00:00
|
|
|
|
2012-02-28 22:14:28 +00:00
|
|
|
prepare()
|
|
|
|
test.isequal({ "lib/libMyProject2.a" }, snc.getlinks(cfg))
|
|
|
|
end
|
2012-02-29 21:05:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- When linking object files, leave off the "-l".
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.links_onObjectFile()
|
|
|
|
links { "generated.o" }
|
|
|
|
prepare()
|
|
|
|
test.isequal({ "generated.o" }, snc.getlinks(cfg))
|
|
|
|
end
|
|
|
|
|
2012-11-07 14:46:47 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Check handling of forced includes.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.forcedIncludeFiles()
|
|
|
|
forceincludes { "stdafx.h", "include/sys.h" }
|
|
|
|
prepare()
|
2013-09-11 14:57:44 +00:00
|
|
|
test.isequal({'-include stdafx.h', '-include include/sys.h'}, snc.getforceincludes(cfg))
|
2012-11-07 14:46:47 +00:00
|
|
|
end
|