Renormalized line endings in the repository

This commit is contained in:
Nicholaus Clark 2021-06-23 20:03:18 -04:00
parent 88668962a8
commit 076b9684af
14 changed files with 2022 additions and 2022 deletions

View File

@ -1,101 +1,101 @@
# Microsoft Developer Studio Project File - Name="<APPNAME>" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=<APPNAME> - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "<APPNAME>.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "<APPNAME>.mak" CFG="<APPNAME> - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "<APPNAME> - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "<APPNAME> - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "<APPNAME> - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ""
# PROP BASE Intermediate_Dir "temp"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ""
# PROP Intermediate_Dir "temp"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "<APPNAME> - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ""
# PROP BASE Intermediate_Dir "temp"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ""
# PROP Intermediate_Dir "temp"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "<APPNAME> - Win32 Release"
# Name "<APPNAME> - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\programs\<PATHNAME>.c
# ADD CPP /I "../../include"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
# Microsoft Developer Studio Project File - Name="<APPNAME>" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=<APPNAME> - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "<APPNAME>.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "<APPNAME>.mak" CFG="<APPNAME> - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "<APPNAME> - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "<APPNAME> - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "<APPNAME> - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ""
# PROP BASE Intermediate_Dir "temp"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ""
# PROP Intermediate_Dir "temp"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "<APPNAME> - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ""
# PROP BASE Intermediate_Dir "temp"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ""
# PROP Intermediate_Dir "temp"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "<APPNAME> - Win32 Release"
# Name "<APPNAME> - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\programs\<PATHNAME>.c
# ADD CPP /I "../../include"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -1,94 +1,94 @@
# Microsoft Developer Studio Project File - Name="mbedtls" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=mbedtls - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "mbedtls.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "mbedtls.mak" CFG="mbedtls - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mbedtls - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "mbedtls - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "mbedtls - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ""
# PROP BASE Intermediate_Dir "temp"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ""
# PROP Intermediate_Dir "temp"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "mbedtls - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ""
# PROP BASE Intermediate_Dir "temp"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ""
# PROP Intermediate_Dir "temp"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "mbedtls - Win32 Release"
# Name "mbedtls - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
SOURCE_ENTRIES
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
HEADER_ENTRIES
# End Group
# End Target
# End Project
# Microsoft Developer Studio Project File - Name="mbedtls" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=mbedtls - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "mbedtls.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "mbedtls.mak" CFG="mbedtls - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mbedtls - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "mbedtls - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "mbedtls - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ""
# PROP BASE Intermediate_Dir "temp"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ""
# PROP Intermediate_Dir "temp"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "mbedtls - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ""
# PROP BASE Intermediate_Dir "temp"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ""
# PROP Intermediate_Dir "temp"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "mbedtls - Win32 Release"
# Name "mbedtls - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
SOURCE_ENTRIES
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
HEADER_ENTRIES
# End Group
# End Target
# End Project

View File

@ -1,18 +1,18 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
APP_ENTRIES
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
APP_ENTRIES
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@ -1,20 +1,20 @@
@rem Build and test Mbed TLS with Visual Studio using msbuild.
@rem Usage: windows_msbuild [RETARGET]
@rem RETARGET: version of Visual Studio to emulate
@rem https://docs.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset
@rem These parameters are hard-coded for now.
set "arch=x64" & @rem "x86" or "x64"
set "cfg=Release" & @rem "Debug" or "Release"
set "vcvarsall=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
if not "%~1"=="" set "retarget=,PlatformToolset=%1"
@rem If the %USERPROFILE%\Source directory exists, then running
@rem vcvarsall.bat will silently change the directory to that directory.
@rem Setting the VSCMD_START_DIR environment variable causes it to change
@rem to that directory instead.
set "VSCMD_START_DIR=%~dp0\..\visualc\VS2010"
"%vcvarsall%" x64 && ^
msbuild /t:Rebuild /p:Configuration=%cfg%%retarget% /m mbedTLS.sln
@rem Build and test Mbed TLS with Visual Studio using msbuild.
@rem Usage: windows_msbuild [RETARGET]
@rem RETARGET: version of Visual Studio to emulate
@rem https://docs.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset
@rem These parameters are hard-coded for now.
set "arch=x64" & @rem "x86" or "x64"
set "cfg=Release" & @rem "Debug" or "Release"
set "vcvarsall=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
if not "%~1"=="" set "retarget=,PlatformToolset=%1"
@rem If the %USERPROFILE%\Source directory exists, then running
@rem vcvarsall.bat will silently change the directory to that directory.
@rem Setting the VSCMD_START_DIR environment variable causes it to change
@rem to that directory instead.
set "VSCMD_START_DIR=%~dp0\..\visualc\VS2010"
"%vcvarsall%" x64 && ^
msbuild /t:Rebuild /p:Configuration=%cfg%%retarget% /m mbedTLS.sln

View File

