Merge pull request #1532 from starkos/exclude-net-tests

Disable network tests; add --test-all flag to enable
This commit is contained in:
Samuel Surtees 2020-10-08 12:08:00 +10:00 committed by GitHub
commit 0bf4fb6d09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 17 deletions

View File

@ -15,7 +15,7 @@ jobs:
- name: Build - name: Build
run: make -f Bootstrap.mak linux CONFIG=${{ matrix.config }} run: make -f Bootstrap.mak linux CONFIG=${{ matrix.config }}
- name: Test - name: Test
run: bin/${{ matrix.config }}/premake5 test run: bin/${{ matrix.config }}/premake5 test --test-all
- name: Upload Artifacts - name: Upload Artifacts
if: matrix.config == 'release' if: matrix.config == 'release'
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
@ -34,7 +34,7 @@ jobs:
- name: Build - name: Build
run: make -f Bootstrap.mak macosx CONFIG=${{ matrix.config }} run: make -f Bootstrap.mak macosx CONFIG=${{ matrix.config }}
- name: Test - name: Test
run: bin/${{ matrix.config }}/premake5 test run: bin/${{ matrix.config }}/premake5 test --test-all
- name: Upload Artifacts - name: Upload Artifacts
if: matrix.config == 'release' if: matrix.config == 'release'
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
@ -56,7 +56,7 @@ jobs:
nmake -f Bootstrap.mak MSDEV=vs2019 windows-msbuild PLATFORM=${{ matrix.platform }} CONFIG=${{ matrix.config }} nmake -f Bootstrap.mak MSDEV=vs2019 windows-msbuild PLATFORM=${{ matrix.platform }} CONFIG=${{ matrix.config }}
shell: cmd shell: cmd
- name: Test - name: Test
run: bin\${{ matrix.config }}\premake5 test run: bin\${{ matrix.config }}\premake5 test --test-all
shell: cmd shell: cmd
- name: Upload Artifacts - name: Upload Artifacts
if: matrix.config == 'release' if: matrix.config == 'release'

View File

@ -148,6 +148,7 @@
-- NuGet packages should get references. -- NuGet packages should get references.
-- --
if _OPTIONS["test-all"] then
function suite.nuGetPackages_net45() function suite.nuGetPackages_net45()
dotnetframework "4.5" dotnetframework "4.5"
nuget { "Newtonsoft.Json:10.0.2" } nuget { "Newtonsoft.Json:10.0.2" }
@ -175,12 +176,15 @@
</ItemGroup> </ItemGroup>
]] ]]
end end
end
-- --
-- If there are multiple assemblies in the NuGet package, they all should be -- If there are multiple assemblies in the NuGet package, they all should be
-- referenced. -- referenced.
-- --
if _OPTIONS["test-all"] then
function suite.nuGetPackages_multipleAssemblies() function suite.nuGetPackages_multipleAssemblies()
dotnetframework "2.0" dotnetframework "2.0"
nuget { "NUnit:3.6.1" } nuget { "NUnit:3.6.1" }
@ -198,12 +202,14 @@
</ItemGroup> </ItemGroup>
]] ]]
end end
end
-- --
-- NuGet packages should respect copylocal() and the NoCopyLocal flag. -- NuGet packages should respect copylocal() and the NoCopyLocal flag.
-- --
if _OPTIONS["test-all"] then
function suite.nugetPackages_onNoCopyLocal() function suite.nugetPackages_onNoCopyLocal()
dotnetframework "2.0" dotnetframework "2.0"
nuget { "NUnit:3.6.1" } nuget { "NUnit:3.6.1" }
@ -260,12 +266,15 @@
</ItemGroup> </ItemGroup>
]] ]]
end end
end
-- --
-- NuGet packages with unconventional folder structures should be handled -- NuGet packages with unconventional folder structures should be handled
-- properly. -- properly.
-- --
if _OPTIONS["test-all"] then
function suite.nuGetPackages_netFolder() function suite.nuGetPackages_netFolder()
dotnetframework "4.5" dotnetframework "4.5"
nuget { "MetroModernUI:1.4.0" } nuget { "MetroModernUI:1.4.0" }
@ -287,3 +296,4 @@
</ItemGroup> </ItemGroup>
]] ]]
end end
end

View File

@ -32,8 +32,10 @@
-- Check that we process Unix-style paths correctly. -- Check that we process Unix-style paths correctly.
-- --
if _OPTIONS["test-all"] then
function suite.unixPaths() function suite.unixPaths()
dotnetframework "4.6" dotnetframework "4.6"
nuget "Mono.Cecil:0.9.6.4" nuget "Mono.Cecil:0.9.6.4"
prepare() prepare()
end end
end

