Home | History | Annotate | Download | only in google-benchmark
      1 version: '{build}'
      2 
      3 configuration:
      4   - Static Debug
      5   - Static Release
      6 #  - Shared Debug
      7 #  - Shared Release
      8 
      9 platform:
     10   - x86
     11   - x64
     12 
     13 environment:
     14   matrix:
     15     - compiler: msvc-12-seh
     16     - compiler: msvc-14-seh
     17     - compiler: gcc-4.9.2-posix
     18 #    - compiler: gcc-4.8.4-posix
     19 
     20 artifacts:
     21   - path: '_build/CMakeFiles/*.log'
     22     name: logs
     23   - path: '_build/Testing/**/*.xml'
     24     name: test_results
     25 
     26 install:
     27   # derive some extra information
     28   - for /f "tokens=1-2" %%a in ("%configuration%") do (@set "linkage=%%a")
     29   - for /f "tokens=1-2" %%a in ("%configuration%") do (@set "variant=%%b")
     30   - if "%linkage%"=="Shared" (set shared=YES) else (set shared=NO)
     31   - for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_name=%%a")
     32   - for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_version=%%b")
     33   - for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_threading=%%c")
     34   - if "%platform%"=="x64" (set arch=x86_64)
     35   - if "%platform%"=="x86" (set arch=i686)
     36   # download the specific version of MinGW
     37   - 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")
     38 
     39 before_build:
     40   # Set up mingw commands
     41   - if "%compiler_name%"=="gcc" (set "generator=MinGW Makefiles")
     42   - if "%compiler_name%"=="gcc" (set "build=mingw32-make -j4")
     43   - if "%compiler_name%"=="gcc" (set "test=mingw32-make CTEST_OUTPUT_ON_FAILURE=1 test")
     44   # msvc specific commands
     45   - if "%compiler_name%"=="msvc" if "%compiler_version%"=="12" if "%platform%"=="x86" (set "generator=Visual Studio 12 2013")
     46   - if "%compiler_name%"=="msvc" if "%compiler_version%"=="12" if "%platform%"=="x64" (set "generator=Visual Studio 12 2013 Win64")
     47   - if "%compiler_name%"=="msvc" if "%compiler_version%"=="14" if "%platform%"=="x86" (set "generator=Visual Studio 14 2015")
     48   - if "%compiler_name%"=="msvc" if "%compiler_version%"=="14" if "%platform%"=="x64" (set "generator=Visual Studio 14 2015 Win64")
     49   - if "%compiler_name%"=="msvc" (set "build=cmake --build . --config %variant%")
     50   - if "%compiler_name%"=="msvc" (set "test=ctest -c Release -D CTEST_OUTPUT_ON_FAILURE:STRING=1")
     51   # add the compiler path if needed
     52   - if not "%compiler_path%"=="" (set "PATH=%PATH%;%compiler_path%")
     53   # git bash conflicts with MinGW makefiles
     54   - if "%generator%"=="MinGW Makefiles" (set "PATH=%PATH:C:\Program Files\Git\usr\bin;=%")
     55 
     56 build_script:
     57 - ps: |
     58     md _build -Force
     59     cd _build
     60     & cmake -G "$env:generator" "-DCMAKE_BUILD_TYPE=$env:variant" "-DBUILD_SHARED_LIBS=$env:shared" ..
     61     if ($LastExitCode -ne 0) {
     62         throw "Exec: $ErrorMessage"
     63     }
     64     iex "& $env:build"
     65     if ($LastExitCode -ne 0) {
     66         throw "Exec: $ErrorMessage"
     67     }
     68 
     69 test_script:
     70 - ps: |
     71     iex "& $env:test"
     72     if ($LastExitCode -ne 0) {
     73         throw "Exec: $ErrorMessage"
     74     }
     75 
     76     function Add-CTest-Result($testResult)
     77     {
     78         $tests = ([xml](get-content $testResult)).Site.Testing
     79         $testsCount = 0
     80         $anyFailures = $FALSE
     81 
     82         foreach ($test in $tests.test) {
     83             $testsCount++
     84             $testName = $test.Name
     85             $testpath = $test.Path
     86             $timeNode = $test.SelectSingleNode('Results/NamedMeasurement[@name="Execution Time"]/Value')
     87             if ($test.status -eq "failure") {
     88                 $time = ([double]$timeNode.InnerText * 1000)
     89                 Add-AppveyorTest $testName -Outcome Failed -FileName $testpath -Duration $time -ErrorMessage $($test.results.measurement.value)
     90                 Add-AppveyorMessage `"$testName failed`" -Category Error
     91                 $anyFailures = $TRUE
     92             }
     93             elseif ($test.status -eq "skipped") {
     94                 Add-AppveyorTest $testName -Outcome Ignored -Filename $testpath
     95             }
     96             else {
     97                 $time = ([double]$timeNode.InnerText * 1000)
     98                 Add-AppveyorTest $testName -Outcome Passed -FileName $testpath -Duration $time -StdOut $($test.results.measurement.value)
     99             }
    100         }
    101         return $testsCount, $anyFailures
    102     }
    103 
    104     $testsCount = 0
    105     $anyFailures = $FALSE
    106 
    107     # Run tests and upload results to AppVeyor one by one
    108     Get-ChildItem ".\Testing\*.xml" -Recurse | foreach {
    109         $testfile = $_.fullname
    110         $count, $testsResult = Add-CTest-Result $testfile
    111         Write-Host "Found $testfile with $count tests"
    112         $testsCount = $testsCount + $count
    113         $anyFailures = $anyFailures -or $testsResult
    114     }
    115 
    116     Write-Host "There are $testsCount tests found"
    117 
    118     if ($anyFailures -eq $TRUE){
    119         Write-Host "Failing build as there are broken tests"
    120         $host.SetShouldExit(1)
    121     }
    122 
    123 matrix:
    124   fast_finish: true
    125 
    126 cache:
    127   - C:\mingw-builds
    128