@ -1180,8 +1180,8 @@
]]
end
function suite.onCompileAsCppModule()
compileas 'Module'
function suite.onCompileAsCppModule()
compileas 'Module'
prepare()
test.capture [[
<ClCompile>
@ -1193,8 +1193,8 @@
]]
end
function suite.onCompileAsCppModulePartition()
compileas 'ModulePartition'
function suite.onCompileAsCppModulePartition()
compileas 'ModulePartition'
prepare()
test.capture [[
<ClCompile>
@ -1207,7 +1207,7 @@
end
function suite.onCompileAsCppHeaderUnit()
compileas 'HeaderUnit'
compileas 'HeaderUnit'
prepare()
test.capture [[
<ClCompile>

View File

@ -1699,11 +1699,11 @@
m.element("CompileAs", condition, "CompileAsC")
elseif p.languages.iscpp(cfg.compileas) then
m.element("CompileAs", condition, "CompileAsCpp")
elseif cfg.compileas == "Module" then
elseif cfg.compileas == "Module" then
m.element("CompileAs", condition, "CompileAsCppModule")
elseif cfg.compileas == "ModulePartition" then
elseif cfg.compileas == "ModulePartition" then
m.element("CompileAs", condition, "CompileAsCppModuleInternalPartition")
elseif cfg.compileas == "HeaderUnit" then
elseif cfg.compileas == "HeaderUnit" then
m.element("CompileAs", condition, "CompileAsHeaderUnit")
end
end

View File

@ -1,133 +1,133 @@
---
-- xcode/tests/test_xcode4_workspace.lua
-- Validate generation for Xcode workspaces.
-- Author Mihai Sebea
-- Modified by Jason Perkins
-- Copyright (c) 2014-2015 Jason Perkins and the Premake project
---
local suite = test.declare("xcode4_workspace")
local p = premake
local xcode = p.modules.xcode
--
-- Setup
--
local wks, prj
function suite.setup()
_TARGET_OS = "macosx"
p.action.set('xcode4')
wks = test.createWorkspace()
end
local function prepare()
wks = test.getWorkspace(wks)
xcode.generateWorkspace(wks)
end
--
-- Check the basic structure of a workspace.
--
function suite.onEmptyWorkspace()
wks.projects = {}
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
</Workspace>
]]
end
function suite.onDefaultWorkspace()
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:MyProject.xcodeproj">
</FileRef>
</Workspace>
]]
end
function suite.onMultipleProjects()
test.createproject(wks)
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:MyProject.xcodeproj">
</FileRef>
<FileRef
location = "group:MyProject2.xcodeproj">
</FileRef>
</Workspace>
]]
end
function suite.onMultipleProjectsGrouped()
test.createGroup(wks)
test.createproject(wks)
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<Group
location = "container:"
name = "MyGroup1">
<FileRef
location = "group:MyProject2.xcodeproj">
</FileRef>
</Group>
<FileRef
location = "group:MyProject.xcodeproj">
</FileRef>
</Workspace>
]]
end
--
-- Projects should include relative path from workspace.
--
function suite.onNestedProjectPath()
location "MyProject"
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:MyProject/MyProject.xcodeproj">
</FileRef>
</Workspace>
]]
end
function suite.onExternalProjectPath()
location "../MyProject"
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:../MyProject/MyProject.xcodeproj">
</FileRef>
</Workspace>
]]
end
---
-- xcode/tests/test_xcode4_workspace.lua
-- Validate generation for Xcode workspaces.
-- Author Mihai Sebea
-- Modified by Jason Perkins
-- Copyright (c) 2014-2015 Jason Perkins and the Premake project
---
local suite = test.declare("xcode4_workspace")
local p = premake
local xcode = p.modules.xcode
--
-- Setup
--
local wks, prj
function suite.setup()
_TARGET_OS = "macosx"
p.action.set('xcode4')
wks = test.createWorkspace()
end
local function prepare()
wks = test.getWorkspace(wks)
xcode.generateWorkspace(wks)
end
--
-- Check the basic structure of a workspace.
--
function suite.onEmptyWorkspace()
wks.projects = {}
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
</Workspace>
]]
end
function suite.onDefaultWorkspace()
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:MyProject.xcodeproj">
</FileRef>
</Workspace>
]]
end
function suite.onMultipleProjects()
test.createproject(wks)
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:MyProject.xcodeproj">
</FileRef>
<FileRef
location = "group:MyProject2.xcodeproj">
</FileRef>
</Workspace>
]]
end
function suite.onMultipleProjectsGrouped()
test.createGroup(wks)
test.createproject(wks)
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<Group
location = "container:"
name = "MyGroup1">
<FileRef
location = "group:MyProject2.xcodeproj">
</FileRef>
</Group>
<FileRef
location = "group:MyProject.xcodeproj">
</FileRef>
</Workspace>
]]
end
--
-- Projects should include relative path from workspace.
--
function suite.onNestedProjectPath()
location "MyProject"
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:MyProject/MyProject.xcodeproj">
</FileRef>
</Workspace>
]]
end
function suite.onExternalProjectPath()
location "../MyProject"
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:../MyProject/MyProject.xcodeproj">
</FileRef>
</Workspace>
]]
end

View File