View File

@ -42,6 +42,7 @@
-- Writes the pre-build check that makes sure that all packages are installed. -- Writes the pre-build check that makes sure that all packages are installed.
-- --
if _OPTIONS["test-all"] then
function suite.structureIsCorrect() function suite.structureIsCorrect()
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3" } nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3" }
prepare() prepare()
@ -56,3 +57,4 @@
</Target> </Target>
]] ]]
end end
end

View File

@ -63,6 +63,7 @@
-- Writes entries for NuGet packages. -- Writes entries for NuGet packages.
-- --
if _OPTIONS["test-all"] then
function suite.addsImport_onEachNuGetPackage() function suite.addsImport_onEachNuGetPackage()
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3" } nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3" }
prepare() prepare()
@ -74,6 +75,7 @@
</ImportGroup> </ImportGroup>
]] ]]
end end
end
-- --

View File

@ -51,7 +51,13 @@
newoption { newoption {
trigger = "test-only", trigger = "test-all",
description = "Run all unit tests, including slower network and I/O"
}
newoption {
trigger = "test-only",
description = "When testing, run only the specified suite or test" description = "When testing, run only the specified suite or test"
} }
@ -73,7 +79,7 @@
trigger = "no-zlib", trigger = "no-zlib",
description = "Disable Zlib/Zip 3rd party lib" description = "Disable Zlib/Zip 3rd party lib"
} }
newoption { newoption {
trigger = "no-luasocket", trigger = "no-luasocket",
description = "Disable Luasocket 3rd party lib" description = "Disable Luasocket 3rd party lib"
@ -105,7 +111,7 @@
if not _OPTIONS["no-zlib"] then if not _OPTIONS["no-zlib"] then
defines { "PREMAKE_COMPRESSION" } defines { "PREMAKE_COMPRESSION" }
end end
if not _OPTIONS["no-curl"] then if not _OPTIONS["no-curl"] then
defines { "CURL_STATICLIB", "PREMAKE_CURL"} defines { "CURL_STATICLIB", "PREMAKE_CURL"}
end end
@ -144,7 +150,7 @@
includedirs { "contrib/zlib", "contrib/libzip" } includedirs { "contrib/zlib", "contrib/libzip" }
links { "zip-lib", "zlib-lib" } links { "zip-lib", "zlib-lib" }
end end
if not _OPTIONS["no-curl"] then if not _OPTIONS["no-curl"] then
includedirs { "contrib/curl/include" } includedirs { "contrib/curl/include" }
links { "curl-lib" } links { "curl-lib" }
@ -214,20 +220,20 @@
group "contrib" group "contrib"
include "contrib/lua" include "contrib/lua"
include "contrib/luashim" include "contrib/luashim"
if not _OPTIONS["no-zlib"] then if not _OPTIONS["no-zlib"] then
include "contrib/zlib" include "contrib/zlib"
include "contrib/libzip" include "contrib/libzip"
end end
if not _OPTIONS["no-curl"] then if not _OPTIONS["no-curl"] then
include "contrib/mbedtls" include "contrib/mbedtls"
include "contrib/curl" include "contrib/curl"
end end
group "Binary Modules" group "Binary Modules"
include "binmodules/example" include "binmodules/example"
if not _OPTIONS["no-luasocket"] then if not _OPTIONS["no-luasocket"] then
include "binmodules/luasocket" include "binmodules/luasocket"
end end

View File

@ -1,16 +1,14 @@
-- --
-- tests/base/test_http.lua -- tests/base/test_http.lua
-- Tests the http API -- Tests the http API
-- Copyright (c) 2016 Jason Perkins and the Premake project -- Copyright (c) 2016, 2020 Jason Perkins and the Premake project
-- --
if http.get ~= nil and _OPTIONS["test-all"] then
local p = premake local p = premake
-- only declare the suite as a test if http.get is an existing method. local suite = test.declare("premake_http")
local suite = {}
if http.get ~= nil then
suite = test.declare("premake_http")
end
function suite.http_get() function suite.http_get()
local result, err = http.get("http://httpbin.org/user-agent") local result, err = http.get("http://httpbin.org/user-agent")
@ -56,6 +54,8 @@
end end
-- Disable as httpbin.org returns 404 on this endpoint -- Disable as httpbin.org returns 404 on this endpoint
-- See: https://github.com/postmanlabs/httpbin/issues/617
--[[ --[[
function suite.http_redirect() function suite.http_redirect()
local result, err, responseCode = http.get("http://httpbin.org/redirect/3") local result, err, responseCode = http.get("http://httpbin.org/redirect/3")
@ -81,3 +81,5 @@
test.fail(err); test.fail(err);
end end
end end
end