diff options
author | Patrick Steinhardt <ps@pks.im> | 2019-07-21 12:25:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-21 12:25:10 +0200 |
commit | 82b1d1da2b899461493e95a6bd12d156936f5d7a (patch) | |
tree | 51a7eaf1c9ee7fb18b522f10878ec1ce52408b5c | |
parent | 9085819232934bc9b666d4669957ac0ab0398ec6 (diff) | |
parent | 415ee616afdd4f1892410cdad8d24d9ac3bc977d (diff) | |
download | libgit2-82b1d1da2b899461493e95a6bd12d156936f5d7a.tar.gz |
Merge pull request #5141 from pks-t/pks/azure-drop-powershell
azure: drop powershell
23 files changed, 144 insertions, 315 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 292fadd3c..6e6443a0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,7 @@ OPTION(USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON) OPTION(USE_SHA1 "Enable SHA1. Can be set to CollisionDetection(ON)/HTTPS/Generic" ON) OPTION(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF) OPTION(USE_STANDALONE_FUZZERS "Enable standalone fuzzers (compatible with gcc)" OFF) +OPTION(USE_LEAK_CHECKER "Run tests with leak checker" OFF) OPTION(VALGRIND "Configure build for valgrind" OFF) OPTION(DEBUG_POOL "Enable debug pool allocator" OFF) OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 959960f07..dda7ad59a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,8 +16,8 @@ jobs: imageName: 'libgit2/trusty-amd64:latest' environmentVariables: | CC=gcc - CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON - LEAK_CHECK=valgrind + CMAKE_GENERATOR=Unix Makefiles + CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind - job: linux_amd64_trusty_gcc_mbedtls displayName: 'Linux (amd64; Trusty; GCC; mbedTLS)' @@ -29,8 +29,8 @@ jobs: imageName: 'libgit2/trusty-amd64:latest' environmentVariables: | CC=gcc - CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON - LEAK_CHECK=valgrind + CMAKE_GENERATOR=Unix Makefiles + CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind - job: linux_amd64_trusty_clang_openssl displayName: 'Linux (amd64; Trusty; Clang; OpenSSL)' @@ -42,8 +42,8 @@ jobs: imageName: 'libgit2/trusty-amd64:latest' environmentVariables: | CC=clang - CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON - LEAK_CHECK=valgrind + CMAKE_GENERATOR=Unix Makefiles + CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind - job: linux_amd64_trusty_clang_mbedtls displayName: 'Linux (amd64; Trusty; Clang; mbedTLS)' @@ -55,73 +55,81 @@ jobs: imageName: 'libgit2/trusty-amd64:latest' environmentVariables: | CC=clang - CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON - LEAK_CHECK=valgrind + CMAKE_GENERATOR=Unix Makefiles + CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind - job: macos displayName: 'macOS' pool: vmImage: 'macOS 10.13' steps: - - bash: . '$(Build.SourcesDirectory)/ci/setup-osx.sh' + - bash: . '$(Build.SourcesDirectory)/azure-pipelines/setup-osx.sh' displayName: Setup - template: azure-pipelines/bash.yml parameters: environmentVariables: TMPDIR: $(Agent.TempDirectory) PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig - LEAK_CHECK: leaks - CMAKE_OPTIONS: -G Ninja -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON + CMAKE_GENERATOR: Ninja + CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks SKIP_SSH_TESTS: true - job: windows_vs_amd64 displayName: 'Windows (amd64; Visual Studio)' pool: Hosted steps: - - template: azure-pipelines/powershell.yml + - template: azure-pipelines/bash.yml parameters: environmentVariables: - CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -G"Visual Studio 12 2013 Win64" -DDEPRECATE_HARD=ON + CMAKE_GENERATOR: Visual Studio 12 2013 Win64 + CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON + SKIP_SSH_TESTS: true - job: windows_vs_x86 displayName: 'Windows (x86; Visual Studio)' pool: Hosted steps: - - template: azure-pipelines/powershell.yml + - template: azure-pipelines/bash.yml parameters: environmentVariables: - CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -G"Visual Studio 12 2013" -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS + CMAKE_GENERATOR: Visual Studio 12 2013 + CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS + SKIP_SSH_TESTS: true - job: windows_mingw_amd64 displayName: 'Windows (amd64; MinGW)' pool: Hosted steps: - - powershell: . '$(Build.SourcesDirectory)\ci\setup-mingw.ps1' + - bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh' displayName: Setup env: TEMP: $(Agent.TempDirectory) ARCH: amd64 - - template: azure-pipelines/powershell.yml + - template: azure-pipelines/bash.yml parameters: environmentVariables: - CMAKE_OPTIONS: -G"MinGW Makefiles" -DDEPRECATE_HARD=ON - PATH: $(Agent.TempDirectory)\mingw64\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin + BUILD_PATH: $(Agent.TempDirectory)\mingw64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin + CMAKE_GENERATOR: MinGW Makefiles + CMAKE_OPTIONS: -DDEPRECATE_HARD=ON + SKIP_SSH_TESTS: true - job: windows_mingw_x86 displayName: 'Windows (x86; MinGW)' pool: Hosted steps: - - powershell: . '$(Build.SourcesDirectory)\ci\setup-mingw.ps1' + - bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh' displayName: Setup workingDirectory: '$(Build.BinariesDirectory)' env: TEMP: $(Agent.TempDirectory) ARCH: x86 - - template: azure-pipelines/powershell.yml + - template: azure-pipelines/bash.yml parameters: environmentVariables: - CMAKE_OPTIONS: -G"MinGW Makefiles" -DDEPRECATE_HARD=ON - PATH: $(Agent.TempDirectory)\mingw32\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin + BUILD_PATH: $(Agent.TempDirectory)\mingw32\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin + CMAKE_GENERATOR: MinGW Makefiles + CMAKE_OPTIONS: -DDEPRECATE_HARD=ON + SKIP_SSH_TESTS: true - job: documentation displayName: 'Generate Documentation' diff --git a/azure-pipelines/bash.yml b/azure-pipelines/bash.yml index d776a3649..33a442b57 100644 --- a/azure-pipelines/bash.yml +++ b/azure-pipelines/bash.yml @@ -1,10 +1,10 @@ # These are the steps used for building on machines with bash. steps: -- bash: . '$(Build.SourcesDirectory)/ci/build.sh' +- bash: . '$(Build.SourcesDirectory)/azure-pipelines/build.sh' displayName: Build workingDirectory: '$(Build.BinariesDirectory)' env: ${{ parameters.environmentVariables }} -- bash: . '$(Build.SourcesDirectory)/ci/test.sh' +- bash: . '$(Build.SourcesDirectory)/azure-pipelines/test.sh' displayName: Test workingDirectory: '$(Build.BinariesDirectory)' env: ${{ parameters.environmentVariables }} diff --git a/ci/build.sh b/azure-pipelines/build.sh index 7ffa610ae..6700d7bdb 100755 --- a/ci/build.sh +++ b/azure-pipelines/build.sh @@ -9,7 +9,8 @@ set -e SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )} BUILD_DIR=$(pwd) -CC=${CC:-cc} +BUILD_PATH=${BUILD_PATH:=$PATH} +CMAKE=$(which cmake) indent() { sed "s/^/ /"; } @@ -31,21 +32,24 @@ echo "Kernel version:" uname -a 2>&1 | indent echo "CMake version:" -cmake --version 2>&1 | indent -echo "Compiler version:" -$CC --version 2>&1 | indent +env PATH="$BUILD_PATH" "$CMAKE" --version 2>&1 | indent + +if test -n "$CC"; then + echo "Compiler version:" + "$CC" --version 2>&1 | indent +fi echo "" echo "##############################################################################" echo "## Configuring build environment" echo "##############################################################################" -echo cmake ${SOURCE_DIR} -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON -DBUILD_FUZZERS=ON -DUSE_STANDALONE_FUZZERS=ON ${CMAKE_OPTIONS} -cmake ${SOURCE_DIR} -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON -DBUILD_FUZZERS=ON -DUSE_STANDALONE_FUZZERS=ON ${CMAKE_OPTIONS} +echo cmake ${SOURCE_DIR} -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON -DBUILD_FUZZERS=ON -DUSE_STANDALONE_FUZZERS=ON -G \"${CMAKE_GENERATOR}\" ${CMAKE_OPTIONS} +env PATH="$BUILD_PATH" "$CMAKE" ${SOURCE_DIR} -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON -DBUILD_FUZZERS=ON -DUSE_STANDALONE_FUZZERS=ON -G "${CMAKE_GENERATOR}" ${CMAKE_OPTIONS} echo "" echo "##############################################################################" echo "## Building libgit2" echo "##############################################################################" -cmake --build . +env PATH="$BUILD_PATH" "$CMAKE" --build . diff --git a/ci/coverity-build.sh b/azure-pipelines/coverity-build.sh index f8264fa83..f8264fa83 100755 --- a/ci/coverity-build.sh +++ b/azure-pipelines/coverity-build.sh diff --git a/ci/coverity-publish.sh b/azure-pipelines/coverity-publish.sh index 2341b13fb..2341b13fb 100755 --- a/ci/coverity-publish.sh +++ b/azure-pipelines/coverity-publish.sh diff --git a/azure-pipelines/coverity.yml b/azure-pipelines/coverity.yml index d8d34229e..d8c6b3f66 100644 --- a/azure-pipelines/coverity.yml +++ b/azure-pipelines/coverity.yml @@ -18,7 +18,7 @@ jobs: envVars: | COVERITY_TOKEN=$(COVERITY_TOKEN) workDir: '/build' - containerCommand: '/src/ci/coverity-build.sh' + containerCommand: '/src/azure-pipelines/coverity-build.sh' detached: false - task: Docker@0 displayName: Publish @@ -31,6 +31,6 @@ jobs: envVars: | COVERITY_TOKEN=$(COVERITY_TOKEN) workDir: '/build' - containerCommand: '/src/ci/coverity-publish.sh' + containerCommand: '/src/azure-pipelines/coverity-publish.sh' detached: false continueOnError: true diff --git a/azure-pipelines/docker.yml b/azure-pipelines/docker.yml index 2744a63ae..2bbe686cd 100644 --- a/azure-pipelines/docker.yml +++ b/azure-pipelines/docker.yml @@ -14,7 +14,7 @@ steps: $(Build.BinariesDirectory):/build envVars: ${{ parameters.environmentVariables }} workDir: '/build' - containerCommand: '/src/ci/build.sh' + containerCommand: '/src/azure-pipelines/build.sh' detached: false - task: docker@0 displayName: Test @@ -26,7 +26,7 @@ steps: $(Build.BinariesDirectory):/build envVars: ${{ parameters.environmentVariables }} workDir: '/build' - containerCommand: '/src/ci/test.sh' + containerCommand: '/src/azure-pipelines/test.sh' detached: false - task: publishtestresults@2 displayName: Publish Test Results diff --git a/azure-pipelines/nightly.yml b/azure-pipelines/nightly.yml index c2997160c..96cc3e561 100644 --- a/azure-pipelines/nightly.yml +++ b/azure-pipelines/nightly.yml @@ -12,8 +12,8 @@ jobs: imageName: 'libgit2/trusty-amd64:latest' environmentVariables: | CC=gcc - CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON - LEAK_CHECK=valgrind + CMAKE_GENERATOR=Unix Makefiles + CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind RUN_INVASIVE_TESTS=true - job: linux_amd64_trusty_gcc_mbedtls @@ -26,8 +26,8 @@ jobs: imageName: 'libgit2/trusty-amd64:latest' environmentVariables: | CC=gcc - CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON - LEAK_CHECK=valgrind + CMAKE_GENERATOR=Unix Makefiles + CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind RUN_INVASIVE_TESTS=true - job: linux_amd64_trusty_clang_openssl @@ -40,8 +40,8 @@ jobs: imageName: 'libgit2/trusty-amd64:latest' environmentVariables: | CC=clang - CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON - LEAK_CHECK=valgrind + CMAKE_GENERATOR=Unix Makefiles + CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind RUN_INVASIVE_TESTS=true - job: linux_amd64_trusty_clang_mbedtls @@ -54,8 +54,8 @@ jobs: imageName: 'libgit2/trusty-amd64:latest' environmentVariables: | CC=clang - CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON - LEAK_CHECK=valgrind + CMAKE_GENERATOR=Unix Makefiles + CMAKE_OPTIONS=-DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind RUN_INVASIVE_TESTS=true - job: macos @@ -63,15 +63,15 @@ jobs: pool: vmImage: 'macOS 10.13' steps: - - bash: . '$(Build.SourcesDirectory)/ci/setup-osx.sh' + - bash: . '$(Build.SourcesDirectory)/azure-pipelines/setup-osx.sh' displayName: Setup - template: bash.yml parameters: environmentVariables: TMPDIR: $(Agent.TempDirectory) PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig - LEAK_CHECK: leaks - CMAKE_OPTIONS: -G Ninja -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON + CMAKE_GENERATOR: Ninja + CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks RUN_INVASIVE_TESTS: true SKIP_SSH_TESTS: true @@ -79,54 +79,62 @@ jobs: displayName: 'Windows (amd64; Visual Studio)' pool: Hosted steps: - - template: powershell.yml + - template: bash.yml parameters: environmentVariables: - CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -G"Visual Studio 12 2013 Win64" -DDEPRECATE_HARD=ON + CMAKE_GENERATOR: Visual Studio 12 2013 Win64 + CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON RUN_INVASIVE_TESTS: true + SKIP_SSH_TESTS: true - job: windows_vs_x86 displayName: 'Windows (x86; Visual Studio)' pool: Hosted steps: - - template: powershell.yml + - template: bash.yml parameters: environmentVariables: - CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -G"Visual Studio 12 2013" -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS + CMAKE_GENERATOR: Visual Studio 12 2013 + CMAKE_OPTIONS: -DMSVC_CRTDBG=ON -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS RUN_INVASIVE_TESTS: true + SKIP_SSH_TESTS: true - job: windows_mingw_amd64 displayName: 'Windows (amd64; MinGW)' pool: Hosted steps: - - powershell: . '$(Build.SourcesDirectory)\ci\setup-mingw.ps1' + - bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh' displayName: Setup env: TEMP: $(Agent.TempDirectory) ARCH: amd64 - - template: powershell.yml + - template: bash.yml parameters: environmentVariables: - CMAKE_OPTIONS: -G"MinGW Makefiles" -DDEPRECATE_HARD=ON - PATH: $(Agent.TempDirectory)\mingw64\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin + BUILD_PATH: $(Agent.TempDirectory)\mingw64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin + CMAKE_GENERATOR: MinGW Makefiles + CMAKE_OPTIONS: -DDEPRECATE_HARD=ON RUN_INVASIVE_TESTS: true + SKIP_SSH_TESTS: true - job: windows_mingw_x86 displayName: 'Windows (x86; MinGW)' pool: Hosted steps: - - powershell: . '$(Build.SourcesDirectory)\ci\setup-mingw.ps1' + - bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh' displayName: Setup workingDirectory: '$(Build.BinariesDirectory)' env: TEMP: $(Agent.TempDirectory) ARCH: x86 - - template: powershell.yml + - template: bash.yml parameters: environmentVariables: - CMAKE_OPTIONS: -G"MinGW Makefiles" -DDEPRECATE_HARD=ON - PATH: $(Agent.TempDirectory)\mingw32\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin + BUILD_PATH: $(Agent.TempDirectory)\mingw32\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin + CMAKE_GENERATOR: MinGW Makefiles + CMAKE_OPTIONS: -DDEPRECATE_HARD=ON RUN_INVASIVE_TESTS: true + SKIP_SSH_TESTS: true - job: linux_x86_bionic_gcc_openssl displayName: 'Linux (x86; Bionic; GCC; OpenSSL)' @@ -139,8 +147,8 @@ jobs: imageName: 'libgit2/bionic-x86:latest' environmentVariables: | CC=gcc - CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON - LEAK_CHECK=valgrind + CMAKE_GENERATOR=Unix Makefiles + CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind RUN_INVASIVE_TESTS=true - job: linux_x86_bionic_clang_openssl @@ -154,8 +162,8 @@ jobs: imageName: 'libgit2/bionic-x86:latest' environmentVariables: | CC=clang - CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON - LEAK_CHECK=valgrind + CMAKE_GENERATOR=Unix Makefiles + CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind RUN_INVASIVE_TESTS=true - job: linux_arm32_bionic_gcc_openssl @@ -169,6 +177,7 @@ jobs: imageName: 'libgit2/bionic-arm32:latest' environmentVariables: | CC=gcc + CMAKE_GENERATOR=Unix Makefiles CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON RUN_INVASIVE_TESTS=true SKIP_PROXY_TESTS=true @@ -184,6 +193,7 @@ jobs: imageName: 'libgit2/bionic-arm64:latest' environmentVariables: | CC=gcc + CMAKE_GENERATOR=Unix Makefiles CMAKE_OPTIONS=-DUSE_HTTPS=OpenSSL -DDEPRECATE_HARD=ON RUN_INVASIVE_TESTS=true SKIP_PROXY_TESTS=true diff --git a/azure-pipelines/powershell.yml b/azure-pipelines/powershell.yml deleted file mode 100644 index a2eb175d5..000000000 --- a/azure-pipelines/powershell.yml +++ /dev/null @@ -1,17 +0,0 @@ -# These are the steps used for building on machines with PowerShell. -steps: -- powershell: . '$(Build.SourcesDirectory)\ci\build.ps1' - displayName: Build - workingDirectory: '$(Build.BinariesDirectory)' - env: ${{ parameters.environmentVariables }} -- powershell: . '$(Build.SourcesDirectory)\ci\test.ps1' - displayName: Test - workingDirectory: '$(Build.BinariesDirectory)' - env: ${{ parameters.environmentVariables }} -- task: PublishTestResults@2 - displayName: Publish Test Results - condition: succeededOrFailed() - inputs: - testResultsFiles: 'results_*.xml' - searchFolder: '$(Build.BinariesDirectory)' - mergeTestResults: true diff --git a/ci/setup-linux.sh b/azure-pipelines/setup-linux.sh index c5ecb550b..c5ecb550b 100755 --- a/ci/setup-linux.sh +++ b/azure-pipelines/setup-linux.sh diff --git a/azure-pipelines/setup-mingw.sh b/azure-pipelines/setup-mingw.sh new file mode 100755 index 000000000..1172c2077 --- /dev/null +++ b/azure-pipelines/setup-mingw.sh @@ -0,0 +1,15 @@ +#!/bin/sh -e + +echo "##############################################################################" +echo "## Downloading mingw" +echo "##############################################################################" + +case "$ARCH" in + amd64) + MINGW_URI="https://bintray.com/libgit2/build-dependencies/download_file?file_path=mingw-w64-x86_64-8.1.0-release-win32-seh-rt_v6-rev0.zip";; + x86) + MINGW_URI="https://bintray.com/libgit2/build-dependencies/download_file?file_path=mingw-w64-i686-8.1.0-release-win32-sjlj-rt_v6-rev0.zip";; +esac + +curl -s -L "$MINGW_URI" -o "$TEMP"/mingw-"$ARCH".zip +unzip -q "$TEMP"/mingw-"$ARCH".zip -d "$TEMP" diff --git a/ci/setup-osx.sh b/azure-pipelines/setup-osx.sh index 2e630eedb..2e630eedb 100755 --- a/ci/setup-osx.sh +++ b/azure-pipelines/setup-osx.sh diff --git a/ci/test.sh b/azure-pipelines/test.sh index 9e12f53c3..56d8264d9 100755 --- a/ci/test.sh +++ b/azure-pipelines/test.sh @@ -13,15 +13,12 @@ USER=${USER:-$(whoami)} SUCCESS=1 -VALGRIND="valgrind --leak-check=full --show-reachable=yes --error-exitcode=125 --num-callers=50 --suppressions=\"$SOURCE_DIR/libgit2_clar.supp\"" -LEAKS="MallocStackLogging=1 MallocScribble=1 MallocLogFile=/dev/null CLAR_AT_EXIT=\"leaks -quiet \$PPID\"" - cleanup() { echo "Cleaning up..." - if [ ! -z "$GITDAEMON_DIR" -a -f "${GITDAEMON_DIR}/pid" ]; then + if [ ! -z "$GITDAEMON_PID" ]; then echo "Stopping git daemon..." - kill $(cat "${GITDAEMON_DIR}/pid") + kill $GITDAEMON_PID fi if [ ! -z "$SSHD_DIR" -a -f "${SSHD_DIR}/pid" ]; then @@ -32,29 +29,7 @@ cleanup() { echo "Done." } -# Ask ctest what it would run if we were to invoke it directly. This lets -# us manage the test configuration in a single place (tests/CMakeLists.txt) -# instead of running clar here as well. But it allows us to wrap our test -# harness with a leak checker like valgrind. Append the option to write -# JUnit-style XML files. run_test() { - TEST_CMD=$(ctest -N -V -R "^${1}$" | sed -n 's/^[0-9]*: Test command: //p') - - if [ -z "$TEST_CMD" ]; then - echo "Could not find tests: $1" - exit 1 - fi - - TEST_CMD="${TEST_CMD} -r${BUILD_DIR}/results_${1}.xml" - - if [ "$LEAK_CHECK" = "valgrind" ]; then - RUNNER="$VALGRIND $TEST_CMD" - elif [ "$LEAK_CHECK" = "leaks" ]; then - RUNNER="$LEAKS $TEST_CMD" - else - RUNNER="$TEST_CMD" - fi - if [[ "$GITTEST_FLAKY_RETRY" > 0 ]]; then ATTEMPTS_REMAIN=$GITTEST_FLAKY_RETRY else @@ -70,7 +45,8 @@ run_test() { fi RETURN_CODE=0 - eval $RUNNER || RETURN_CODE=$? && true + + CLAR_SUMMARY="${BUILD_DIR}/results_${1}.xml" ctest -V -R "^${1}$" || RETURN_CODE=$? && true if [ "$RETURN_CODE" -eq 0 ]; then break @@ -97,7 +73,8 @@ if [ -z "$SKIP_GITDAEMON_TESTS" ]; then echo "Starting git daemon..." GITDAEMON_DIR=`mktemp -d ${TMPDIR}/gitdaemon.XXXXXXXX` git init --bare "${GITDAEMON_DIR}/test.git" - git daemon --listen=localhost --export-all --enable=receive-pack --pid-file="${GITDAEMON_DIR}/pid" --base-path="${GITDAEMON_DIR}" "${GITDAEMON_DIR}" 2>/dev/null & + git daemon --listen=localhost --export-all --enable=receive-pack --base-path="${GITDAEMON_DIR}" "${GITDAEMON_DIR}" 2>/dev/null & + GITDAEMON_PID=$! fi if [ -z "$SKIP_PROXY_TESTS" ]; then @@ -256,9 +233,7 @@ if [ -z "$SKIP_FUZZERS" ]; then echo "## Running fuzzers" echo "##############################################################################" - for fuzzer in fuzzers/*_fuzzer; do - "${fuzzer}" "${SOURCE_DIR}/fuzzers/corpora/$(basename "${fuzzer%_fuzzer}")" || failure - done + ctest -V -R 'fuzzer' fi cleanup diff --git a/ci/build.ps1 b/ci/build.ps1 deleted file mode 100644 index dbc458dfc..000000000 --- a/ci/build.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -Set-StrictMode -Version Latest - -$ErrorActionPreference = "Stop" -$PSDefaultParameterValues['*:ErrorAction'] = 'Stop' - -if ($Env:SOURCE_DIR) { $SourceDirectory = $Env:SOURCE_DIR } else { $SourceDirectory = Split-Path (Split-Path $MyInvocation.MyCommand.Path -Parent) -Parent } -$BuildDirectory = $(Get-Location).Path - -Write-Host "Source directory: ${SourceDirectory}" -Write-Host "Build directory: ${BuildDirectory}" -Write-Host "" -Write-Host "Operating system version:" -Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, ServicePackMajorVersion, BuildNumber, OSArchitecture | Format-List -Write-Host "PATH: ${Env:PATH}" -Write-Host "" - -Write-Host "##############################################################################" -Write-Host "## Configuring build environment" -Write-Host "##############################################################################" - -Invoke-Expression "cmake ${SourceDirectory} -DBUILD_EXAMPLES=ON -DBUILD_FUZZERS=ON -DUSE_STANDALONE_FUZZERS=ON -DENABLE_WERROR=ON ${Env:CMAKE_OPTIONS}" -if ($LastExitCode -ne 0) { [Environment]::Exit($LastExitCode) } - -Write-Host "" -Write-Host "##############################################################################" -Write-Host "## Building libgit2" -Write-Host "##############################################################################" - -cmake --build . -if ($LastExitCode -ne 0) { [Environment]::Exit($LastExitCode) } diff --git a/ci/setup-mingw.ps1 b/ci/setup-mingw.ps1 deleted file mode 100644 index 76ecd3987..000000000 --- a/ci/setup-mingw.ps1 +++ /dev/null @@ -1,25 +0,0 @@ -Set-StrictMode -Version Latest - -$ErrorActionPreference = "Stop" -$PSDefaultParameterValues['*:ErrorAction'] = 'Stop' - -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - -[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem"); - -Write-Host "##############################################################################" -Write-Host "## Downloading mingw" -Write-Host "##############################################################################" - -if ($env:ARCH -eq "amd64") { - $mingw_uri = "https://bintray.com/libgit2/build-dependencies/download_file?file_path=mingw-w64-x86_64-8.1.0-release-win32-seh-rt_v6-rev0.zip" - $platform = "x86_64" -} else { - $mingw_uri = "https://bintray.com/libgit2/build-dependencies/download_file?file_path=mingw-w64-i686-8.1.0-release-win32-sjlj-rt_v6-rev0.zip" - $platform = "x86" -} - -$wc = New-Object net.webclient -$wc.Downloadfile($mingw_uri, "${Env:TEMP}/mingw-${Env:ARCH}.zip") - -[System.IO.Compression.ZipFile]::ExtractToDirectory("${Env:TEMP}/mingw-${Env:ARCH}.zip", $Env:TEMP) diff --git a/ci/test.ps1 b/ci/test.ps1 deleted file mode 100644 index 0c9e795f0..000000000 --- a/ci/test.ps1 +++ /dev/null @@ -1,139 +0,0 @@ -Set-StrictMode -Version Latest - -$ErrorActionPreference = "Stop" -$PSDefaultParameterValues['*:ErrorAction'] = 'Stop' - -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - -$SourceDir = Split-Path (Split-Path (Get-Variable MyInvocation).Value.MyCommand.Path) -$BuildDir = Get-Location -$global:Success = $true - -if ($Env:SKIP_TESTS) { exit } - -# Ask ctest what it would run if we were to invoke it directly. This lets -# us manage the test configuration in a single place (tests/CMakeLists.txt) -# instead of running clar here as well. But it allows us to wrap our test -# harness with a leak checker like valgrind. Append the option to write -# JUnit-style XML files. -function run_test { - $TestName = $args[0] - - $TestCommand = (ctest -N -V -R "^$TestName$") -join "`n" - - if (-Not ($TestCommand -match "(?ms).*\n^[0-9]*: Test command: ")) { - echo "Could not find tests: $TestName" - exit - } - - $TestCommand = (ctest -N -V -R "^$TestName$") -join "`n" -replace "(?ms).*\n^[0-9]*: Test command: ","" -replace "\n.*","" - $TestCommand += " -r${BuildDir}\results_${TestName}.xml" - - if ($Env:GITTEST_FLAKY_RETRY -gt 0) { - $AttemptsRemain = $Env:GITTEST_FLAKY_RETRY - } else { - $AttemptsRemain = 1 - } - - $Failed = 0 - while ($AttemptsRemain -ne 0) { - if ($Failed -eq 1) { - Write-Host "" - Write-Host "Re-running flaky $TestName tests..." - Write-Host "" - } - - Invoke-Expression $TestCommand - if ($LastExitCode -eq 0) { - $Failed = 0 - break - } else { - $Failed = 1 - } - - $AttemptsRemain = $AttemptsRemain - 1 - } - - if ($Failed -eq 1) { $global:Success = $false } -} - -Write-Host "##############################################################################" -Write-Host "## Configuring test environment" -Write-Host "##############################################################################" - -if (-not $Env:SKIP_PROXY_TESTS) { - Invoke-WebRequest -Method GET -Uri https://github.com/ethomson/poxyproxy/releases/download/v0.7.0/poxyproxy-0.7.0.jar -OutFile poxyproxy.jar - - Write-Host "" - Write-Host "Starting HTTP proxy (Basic)..." - javaw -jar poxyproxy.jar --port 8080 --credentials foo:bar --auth-type basic --quiet - - Write-Host "" - Write-Host "Starting HTTP proxy (NTLM)..." - javaw -jar poxyproxy.jar --port 8090 --credentials foo:bar --auth-type ntlm --quiet -} - -if (-not $Env:SKIP_OFFLINE_TESTS) { - Write-Host "" - Write-Host "##############################################################################" - Write-Host "## Running (offline) tests" - Write-Host "##############################################################################" - - run_test offline -} - -if ($Env:RUN_INVASIVE_TESTS) { - Write-Host "" - Write-Host "##############################################################################" - Write-Host "## Running (invasive) tests" - Write-Host "##############################################################################" - - $Env:GITTEST_INVASIVE_FS_SIZE=1 - $Env:GITTEST_INVASIVE_MEMORY=1 - $Env:GITTEST_INVASIVE_SPEED=1 - run_test invasive - $Env:GITTEST_INVASIVE_FS_SIZE=$null - $Env:GITTEST_INVASIVE_MEMORY=$null - $Env:GITTEST_INVASIVE_SPEED=$null -} - -if (-not $Env:SKIP_ONLINE_TESTS) { - Write-Host "" - Write-Host "##############################################################################" - Write-Host "## Running (online) tests" - Write-Host "##############################################################################" - - $Env:GITTEST_FLAKY_RETRY=5 - run_test online - $Env:GITTEST_FLAKY_RETRY=0 -} - -if (-not $Env:SKIP_PROXY_TESTS) { - # Test HTTP Basic authentication - Write-Host "" - Write-Host "Running proxy tests (Basic authentication)" - Write-Host "" - - $Env:GITTEST_REMOTE_PROXY_HOST="localhost:8080" - $Env:GITTEST_REMOTE_PROXY_USER="foo" - $Env:GITTEST_REMOTE_PROXY_PASS="bar" - run_test proxy - - # Test NTLM authentication - Write-Host "" - Write-Host "Running proxy tests (NTLM authentication)" - Write-Host "" - - $Env:GITTEST_REMOTE_PROXY_HOST="localhost:8090" - $Env:GITTEST_REMOTE_PROXY_USER="foo" - $Env:GITTEST_REMOTE_PROXY_PASS="bar" - run_test proxy - - $Env:GITTEST_REMOTE_PROXY_HOST=$null - $Env:GITTEST_REMOTE_PROXY_USER=$null - $Env:GITTEST_REMOTE_PROXY_PASS=$null - - taskkill /F /IM javaw.exe -} - -if (-Not $global:Success) { exit 1 } diff --git a/fuzzers/CMakeLists.txt b/fuzzers/CMakeLists.txt index 1c03aa980..59eca24d0 100644 --- a/fuzzers/CMakeLists.txt +++ b/fuzzers/CMakeLists.txt @@ -9,6 +9,8 @@ ENDIF () FILE(GLOB SRC_FUZZ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *_fuzzer.c) FOREACH(fuzz_target_src ${SRC_FUZZ}) STRING(REPLACE ".c" "" fuzz_target_name ${fuzz_target_src}) + STRING(REPLACE "_fuzzer" "" fuzz_name ${fuzz_target_name}) + SET(${fuzz_target_name}_SOURCES ${fuzz_target_src} ${LIBGIT2_OBJECTS}) IF(USE_STANDALONE_FUZZERS) LIST(APPEND ${fuzz_target_name}_SOURCES "standalone_driver.c") @@ -16,4 +18,6 @@ FOREACH(fuzz_target_src ${SRC_FUZZ}) ADD_EXECUTABLE(${fuzz_target_name} ${${fuzz_target_name}_SOURCES}) SET_TARGET_PROPERTIES(${fuzz_target_name} PROPERTIES C_STANDARD 90) TARGET_LINK_LIBRARIES(${fuzz_target_name} ${LIBGIT2_LIBS}) + + ADD_TEST(${fuzz_target_name} "${CMAKE_CURRENT_BINARY_DIR}/${fuzz_target_name}" "${CMAKE_CURRENT_SOURCE_DIR}/corpora/${fuzz_name}") ENDFOREACH() diff --git a/script/leaks.sh b/script/leaks.sh new file mode 100755 index 000000000..efeead516 --- /dev/null +++ b/script/leaks.sh @@ -0,0 +1,6 @@ +#!/bin/sh +export MallocStackLogging=1 +export MallocScribble=1 +export MallocLogFile=/dev/null +export CLAR_AT_EXIT="leaks -quiet \$PPID" +exec "$@" diff --git a/script/valgrind.sh b/script/valgrind.sh new file mode 100755 index 000000000..b5deed2b0 --- /dev/null +++ b/script/valgrind.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec valgrind --leak-check=full --show-reachable=yes --error-exitcode=125 --num-callers=50 --suppressions="$(dirname "${BASH_SOURCE[0]}")/valgrind.supp" "$@" diff --git a/libgit2_clar.supp b/script/valgrind.supp index b74791974..b74791974 100644 --- a/libgit2_clar.supp +++ b/script/valgrind.supp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e39fd6f7b..a97e8fe21 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -57,9 +57,17 @@ IF (MSVC_IDE) SET_SOURCE_FILES_PROPERTIES("precompiled.c" COMPILE_FLAGS "/Ycprecompiled.h") ENDIF () -ADD_TEST(offline "${libgit2_BINARY_DIR}/libgit2_clar" -v -xonline) -ADD_TEST(invasive "${libgit2_BINARY_DIR}/libgit2_clar" -v -score::ftruncate -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root) -ADD_TEST(online "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline) -ADD_TEST(gitdaemon "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::push) -ADD_TEST(ssh "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths) -ADD_TEST(proxy "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::proxy) +FUNCTION(ADD_CLAR_TEST name) + IF (NOT USE_LEAK_CHECKER STREQUAL "OFF") + ADD_TEST(${name} "${libgit2_SOURCE_DIR}/script/${USE_LEAK_CHECKER}.sh" "${libgit2_BINARY_DIR}/libgit2_clar" ${ARGN}) + ELSE() + ADD_TEST(${name} "${libgit2_BINARY_DIR}/libgit2_clar" ${ARGN}) + ENDIF() +ENDFUNCTION(ADD_CLAR_TEST) + +ADD_CLAR_TEST(offline -v -xonline) +ADD_CLAR_TEST(invasive -v -score::ftruncate -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root) +ADD_CLAR_TEST(online -v -sonline) +ADD_CLAR_TEST(gitdaemon -v -sonline::push) +ADD_CLAR_TEST(ssh -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths) +ADD_CLAR_TEST(proxy -v -sonline::clone::proxy) diff --git a/tests/clar.c b/tests/clar.c index 7c308dd34..ead13f46a 100644 --- a/tests/clar.c +++ b/tests/clar.c @@ -145,7 +145,7 @@ static struct { int report_suite_names; int write_summary; - const char *summary_filename; + char *summary_filename; struct clar_summary *summary; struct clar_explicit *explicit; @@ -474,8 +474,8 @@ clar_parse_args(int argc, char **argv) case 'r': _clar.write_summary = 1; - _clar.summary_filename = *(argument + 2) ? (argument + 2) : - "summary.xml"; + free(_clar.summary_filename); + _clar.summary_filename = strdup(*(argument + 2) ? (argument + 2) : "summary.xml"); break; default: @@ -493,6 +493,11 @@ clar_test_init(int argc, char **argv) "" ); + if ((_clar.summary_filename = getenv("CLAR_SUMMARY")) != NULL) { + _clar.write_summary = 1; + _clar.summary_filename = strdup(_clar.summary_filename); + } + if (argc > 1) clar_parse_args(argc, argv); @@ -553,6 +558,8 @@ clar_test_shutdown(void) report_next = report->next; free(report); } + + free(_clar.summary_filename); } int |