@ -1,268 +1,268 @@
---
-- xcode/xcode4_project.lua
-- Generate an Xcode project file.
-- Author Jason Perkins
-- Modified by Mihai Sebea
-- Copyright (c) 2009-2015 Jason Perkins and the Premake project
---
local p = premake
local m = p.modules.xcode
local xcode = p.modules.xcode
local project = p.project
local config = p.config
local fileconfig = p.fileconfig
local tree = p.tree
--
-- Checks if a node must be excluded completely from a target or not. It will
-- return true only if the node has the "ExcludeFromBuild" flag in all the
-- configurations.
--
-- @param node
-- The node to check.
-- @param prj
-- The project being generated.
-- @returns
-- A boolean, telling whether the node must be excluded from its target or not.
--
function xcode.mustExcludeFromTarget(node, prj)
if not node.configs then
return false
end
local value
for cfg in premake.project.eachconfig(prj) do
local filecfg = premake.fileconfig.getconfig(node, cfg)
if filecfg then
local newValue = not not filecfg.flags.ExcludeFromBuild
if value == nil then
value = newValue
elseif value ~= newValue then
p.warn(node.name .. " is excluded in just some configurations. Autocompletion will not work correctly on this file in Xcode.")
return false
end
end
end
return value
end
--
-- Create a tree corresponding to what is shown in the Xcode project browser
-- pane, with nodes for files and folders, resources, frameworks, and products.
--
-- @param prj
-- The project being generated.
-- @returns
-- A tree, loaded with metadata, which mirrors Xcode's view of the project.
--
function xcode.buildprjtree(prj)
local tr = project.getsourcetree(prj, nil , false)
tr.project = prj
-- create a list of build configurations and assign IDs
tr.configs = {}
for cfg in project.eachconfig(prj) do
cfg.xcode = {}
cfg.xcode.targetid = xcode.newid(prj.xcode.projectnode.name, cfg.buildcfg, "target")
cfg.xcode.projectid = xcode.newid(tr.name, cfg.buildcfg)
table.insert(tr.configs, cfg)
end
-- convert localized resources from their filesystem layout (English.lproj/MainMenu.xib)
-- to Xcode's display layout (MainMenu.xib/English).
tree.traverse(tr, {
onbranch = function(node)
if path.getextension(node.name) == ".lproj" then
local lang = path.getbasename(node.name) -- "English", "French", etc.
-- create a new language group for each file it contains
for _, filenode in ipairs(node.children) do
local grpnode = node.parent.children[filenode.name]
if not grpnode then
grpnode = tree.insert(node.parent, tree.new(filenode.name))
grpnode.kind = "vgroup"
end
-- convert the file node to a language node and add to the group
filenode.name = path.getbasename(lang)
tree.insert(grpnode, filenode)
end
-- remove this directory from the tree
tree.remove(node)
end
end
})
-- the special folder "Frameworks" lists all linked frameworks
tr.frameworks = tree.new("Frameworks")
for cfg in project.eachconfig(prj) do
for _, link in ipairs(config.getlinks(cfg, "system", "fullpath")) do
local name = path.getname(link)
if xcode.isframeworkordylib(name) and not tr.frameworks.children[name] then
node = tree.insert(tr.frameworks, tree.new(name))
node.path = link
end
end
end
-- only add it to the tree if there are frameworks to link
if #tr.frameworks.children > 0 then
tree.insert(tr, tr.frameworks)
end
-- the special folder "Products" holds the target produced by the project; this
-- is populated below
tr.products = tree.insert(tr, tree.new("Products"))
-- the special folder "Projects" lists sibling project dependencies
tr.projects = tree.new("Projects")
for _, dep in ipairs(project.getdependencies(prj, "linkOnly")) do
xcode.addDependency(prj, tr, dep, true)
end
for _, dep in ipairs(project.getdependencies(prj, "dependOnly")) do
xcode.addDependency(prj, tr, dep, false)
end
if #tr.projects.children > 0 then
tree.insert(tr, tr.projects)
end
-- Final setup
tree.traverse(tr, {
onnode = function(node)
local nodePath
if node.path then
nodePath = path.getrelative(tr.project.location, node.path)
end
-- assign IDs to every node in the tree
node.id = xcode.newid(node.name, nil, nodePath)
node.isResource = xcode.isItemResource(prj, node)
-- check to see if this file has custom build
if node.configs then
for cfg in project.eachconfig(prj) do
local filecfg = fileconfig.getconfig(node, cfg)
if fileconfig.hasCustomBuildRule(filecfg) then
if not node.buildcommandid then
node.buildcommandid = xcode.newid(node.name, "buildcommand", nodePath)
end
end
end
end
-- assign build IDs to buildable files
if xcode.getbuildcategory(node) and not node.excludefrombuild and not xcode.mustExcludeFromTarget(node, tr.project) then
node.buildid = xcode.newid(node.name, "build", nodePath)
if xcode.shouldembed(tr, node) then
node.embedid = xcode.newid(node.name, "embed", nodepath)
end
end
-- remember key files that are needed elsewhere
if string.endswith(node.name, "Info.plist") then
tr.infoplist = node
end
end
}, true)
-- Plug in the product node into the Products folder in the tree. The node
-- was built in xcode.prepareWorkspace() in xcode_common.lua; it contains IDs
-- that are necessary for inter-project dependencies
node = tree.insert(tr.products, prj.xcode.projectnode)
node.kind = "product"
node.path = node.cfg.buildtarget.fullpath
node.cfgsection = xcode.newid(node.name, "cfg")
node.resstageid = xcode.newid(node.name, "rez")
node.sourcesid = xcode.newid(node.name, "src")
node.fxstageid = xcode.newid(node.name, "fxs")
node.embedstageid = xcode.newid(node.name, "embed")
return tr
end
function xcode.addDependency(prj, tr, dep, build)
-- create a child node for the dependency's xcodeproj
local xcpath = xcode.getxcodeprojname(dep)
local xcnode = tree.insert(tr.projects, tree.new(path.getname(xcpath)))
xcnode.path = xcpath
xcnode.project = dep
xcnode.productgroupid = xcode.newid(xcnode.name, "prodgrp")
xcnode.productproxyid = xcode.newid(xcnode.name, "prodprox")
xcnode.targetproxyid = xcode.newid(xcnode.name, "targprox")
xcnode.targetdependid = xcode.newid(xcnode.name, "targdep")
-- create a grandchild node for the dependency's link target
local lprj = p.workspace.findproject(prj.workspace, dep.name)
local cfg = project.findClosestMatch(lprj, prj.configurations[1])
node = tree.insert(xcnode, tree.new(cfg.linktarget.name))
node.path = cfg.linktarget.fullpath
node.cfg = cfg
-- don't link the dependency if it's a dependency only
if build == false then
node.excludefrombuild = true
end
end
---
-- Generate an Xcode .xcodeproj for a Premake project.
---
m.elements.project = function(prj)
return {
m.header,
}
end
function m.generateProject(prj)
local tr = xcode.buildprjtree(prj)
p.callArray(m.elements.project, prj)
xcode.PBXBuildFile(tr)
xcode.PBXContainerItemProxy(tr)
xcode.PBXFileReference(tr)
xcode.PBXFrameworksBuildPhase(tr)
xcode.PBXCopyFilesBuildPhaseForEmbedFrameworks(tr)
xcode.PBXGroup(tr)
xcode.PBXNativeTarget(tr)
xcode.PBXAggregateTarget(tr)
xcode.PBXProject(tr)
xcode.PBXReferenceProxy(tr)
xcode.PBXResourcesBuildPhase(tr)
xcode.PBXShellScriptBuildPhase(tr)
xcode.PBXSourcesBuildPhase(tr)
xcode.PBXTargetDependency(tr)
xcode.PBXVariantGroup(tr)
xcode.XCBuildConfiguration(tr)
xcode.XCBuildConfigurationList(tr)
xcode.footer(prj)
end
function m.header(prj)
p.w('// !$*UTF8*$!')
p.push('{')
p.w('archiveVersion = 1;')
p.w('classes = {')
p.w('};')
p.w('objectVersion = 46;')
p.push('objects = {')
p.w()
end
function xcode.footer(prj)
p.pop('};')
p.w('rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;')
p.pop('}')
end
---
-- xcode/xcode4_project.lua
-- Generate an Xcode project file.
-- Author Jason Perkins
-- Modified by Mihai Sebea
-- Copyright (c) 2009-2015 Jason Perkins and the Premake project
---
local p = premake
local m = p.modules.xcode
local xcode = p.modules.xcode
local project = p.project
local config = p.config
local fileconfig = p.fileconfig
local tree = p.tree
--
-- Checks if a node must be excluded completely from a target or not. It will
-- return true only if the node has the "ExcludeFromBuild" flag in all the
-- configurations.
--
-- @param node
-- The node to check.
-- @param prj
-- The project being generated.
-- @returns
-- A boolean, telling whether the node must be excluded from its target or not.
--
function xcode.mustExcludeFromTarget(node, prj)
if not node.configs then
return false
end
local value
for cfg in premake.project.eachconfig(prj) do
local filecfg = premake.fileconfig.getconfig(node, cfg)
if filecfg then
local newValue = not not filecfg.flags.ExcludeFromBuild
if value == nil then
value = newValue
elseif value ~= newValue then
p.warn(node.name .. " is excluded in just some configurations. Autocompletion will not work correctly on this file in Xcode.")
return false
end
end
end
return value
end
--
-- Create a tree corresponding to what is shown in the Xcode project browser
-- pane, with nodes for files and folders, resources, frameworks, and products.
--
-- @param prj
-- The project being generated.
-- @returns
-- A tree, loaded with metadata, which mirrors Xcode's view of the project.
--
function xcode.buildprjtree(prj)
local tr = project.getsourcetree(prj, nil , false)
tr.project = prj
-- create a list of build configurations and assign IDs
tr.configs = {}
for cfg in project.eachconfig(prj) do
cfg.xcode = {}
cfg.xcode.targetid = xcode.newid(prj.xcode.projectnode.name, cfg.buildcfg, "target")
cfg.xcode.projectid = xcode.newid(tr.name, cfg.buildcfg)
table.insert(tr.configs, cfg)
end
-- convert localized resources from their filesystem layout (English.lproj/MainMenu.xib)
-- to Xcode's display layout (MainMenu.xib/English).
tree.traverse(tr, {
onbranch = function(node)
if path.getextension(node.name) == ".lproj" then
local lang = path.getbasename(node.name) -- "English", "French", etc.
-- create a new language group for each file it contains
for _, filenode in ipairs(node.children) do
local grpnode = node.parent.children[filenode.name]
if not grpnode then
grpnode = tree.insert(node.parent, tree.new(filenode.name))
grpnode.kind = "vgroup"
end
-- convert the file node to a language node and add to the group
filenode.name = path.getbasename(lang)
tree.insert(grpnode, filenode)
end
-- remove this directory from the tree
tree.remove(node)
end
end
})
-- the special folder "Frameworks" lists all linked frameworks
tr.frameworks = tree.new("Frameworks")
for cfg in project.eachconfig(prj) do
for _, link in ipairs(config.getlinks(cfg, "system", "fullpath")) do
local name = path.getname(link)
if xcode.isframeworkordylib(name) and not tr.frameworks.children[name] then
node = tree.insert(tr.frameworks, tree.new(name))
node.path = link
end
end
end
-- only add it to the tree if there are frameworks to link
if #tr.frameworks.children > 0 then
tree.insert(tr, tr.frameworks)
end
-- the special folder "Products" holds the target produced by the project; this
-- is populated below
tr.products = tree.insert(tr, tree.new("Products"))
-- the special folder "Projects" lists sibling project dependencies
tr.projects = tree.new("Projects")
for _, dep in ipairs(project.getdependencies(prj, "linkOnly")) do
xcode.addDependency(prj, tr, dep, true)
end
for _, dep in ipairs(project.getdependencies(prj, "dependOnly")) do
xcode.addDependency(prj, tr, dep, false)
end
if #tr.projects.children > 0 then
tree.insert(tr, tr.projects)
end
-- Final setup
tree.traverse(tr, {
onnode = function(node)
local nodePath
if node.path then
nodePath = path.getrelative(tr.project.location, node.path)
end
-- assign IDs to every node in the tree
node.id = xcode.newid(node.name, nil, nodePath)
node.isResource = xcode.isItemResource(prj, node)
-- check to see if this file has custom build
if node.configs then
for cfg in project.eachconfig(prj) do
local filecfg = fileconfig.getconfig(node, cfg)
if fileconfig.hasCustomBuildRule(filecfg) then
if not node.buildcommandid then
node.buildcommandid = xcode.newid(node.name, "buildcommand", nodePath)
end
end
end
end
-- assign build IDs to buildable files
if xcode.getbuildcategory(node) and not node.excludefrombuild and not xcode.mustExcludeFromTarget(node, tr.project) then
node.buildid = xcode.newid(node.name, "build", nodePath)
if xcode.shouldembed(tr, node) then
node.embedid = xcode.newid(node.name, "embed", nodepath)
end
end
-- remember key files that are needed elsewhere
if string.endswith(node.name, "Info.plist") then
tr.infoplist = node
end
end
}, true)
-- Plug in the product node into the Products folder in the tree. The node
-- was built in xcode.prepareWorkspace() in xcode_common.lua; it contains IDs
-- that are necessary for inter-project dependencies
node = tree.insert(tr.products, prj.xcode.projectnode)
node.kind = "product"
node.path = node.cfg.buildtarget.fullpath
node.cfgsection = xcode.newid(node.name, "cfg")
node.resstageid = xcode.newid(node.name, "rez")
node.sourcesid = xcode.newid(node.name, "src")
node.fxstageid = xcode.newid(node.name, "fxs")
node.embedstageid = xcode.newid(node.name, "embed")
return tr
end
function xcode.addDependency(prj, tr, dep, build)
-- create a child node for the dependency's xcodeproj
local xcpath = xcode.getxcodeprojname(dep)
local xcnode = tree.insert(tr.projects, tree.new(path.getname(xcpath)))
xcnode.path = xcpath
xcnode.project = dep
xcnode.productgroupid = xcode.newid(xcnode.name, "prodgrp")
xcnode.productproxyid = xcode.newid(xcnode.name, "prodprox")
xcnode.targetproxyid = xcode.newid(xcnode.name, "targprox")
xcnode.targetdependid = xcode.newid(xcnode.name, "targdep")
-- create a grandchild node for the dependency's link target
local lprj = p.workspace.findproject(prj.workspace, dep.name)
local cfg = project.findClosestMatch(lprj, prj.configurations[1])
node = tree.insert(xcnode, tree.new(cfg.linktarget.name))
node.path = cfg.linktarget.fullpath
node.cfg = cfg
-- don't link the dependency if it's a dependency only
if build == false then
node.excludefrombuild = true
end
end
---
-- Generate an Xcode .xcodeproj for a Premake project.
---
m.elements.project = function(prj)
return {
m.header,
}
end
function m.generateProject(prj)
local tr = xcode.buildprjtree(prj)
p.callArray(m.elements.project, prj)
xcode.PBXBuildFile(tr)
xcode.PBXContainerItemProxy(tr)
xcode.PBXFileReference(tr)
xcode.PBXFrameworksBuildPhase(tr)
xcode.PBXCopyFilesBuildPhaseForEmbedFrameworks(tr)
xcode.PBXGroup(tr)
xcode.PBXNativeTarget(tr)
xcode.PBXAggregateTarget(tr)
xcode.PBXProject(tr)
xcode.PBXReferenceProxy(tr)
xcode.PBXResourcesBuildPhase(tr)
xcode.PBXShellScriptBuildPhase(tr)
xcode.PBXSourcesBuildPhase(tr)
xcode.PBXTargetDependency(tr)
xcode.PBXVariantGroup(tr)
xcode.XCBuildConfiguration(tr)
xcode.XCBuildConfigurationList(tr)
xcode.footer(prj)
end
function m.header(prj)
p.w('// !$*UTF8*$!')
p.push('{')
p.w('archiveVersion = 1;')
p.w('classes = {')
p.w('};')
p.w('objectVersion = 46;')
p.push('objects = {')
p.w()
end
function xcode.footer(prj)
p.pop('};')
p.w('rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;')
p.pop('}')
end

