1
0
mirror of https://github.com/google/benchmark.git synced 2025-04-30 06:50:27 +08:00

Rework Appveyor config

Currently the Appveyor bot is a PIT. It never passes and it often hangs
or gives very poor output. This patch rewrites the configuration.

This patch also attempts to fix a flaky complexity test as a drive-by.
This commit is contained in:
Eric Fiselier 2016-08-08 02:04:59 -06:00
parent cfd717e43b
commit ee54a3f03e
2 changed files with 40 additions and 109 deletions

View File

@ -1,21 +1,49 @@
version: '{build}'
configuration:
- Static Debug
- Static Release
# - Shared Debug
# - Shared Release
platform:
- x86
- x64
- Debug
- Release
environment:
matrix:
- compiler: msvc-12-seh
generator: "Visual Studio 12 2013"
- compiler: msvc-12-seh
generator: "Visual Studio 12 2013 Win64"
- compiler: msvc-14-seh
generator: "Visual Studio 14 2015"
- compiler: msvc-14-seh
generator: "Visual Studio 14 2015 Win64"
- compiler: gcc-4.9.2-posix
# - compiler: gcc-4.8.4-posix
generator: "MinGW Makefiles"
arch: i686
- compiler: gcc-4.9.2-posix
generator: "MinGW Makefiles"
arch: x86_64
matrix:
fast_finish: true
install:
- if "%compiler%"=="gcc-4.9.2-posix" (for /f %%a in ('python mingw.py --quiet --version "4.9.2" --arch "%arch%" --threading "posix" --location "C:\mingw-builds"') do @set "compiler_path=%%a")
- if not "%compiler_path%"=="" (set "PATH=%PATH%;%compiler_path%")
# git bash conflicts with MinGW makefiles
- if "%generator%"=="MinGW Makefiles" (set "PATH=%PATH:C:\Program Files\Git\usr\bin;=%")
build_script:
- md _build -Force
- cd _build
- echo %configuration%
- cmake -G "%generator%" "-DCMAKE_BUILD_TYPE=%configuration%" ..
- cmake --build . --config %configuration%
test_script:
- ctest -c %configuration% --timeout 300 --output-on-failure
artifacts:
- path: '_build/CMakeFiles/*.log'
@ -23,105 +51,5 @@ artifacts:
- path: '_build/Testing/**/*.xml'
name: test_results
install:
# derive some extra information
- for /f "tokens=1-2" %%a in ("%configuration%") do (@set "linkage=%%a")
- for /f "tokens=1-2" %%a in ("%configuration%") do (@set "variant=%%b")
- if "%linkage%"=="Shared" (set shared=YES) else (set shared=NO)
- for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_name=%%a")
- for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_version=%%b")
- for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_threading=%%c")
- if "%platform%"=="x64" (set arch=x86_64)
- if "%platform%"=="x86" (set arch=i686)
# download the specific version of MinGW
- if "%compiler_name%"=="gcc" (for /f %%a in ('python mingw.py --quiet --version "%compiler_version%" --arch "%arch%" --threading "%compiler_threading%" --location "C:\mingw-builds"') do @set "compiler_path=%%a")
before_build:
# Set up mingw commands
- if "%compiler_name%"=="gcc" (set "generator=MinGW Makefiles")
- if "%compiler_name%"=="gcc" (set "build=mingw32-make -j4")
- if "%compiler_name%"=="gcc" (set "test=mingw32-make CTEST_OUTPUT_ON_FAILURE=1 test")
# msvc specific commands
- if "%compiler_name%"=="msvc" if "%compiler_version%"=="12" if "%platform%"=="x86" (set "generator=Visual Studio 12 2013")
- if "%compiler_name%"=="msvc" if "%compiler_version%"=="12" if "%platform%"=="x64" (set "generator=Visual Studio 12 2013 Win64")
- if "%compiler_name%"=="msvc" if "%compiler_version%"=="14" if "%platform%"=="x86" (set "generator=Visual Studio 14 2015")
- if "%compiler_name%"=="msvc" if "%compiler_version%"=="14" if "%platform%"=="x64" (set "generator=Visual Studio 14 2015 Win64")
- if "%compiler_name%"=="msvc" (set "build=cmake --build . --config %variant%")
- if "%compiler_name%"=="msvc" (set "test=ctest -c Release --timeout 300 --output-on-failure")
# add the compiler path if needed
- if not "%compiler_path%"=="" (set "PATH=%PATH%;%compiler_path%")
# git bash conflicts with MinGW makefiles
- if "%generator%"=="MinGW Makefiles" (set "PATH=%PATH:C:\Program Files\Git\usr\bin;=%")
build_script:
- ps: |
md _build -Force
cd _build
& cmake -G "$env:generator" "-DCMAKE_BUILD_TYPE=$env:variant" ..
if ($LastExitCode -ne 0) {
throw "Exec: $ErrorMessage"
}
iex "& $env:build"
if ($LastExitCode -ne 0) {
throw "Exec: $ErrorMessage"
}
test_script:
- ps: |
iex "& $env:test"
if ($LastExitCode -ne 0) {
throw "Exec: $ErrorMessage"
}
function Add-CTest-Result($testResult)
{
$tests = ([xml](get-content $testResult)).Site.Testing
$testsCount = 0
$anyFailures = $FALSE
foreach ($test in $tests.test) {
$testsCount++
$testName = $test.Name
$testpath = $test.Path
$timeNode = $test.SelectSingleNode('Results/NamedMeasurement[@name="Execution Time"]/Value')
if ($test.status -eq "failure") {
$time = ([double]$timeNode.InnerText * 1000)
Add-AppveyorTest $testName -Outcome Failed -FileName $testpath -Duration $time -ErrorMessage $($test.results.measurement.value)
Add-AppveyorMessage `"$testName failed`" -Category Error
$anyFailures = $TRUE
}
elseif ($test.status -eq "skipped") {
Add-AppveyorTest $testName -Outcome Ignored -Filename $testpath
}
else {
$time = ([double]$timeNode.InnerText * 1000)
Add-AppveyorTest $testName -Outcome Passed -FileName $testpath -Duration $time -StdOut $($test.results.measurement.value)
}
}
return $testsCount, $anyFailures
}
$testsCount = 0
$anyFailures = $FALSE
# Run tests and upload results to AppVeyor one by one
Get-ChildItem ".\Testing\*.xml" -Recurse | foreach {
$testfile = $_.fullname
$count, $testsResult = Add-CTest-Result $testfile
Write-Host "Found $testfile with $count tests"
$testsCount = $testsCount + $count
$anyFailures = $anyFailures -or $testsResult
}
Write-Host "There are $testsCount tests found"
if ($anyFailures -eq $TRUE){
Write-Host "Failing build as there are broken tests"
$host.SetShouldExit(1)
}
matrix:
fast_finish: true
cache:
- C:\mingw-builds

View File

@ -160,6 +160,9 @@ int AddComplexityTest(std::vector<TestCase>* console_out, std::vector<TestCase>*
void BM_Complexity_O1(benchmark::State& state) {
while (state.KeepRunning()) {
for (int i=0; i < 1024; ++i) {
benchmark::DoNotOptimize(&i);
}
}
state.SetComplexityN(state.range(0));
}