View File

@ -185,9 +185,9 @@
"C++",
"Objective-C",
"Objective-C++",
"Module",
"ModulePartition",
"HeaderUnit"
"Module",
"ModulePartition",
"HeaderUnit"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,30 @@
/**
* \file os_is64bit.c
* \brief Native code-side checking for a 64-bit architecture.
* \author Copyright (c) 2011 Jason Perkins and the Premake project
*/
#include "premake.h"
int os_is64bit(lua_State* L)
{
// If this code returns true, then the platform is 64-bit. If it
// returns false, the platform might still be 64-bit, but more
// checking will need to be done on the Lua side of things.
#if PLATFORM_WINDOWS
typedef BOOL (WINAPI* WowFuncSig)(HANDLE, PBOOL);
WowFuncSig func = (WowFuncSig)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
if (func)
{
BOOL isWow = FALSE;
if (func(GetCurrentProcess(), &isWow))
{
lua_pushboolean(L, isWow);
return 1;
}
}
#endif
lua_pushboolean(L, 0);
return 1;
}
/**
* \file os_is64bit.c
* \brief Native code-side checking for a 64-bit architecture.
* \author Copyright (c) 2011 Jason Perkins and the Premake project
*/
#include "premake.h"
int os_is64bit(lua_State* L)
{
// If this code returns true, then the platform is 64-bit. If it
// returns false, the platform might still be 64-bit, but more
// checking will need to be done on the Lua side of things.
#if PLATFORM_WINDOWS
typedef BOOL (WINAPI* WowFuncSig)(HANDLE, PBOOL);
WowFuncSig func = (WowFuncSig)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
if (func)
{
BOOL isWow = FALSE;
if (func(GetCurrentProcess(), &isWow))
{
lua_pushboolean(L, isWow);
return 1;
}
}
#endif
lua_pushboolean(L, 0);
return 1;
}

View File

@ -1,66 +1,66 @@
return {
-- Base API tests
"test_string.lua",
"base/test_aliasing.lua",
"base/test_binmodules.lua",
"base/test_configset.lua",
"base/test_context.lua",
"base/test_criteria.lua",
"base/test_detoken.lua",
"base/test_include.lua",
"base/test_module_loader.lua",
"base/test_option.lua",
"base/test_os.lua",
"base/test_override.lua",
"base/test_path.lua",
"base/test_premake_command.lua",
"base/test_table.lua",
"base/test_tree.lua",
"base/test_uuid.lua",
"base/test_versions.lua",
"base/test_http.lua",
"base/test_json.lua",
-- Workspace object tests
"workspace/test_eachconfig.lua",
"workspace/test_location.lua",
"workspace/test_objdirs.lua",
-- Project object tests
"project/test_config_maps.lua",
"project/test_eachconfig.lua",
"project/test_getconfig.lua",
"project/test_location.lua",
"project/test_sources.lua",
"project/test_vpaths.lua",
-- Configuration object tests
"config/test_linkinfo.lua",
"config/test_links.lua",
"config/test_targetinfo.lua",
-- Baking tests
"oven/test_filtering.lua",
"oven/test_objdirs.lua",
-- API tests
"api/test_boolean_kind.lua",
"api/test_containers.lua",
"api/test_directory_kind.lua",
"api/test_list_kind.lua",
"api/test_path_kind.lua",
"api/test_register.lua",
"api/test_string_kind.lua",
"api/test_table_kind.lua",
"api/test_deprecations.lua",
-- Control system tests
"test_premake.lua",
"base/test_validation.lua",
-- -- Toolset tests
"tools/test_dotnet.lua",
"tools/test_gcc.lua",
"tools/test_clang.lua",
"tools/test_msc.lua",
}
return {
-- Base API tests
"test_string.lua",
"base/test_aliasing.lua",
"base/test_binmodules.lua",
"base/test_configset.lua",
"base/test_context.lua",
"base/test_criteria.lua",
"base/test_detoken.lua",
"base/test_include.lua",
"base/test_module_loader.lua",
"base/test_option.lua",
"base/test_os.lua",
"base/test_override.lua",
"base/test_path.lua",
"base/test_premake_command.lua",
"base/test_table.lua",
"base/test_tree.lua",
"base/test_uuid.lua",
"base/test_versions.lua",
"base/test_http.lua",
"base/test_json.lua",
-- Workspace object tests
"workspace/test_eachconfig.lua",
"workspace/test_location.lua",
"workspace/test_objdirs.lua",
-- Project object tests
"project/test_config_maps.lua",
"project/test_eachconfig.lua",
"project/test_getconfig.lua",
"project/test_location.lua",
"project/test_sources.lua",
"project/test_vpaths.lua",
-- Configuration object tests
"config/test_linkinfo.lua",
"config/test_links.lua",
"config/test_targetinfo.lua",
-- Baking tests
"oven/test_filtering.lua",
"oven/test_objdirs.lua",
-- API tests
"api/test_boolean_kind.lua",
"api/test_containers.lua",
"api/test_directory_kind.lua",
"api/test_list_kind.lua",
"api/test_path_kind.lua",
"api/test_register.lua",
"api/test_string_kind.lua",
"api/test_table_kind.lua",
"api/test_deprecations.lua",
-- Control system tests
"test_premake.lua",
"base/test_validation.lua",
-- -- Toolset tests
"tools/test_dotnet.lua",
"tools/test_gcc.lua",
"tools/test_clang.lua",
"tools/test_msc.lua",
}

View File

@ -1,484 +1,484 @@
---
-- tests/base/test_os.lua
-- Automated test suite for the new OS functions.
-- Copyright (c) 2008-2017 Jason Perkins and the Premake project
---
local suite = test.declare("base_os")
local cwd
function suite.setup()
cwd = os.getcwd()
os.chdir(_TESTS_DIR)
end
function suite.teardown()
os.chdir(cwd)
end
--
-- os.findlib() tests
--
function suite.findlib_FindSystemLib()
if os.istarget("windows") then
test.istrue(os.findlib("user32"))
elseif os.istarget("haiku") then
test.istrue(os.findlib("root"))
else
test.istrue(os.findlib("m"))
end
end
function suite.findlib_FailsOnBadLibName()
test.isfalse(os.findlib("NoSuchLibraryAsThisOneHere"))
end
function suite.findheader_stdheaders()
if not os.istarget("windows") and not os.istarget("macosx") then
test.istrue(os.findheader("stdlib.h"))
end
end
function suite.findheader_failure()
test.isfalse(os.findheader("Knights/who/say/Ni.hpp"))
end
--
-- os.isfile() tests
--
function suite.isfile_ReturnsTrue_OnExistingFile()
test.istrue(os.isfile("_tests.lua"))
end
function suite.isfile_ReturnsFalse_OnNonexistantFile()
test.isfalse(os.isfile("no_such_file.lua"))
end
--
-- os.matchdirs() tests
--
function suite.matchdirs_skipsDottedDirs()
local result = os.matchdirs("*")
test.isfalse(table.contains(result, ".."))
end
--
-- os.matchfiles() tests
--
function suite.matchfiles_OnNonRecursive()
local result = os.matchfiles("*.lua")
test.istrue(table.contains(result, "_tests.lua"))
test.isfalse(table.contains(result, "folder/ok.lua"))
end
function suite.matchfiles_Recursive()
local result = os.matchfiles("**.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
end
function suite.matchfiles_SkipsDotDirs_OnRecursive()
local result = os.matchfiles("**.lua")
test.isfalse(table.contains(result, ".svn/text-base/testfx.lua.svn-base"))
end
function suite.matchfiles_OnSubfolderMatch()
local result = os.matchfiles("**/subfolder/*")
test.istrue(table.contains(result, "folder/subfolder/hello.txt"))
test.isfalse(table.contains(result, "premake4.lua"))
end
function suite.matchfiles_OnDotSlashPrefix()
local result = os.matchfiles("./**.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
end
function suite.matchfiles_OnImplicitEndOfString()
local result = os.matchfiles("folder/*.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
test.isfalse(table.contains(result, "folder/ok.lua.2"))
end
function suite.matchfiles_OnLeadingDotSlashWithPath()
local result = os.matchfiles("./folder/*.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
end
function suite.matchfiles_OnDottedFile()
local result = os.matchfiles("base/.*")
test.istrue(table.contains(result, "base/.testDotFile"))
end
function suite.matchfiles_onComboSearch()
local result = os.matchfiles("folder/**/*.txt")
test.istrue(table.contains(result, "folder/subfolder/hello.txt"))
end
function suite.matchfiles_onSymbolicLink()
if os.istarget("macosx")
or os.istarget("linux")
or os.istarget("solaris")
or os.istarget("bsd")
then
os.execute("cd folder && ln -s subfolder symlinkfolder && cd ..")
local result = os.matchfiles("folder/**/*.txt")
os.execute("rm folder/symlinkfolder")
premake.modules.self_test.print(table.tostring(result))
test.istrue(table.contains(result, "folder/symlinkfolder/hello.txt"))
end
end
--
-- os.pathsearch() tests
--
function suite.pathsearch_ReturnsNil_OnNotFound()
test.istrue(os.pathsearch("nosuchfile", "aaa;bbb;ccc") == nil)
end
function suite.pathsearch_ReturnsPath_OnFound()
test.isequal(_TESTS_DIR, os.pathsearch("_tests.lua", _TESTS_DIR))
end
function suite.pathsearch_FindsFile_OnComplexPath()
test.isequal(_TESTS_DIR, os.pathsearch("_tests.lua", "aaa;" .. _TESTS_DIR .. ";bbb"))
end
function suite.pathsearch_NilPathsAllowed()
test.isequal(_TESTS_DIR, os.pathsearch("_tests.lua", nil, _TESTS_DIR, nil))
end
--
-- os.outputof() tests
--
-- Check if outputof returns the command exit code
-- in addition of the command output
function suite.outputof_commandExitCode()
if os.istarget("macosx")
or os.istarget("linux")
or os.istarget("solaris")
or os.istarget("bsd")
then
-- Assumes 'true' and 'false' commands exist
-- which should be the case on all *nix platforms
for cmd, exitcode in pairs ({
["true"] = 0,
["false"] = 1
})
do
local o, e = os.outputof(cmd)
test.isequal(e, exitcode)
end
end
end
-- Check outputof content
function suite.outputof_streams_output()
if (os.istarget("macosx")
or os.istarget("linux")
or os.istarget("solaris")
or os.istarget("bsd"))
and os.isdir (_TESTS_DIR)
then
local ob, e = os.outputof ("ls " .. _TESTS_DIR .. "/base")
local oo, e = os.outputof ("ls " .. _TESTS_DIR .. "/base", "output")
test.isequal (oo, ob)
local s, e = string.find (oo, "test_os.lua")
test.istrue(s ~= nil)
local o, e = os.outputof ("ls " .. cwd .. "/base", "error")
test.istrue(o == nil or #o == 0)
end
end
--
-- os.translateCommand() tests
--
function suite.translateCommand_onNoToken()
test.isequal("cp a b", os.translateCommands("cp a b"))
end
function suite.translateCommand_callsProcessor()
os.commandTokens.test = {
copy = function(value) return "test " .. value end
}
test.isequal("test a b", os.translateCommands("{COPY} a b", "test"))
end
function suite.translateCommand_callsProcessor_multipleTokens()
os.commandTokens.test = {
copy = function(value) return "test " .. value end
}
test.isequal("test a b; test c d; test e f;", os.translateCommands("{COPY} a b; {COPY} c d; {COPY} e f;", "test"))
end
--
-- os.translateCommand() windows COPY tests
--
function suite.translateCommand_windowsCopyNoDst()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a > nul) ELSE (xcopy /Q /Y /I a > nul)', os.translateCommands('{COPY} a', "windows"))
end
function suite.translateCommand_windowsCopyNoDst_ExtraSpace()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a > nul) ELSE (xcopy /Q /Y /I a > nul)', os.translateCommands('{COPY} a ', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotes()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a b > nul) ELSE (xcopy /Q /Y /I a b > nul)', os.translateCommands('{COPY} a b', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotes_ExtraSpace()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a b > nul) ELSE (xcopy /Q /Y /I a b > nul)', os.translateCommands('{COPY} a b ', "windows"))
end
function suite.translateCommand_windowsCopyQuotes()
test.isequal('IF EXIST "a a"\\ (xcopy /Q /E /Y /I "a a" "b" > nul) ELSE (xcopy /Q /Y /I "a a" "b" > nul)', os.translateCommands('{COPY} "a a" "b"', "windows"))
end
function suite.translateCommand_windowsCopyQuotes_ExtraSpace()
test.isequal('IF EXIST "a a"\\ (xcopy /Q /E /Y /I "a a" "b" > nul) ELSE (xcopy /Q /Y /I "a a" "b" > nul)', os.translateCommands('{COPY} "a a" "b" ', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotesDst()
test.isequal('IF EXIST "a a"\\ (xcopy /Q /E /Y /I "a a" b > nul) ELSE (xcopy /Q /Y /I "a a" b > nul)', os.translateCommands('{COPY} "a a" b', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotesDst_ExtraSpace()
test.isequal('IF EXIST "a a"\\ (xcopy /Q /E /Y /I "a a" b > nul) ELSE (xcopy /Q /Y /I "a a" b > nul)', os.translateCommands('{COPY} "a a" b ', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotesSrc()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a "b" > nul) ELSE (xcopy /Q /Y /I a "b" > nul)', os.translateCommands('{COPY} a "b"', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotesSrc_ExtraSpace()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a "b" > nul) ELSE (xcopy /Q /Y /I a "b" > nul)', os.translateCommands('{COPY} a "b" ', "windows"))
end
--
-- os.getWindowsRegistry windows tests
--
function suite.getreg_nonExistentValue()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKCU:Should\\Not\\Exist\\At\\All")
test.isequal(nil, x)
end
end
function suite.getreg_nonExistentDefaultValue()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKCU:Should\\Not\\Exist\\At\\All\\")
test.isequal(nil, x)
end
end
function suite.getreg_noSeparators()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKCU:ShouldNotExistAtAll")
test.isequal(nil, x)
end
end
function suite.getreg_namedValue()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKCU:Environment\\TEMP")
test.istrue(x ~= nil)
end
end
function suite.getreg_namedValueOptSeparator()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKCU:\\Environment\\TEMP")
test.istrue(x ~= nil)
end
end
function suite.getreg_defaultValue()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKLM:SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Minimal\\AppInfo\\")
test.isequal("Service", x)
end
end
--
-- os.listWindowsRegistry windows tests
--
function suite.listreg_nonExistentKey()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:Should\\Not\\Exist\\At\\All")
test.isequal(nil, x)
end
end
function suite.listreg_nonExistentKeyTrailingBackslash()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:Should\\Not\\Exist\\At\\All\\")
test.isequal(nil, x)
end
end
function suite.listreg_noSeparators()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:ShouldNotExistAtAll")
test.isequal(nil, x)
end
end
function suite.listreg_noSeparatorExistingPath()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:Environment")
test.istrue(x ~= nil and x["TEMP"] ~= nil)
end
end
function suite.listreg_optSeparators()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:\\Environment\\")
test.istrue(x ~= nil and x["TEMP"] ~= nil)
end
end
function suite.listreg_keyDefaultValueAndStringValueFormat()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKLM:SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Minimal\\AppInfo")
test.isequal(x[""]["value"], "Service")
test.isequal(x[""]["type"], "REG_SZ")
end
end
function suite.listreg_numericValueFormat()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:Console")
test.isequal(type(x["FullScreen"]["value"]), "number")
test.isequal(x["FullScreen"]["type"], "REG_DWORD")
end
end
function suite.listreg_subkeyFormat()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKLM:")
test.isequal(type(x["SOFTWARE"]), "table")
test.isequal(next(x["SOFTWARE"]), nil)
end
end
--
-- os.getversion tests.
--
function suite.getversion()
local version = os.getversion();
test.istrue(version ~= nil)
end
--
-- os.translateCommandsAndPaths.
--
function suite.translateCommandsAndPaths()
test.isequal('cmdtool "../foo/path1"', os.translateCommandsAndPaths("cmdtool %[path1]", '../foo', '.', 'osx'))
end
function suite.translateCommandsAndPaths_PreserveSlash()
test.isequal('cmdtool "../foo/path1/"', os.translateCommandsAndPaths("cmdtool %[path1/]", '../foo', '.', 'osx'))
end
function suite.translateCommandsAndPaths_MultipleTokens()
test.isequal('cmdtool "../foo/path1" "../foo/path2/"', os.translateCommandsAndPaths("cmdtool %[path1] %[path2/]", '../foo', '.', 'osx'))
end
--
-- Helpers
--
local tmpname = function()
local p = os.tmpname()
os.remove(p) -- just needed on POSIX
return p
end
local tmpfile = function()
local p = tmpname()
if os.ishost("windows") then
os.execute("type nul >" .. p)
else
os.execute("touch " .. p)
end
return p
end
local tmpdir = function()
local p = tmpname()
os.mkdir(p)
return p
end
--
-- os.remove() tests.
--
function suite.remove_ReturnsError_OnNonExistingPath()
local ok, err, exitcode = os.remove(tmpname())
test.isnil(ok)
test.isequal("string", type(err))
test.isequal("number", type(exitcode))
test.istrue(0 ~= exitcode)
end
function suite.remove_ReturnsError_OnDirectory()
local ok, err, exitcode = os.remove(tmpdir())
test.isnil(ok)
test.isequal("string", type(err))
test.isequal("number", type(exitcode))
test.istrue(0 ~= exitcode)
end
function suite.remove_ReturnsTrue_OnFile()
local ok, err, exitcode = os.remove(tmpfile())
test.isequal(true, ok)
test.isnil(err)
test.isnil(exitcode)
end
--
-- os.rmdir() tests.
--
function suite.rmdir_ReturnsError_OnNonExistingPath()
local ok, err = os.rmdir(tmpname())
test.isnil(ok)
test.isequal("string", type(err))
end
function suite.rmdir_ReturnsError_OnFile()
local ok, err = os.rmdir(tmpfile())
test.isnil(ok)
test.isequal("string", type(err))
end
function suite.rmdir_ReturnsTrue_OnDirectory()
local ok, err = os.rmdir(tmpdir())
test.isequal(true, ok)
test.isnil(err)
end
---
-- tests/base/test_os.lua
-- Automated test suite for the new OS functions.
-- Copyright (c) 2008-2017 Jason Perkins and the Premake project
---
local suite = test.declare("base_os")
local cwd
function suite.setup()
cwd = os.getcwd()
os.chdir(_TESTS_DIR)
end
function suite.teardown()
os.chdir(cwd)
end
--
-- os.findlib() tests
--
function suite.findlib_FindSystemLib()
if os.istarget("windows") then
test.istrue(os.findlib("user32"))
elseif os.istarget("haiku") then
test.istrue(os.findlib("root"))
else
test.istrue(os.findlib("m"))
end
end
function suite.findlib_FailsOnBadLibName()
test.isfalse(os.findlib("NoSuchLibraryAsThisOneHere"))
end
function suite.findheader_stdheaders()
if not os.istarget("windows") and not os.istarget("macosx") then
test.istrue(os.findheader("stdlib.h"))
end
end
function suite.findheader_failure()
test.isfalse(os.findheader("Knights/who/say/Ni.hpp"))
end
--
-- os.isfile() tests
--
function suite.isfile_ReturnsTrue_OnExistingFile()
test.istrue(os.isfile("_tests.lua"))
end
function suite.isfile_ReturnsFalse_OnNonexistantFile()
test.isfalse(os.isfile("no_such_file.lua"))
end
--
-- os.matchdirs() tests
--
function suite.matchdirs_skipsDottedDirs()
local result = os.matchdirs("*")
test.isfalse(table.contains(result, ".."))
end
--
-- os.matchfiles() tests
--
function suite.matchfiles_OnNonRecursive()
local result = os.matchfiles("*.lua")
test.istrue(table.contains(result, "_tests.lua"))
test.isfalse(table.contains(result, "folder/ok.lua"))
end
function suite.matchfiles_Recursive()
local result = os.matchfiles("**.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
end
function suite.matchfiles_SkipsDotDirs_OnRecursive()
local result = os.matchfiles("**.lua")
test.isfalse(table.contains(result, ".svn/text-base/testfx.lua.svn-base"))
end
function suite.matchfiles_OnSubfolderMatch()
local result = os.matchfiles("**/subfolder/*")
test.istrue(table.contains(result, "folder/subfolder/hello.txt"))
test.isfalse(table.contains(result, "premake4.lua"))
end
function suite.matchfiles_OnDotSlashPrefix()
local result = os.matchfiles("./**.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
end
function suite.matchfiles_OnImplicitEndOfString()
local result = os.matchfiles("folder/*.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
test.isfalse(table.contains(result, "folder/ok.lua.2"))
end
function suite.matchfiles_OnLeadingDotSlashWithPath()
local result = os.matchfiles("./folder/*.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
end
function suite.matchfiles_OnDottedFile()
local result = os.matchfiles("base/.*")
test.istrue(table.contains(result, "base/.testDotFile"))
end
function suite.matchfiles_onComboSearch()
local result = os.matchfiles("folder/**/*.txt")
test.istrue(table.contains(result, "folder/subfolder/hello.txt"))
end
function suite.matchfiles_onSymbolicLink()
if os.istarget("macosx")
or os.istarget("linux")
or os.istarget("solaris")
or os.istarget("bsd")
then
os.execute("cd folder && ln -s subfolder symlinkfolder && cd ..")
local result = os.matchfiles("folder/**/*.txt")
os.execute("rm folder/symlinkfolder")
premake.modules.self_test.print(table.tostring(result))
test.istrue(table.contains(result, "folder/symlinkfolder/hello.txt"))
end
end
--
-- os.pathsearch() tests
--
function suite.pathsearch_ReturnsNil_OnNotFound()
test.istrue(os.pathsearch("nosuchfile", "aaa;bbb;ccc") == nil)
end
function suite.pathsearch_ReturnsPath_OnFound()
test.isequal(_TESTS_DIR, os.pathsearch("_tests.lua", _TESTS_DIR))
end
function suite.pathsearch_FindsFile_OnComplexPath()
test.isequal(_TESTS_DIR, os.pathsearch("_tests.lua", "aaa;" .. _TESTS_DIR .. ";bbb"))
end
function suite.pathsearch_NilPathsAllowed()
test.isequal(_TESTS_DIR, os.pathsearch("_tests.lua", nil, _TESTS_DIR, nil))
end
--
-- os.outputof() tests
--
-- Check if outputof returns the command exit code
-- in addition of the command output
function suite.outputof_commandExitCode()
if os.istarget("macosx")
or os.istarget("linux")
or os.istarget("solaris")
or os.istarget("bsd")
then
-- Assumes 'true' and 'false' commands exist
-- which should be the case on all *nix platforms
for cmd, exitcode in pairs ({
["true"] = 0,
["false"] = 1
})
do
local o, e = os.outputof(cmd)
test.isequal(e, exitcode)
end
end
end
-- Check outputof content
function suite.outputof_streams_output()
if (os.istarget("macosx")
or os.istarget("linux")
or os.istarget("solaris")
or os.istarget("bsd"))
and os.isdir (_TESTS_DIR)
then
local ob, e = os.outputof ("ls " .. _TESTS_DIR .. "/base")
local oo, e = os.outputof ("ls " .. _TESTS_DIR .. "/base", "output")
test.isequal (oo, ob)
local s, e = string.find (oo, "test_os.lua")
test.istrue(s ~= nil)
local o, e = os.outputof ("ls " .. cwd .. "/base", "error")
test.istrue(o == nil or #o == 0)
end
end
--
-- os.translateCommand() tests
--
function suite.translateCommand_onNoToken()
test.isequal("cp a b", os.translateCommands("cp a b"))
end
function suite.translateCommand_callsProcessor()
os.commandTokens.test = {
copy = function(value) return "test " .. value end
}
test.isequal("test a b", os.translateCommands("{COPY} a b", "test"))
end
function suite.translateCommand_callsProcessor_multipleTokens()
os.commandTokens.test = {
copy = function(value) return "test " .. value end
}
test.isequal("test a b; test c d; test e f;", os.translateCommands("{COPY} a b; {COPY} c d; {COPY} e f;", "test"))
end
--
-- os.translateCommand() windows COPY tests
--
function suite.translateCommand_windowsCopyNoDst()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a > nul) ELSE (xcopy /Q /Y /I a > nul)', os.translateCommands('{COPY} a', "windows"))
end
function suite.translateCommand_windowsCopyNoDst_ExtraSpace()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a > nul) ELSE (xcopy /Q /Y /I a > nul)', os.translateCommands('{COPY} a ', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotes()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a b > nul) ELSE (xcopy /Q /Y /I a b > nul)', os.translateCommands('{COPY} a b', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotes_ExtraSpace()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a b > nul) ELSE (xcopy /Q /Y /I a b > nul)', os.translateCommands('{COPY} a b ', "windows"))
end
function suite.translateCommand_windowsCopyQuotes()
test.isequal('IF EXIST "a a"\\ (xcopy /Q /E /Y /I "a a" "b" > nul) ELSE (xcopy /Q /Y /I "a a" "b" > nul)', os.translateCommands('{COPY} "a a" "b"', "windows"))
end
function suite.translateCommand_windowsCopyQuotes_ExtraSpace()
test.isequal('IF EXIST "a a"\\ (xcopy /Q /E /Y /I "a a" "b" > nul) ELSE (xcopy /Q /Y /I "a a" "b" > nul)', os.translateCommands('{COPY} "a a" "b" ', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotesDst()
test.isequal('IF EXIST "a a"\\ (xcopy /Q /E /Y /I "a a" b > nul) ELSE (xcopy /Q /Y /I "a a" b > nul)', os.translateCommands('{COPY} "a a" b', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotesDst_ExtraSpace()
test.isequal('IF EXIST "a a"\\ (xcopy /Q /E /Y /I "a a" b > nul) ELSE (xcopy /Q /Y /I "a a" b > nul)', os.translateCommands('{COPY} "a a" b ', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotesSrc()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a "b" > nul) ELSE (xcopy /Q /Y /I a "b" > nul)', os.translateCommands('{COPY} a "b"', "windows"))
end
function suite.translateCommand_windowsCopyNoQuotesSrc_ExtraSpace()
test.isequal('IF EXIST a\\ (xcopy /Q /E /Y /I a "b" > nul) ELSE (xcopy /Q /Y /I a "b" > nul)', os.translateCommands('{COPY} a "b" ', "windows"))
end
--
-- os.getWindowsRegistry windows tests
--
function suite.getreg_nonExistentValue()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKCU:Should\\Not\\Exist\\At\\All")
test.isequal(nil, x)
end
end
function suite.getreg_nonExistentDefaultValue()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKCU:Should\\Not\\Exist\\At\\All\\")
test.isequal(nil, x)
end
end
function suite.getreg_noSeparators()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKCU:ShouldNotExistAtAll")
test.isequal(nil, x)
end
end
function suite.getreg_namedValue()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKCU:Environment\\TEMP")
test.istrue(x ~= nil)
end
end
function suite.getreg_namedValueOptSeparator()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKCU:\\Environment\\TEMP")
test.istrue(x ~= nil)
end
end
function suite.getreg_defaultValue()
if os.ishost("windows") then
local x = os.getWindowsRegistry("HKLM:SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Minimal\\AppInfo\\")
test.isequal("Service", x)
end
end
--
-- os.listWindowsRegistry windows tests
--
function suite.listreg_nonExistentKey()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:Should\\Not\\Exist\\At\\All")
test.isequal(nil, x)
end
end
function suite.listreg_nonExistentKeyTrailingBackslash()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:Should\\Not\\Exist\\At\\All\\")
test.isequal(nil, x)
end
end
function suite.listreg_noSeparators()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:ShouldNotExistAtAll")
test.isequal(nil, x)
end
end
function suite.listreg_noSeparatorExistingPath()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:Environment")
test.istrue(x ~= nil and x["TEMP"] ~= nil)
end
end
function suite.listreg_optSeparators()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:\\Environment\\")
test.istrue(x ~= nil and x["TEMP"] ~= nil)
end
end
function suite.listreg_keyDefaultValueAndStringValueFormat()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKLM:SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Minimal\\AppInfo")
test.isequal(x[""]["value"], "Service")
test.isequal(x[""]["type"], "REG_SZ")
end
end
function suite.listreg_numericValueFormat()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKCU:Console")
test.isequal(type(x["FullScreen"]["value"]), "number")
test.isequal(x["FullScreen"]["type"], "REG_DWORD")
end
end
function suite.listreg_subkeyFormat()
if os.ishost("windows") then
local x = os.listWindowsRegistry("HKLM:")
test.isequal(type(x["SOFTWARE"]), "table")
test.isequal(next(x["SOFTWARE"]), nil)
end
end
--
-- os.getversion tests.
--
function suite.getversion()
local version = os.getversion();
test.istrue(version ~= nil)
end
--
-- os.translateCommandsAndPaths.
--
function suite.translateCommandsAndPaths()
test.isequal('cmdtool "../foo/path1"', os.translateCommandsAndPaths("cmdtool %[path1]", '../foo', '.', 'osx'))
end
function suite.translateCommandsAndPaths_PreserveSlash()
test.isequal('cmdtool "../foo/path1/"', os.translateCommandsAndPaths("cmdtool %[path1/]", '../foo', '.', 'osx'))
end
function suite.translateCommandsAndPaths_MultipleTokens()
test.isequal('cmdtool "../foo/path1" "../foo/path2/"', os.translateCommandsAndPaths("cmdtool %[path1] %[path2/]", '../foo', '.', 'osx'))
end
--
-- Helpers
--
local tmpname = function()
local p = os.tmpname()
os.remove(p) -- just needed on POSIX
return p
end
local tmpfile = function()
local p = tmpname()
if os.ishost("windows") then
os.execute("type nul >" .. p)
else
os.execute("touch " .. p)
end
return p
end
local tmpdir = function()
local p = tmpname()
os.mkdir(p)
return p
end
--
-- os.remove() tests.
--
function suite.remove_ReturnsError_OnNonExistingPath()
local ok, err, exitcode = os.remove(tmpname())
test.isnil(ok)
test.isequal("string", type(err))
test.isequal("number", type(exitcode))
test.istrue(0 ~= exitcode)
end
function suite.remove_ReturnsError_OnDirectory()
local ok, err, exitcode = os.remove(tmpdir())
test.isnil(ok)
test.isequal("string", type(err))
test.isequal("number", type(exitcode))
test.istrue(0 ~= exitcode)
end
function suite.remove_ReturnsTrue_OnFile()
local ok, err, exitcode = os.remove(tmpfile())
test.isequal(true, ok)
test.isnil(err)
test.isnil(exitcode)
end
--
-- os.rmdir() tests.
--
function suite.rmdir_ReturnsError_OnNonExistingPath()
local ok, err = os.rmdir(tmpname())
test.isnil(ok)
test.isequal("string", type(err))
end
function suite.rmdir_ReturnsError_OnFile()
local ok, err = os.rmdir(tmpfile())
test.isnil(ok)
test.isequal("string", type(err))
end
function suite.rmdir_ReturnsTrue_OnDirectory()
local ok, err = os.rmdir(tmpdir())
test.isequal(true, ok)
test.isnil(err)
end

View File

@ -1,4 +1,4 @@
@echo off
pushd "%~dp0"
..\bin\debug\premake5.exe /scripts=.. /file=..\premake5.lua %* test
popd
@echo off
pushd "%~dp0"
..\bin\debug\premake5.exe /scripts=.. /file=..\premake5.lua %* test
popd