5 # Appveyor images are named after the Visual Studio version they contain.
6 # But we compile using MinGW, not Visual Studio.
7 # We use these images because they have different Windows versions.
16 - target: i686-w64-mingw32
17 compiler_path: mingw32
18 mingw_prefix: mingw-w64-i686
20 - target: x86_64-w64-mingw32
21 compiler_path: mingw64
22 mingw_prefix: mingw-w64-x86_64
23 # hardening doesn't work with mingw-w64-x86_64-gcc, because it's gcc 8
24 hardening: --disable-gcc-hardening
27 # Don't keep building failing jobs
29 # Skip the 32-bit Windows Server 2019 job, and the 64-bit Windows Server
30 # 2012 R2 job, to speed up the build.
31 # The environment variables must be listed without the 'environment' tag.
33 - image: Visual Studio 2019
34 target: i686-w64-mingw32
35 compiler_path: mingw32
36 mingw_prefix: mingw-w64-i686
41 Function Execute-Command ($commandPath)
43 & $commandPath $args 2>&1
44 if ( $LastExitCode -ne 0 ) {
45 $host.SetShouldExit( $LastExitCode )
48 Function Execute-Bash ()
50 Execute-Command 'c:\msys64\usr\bin\bash' '-e' '-c' $args
52 <# mingw packages start with ${env:mingw_prefix}
53 # unprefixed packages are from MSYS2, which is like Cygwin. Avoid them.
55 # Use pacman --debug to show package downloads and install locations
57 # All installed library dlls must be copied to the test and app
58 # directories, before running tor's tests. (See below.)
60 Execute-Command "C:\msys64\usr\bin\pacman" -Syu --verbose --noconfirm pacman ;
62 Execute-Command "C:\msys64\usr\bin\pacman" -Sy --verbose --needed --noconfirm ${env:mingw_prefix}-libevent ${env:mingw_prefix}-openssl ${env:mingw_prefix}-pkg-config ${env:mingw_prefix}-xz ${env:mingw_prefix}-zstd ;
66 if ($env:compiler -eq "mingw") {
67 <# use the MSYS2 compiler and user binaries to build and install #>
68 $oldpath = ${env:Path} -split ';'
69 $buildpath = @("C:\msys64\${env:compiler_path}\bin", "C:\msys64\usr\bin") + $oldpath
70 $env:Path = @($buildpath) -join ';'
71 $env:build = @("${env:APPVEYOR_BUILD_FOLDER}", $env:target) -join '\'
72 Set-Location "${env:APPVEYOR_BUILD_FOLDER}"
73 Execute-Bash 'autoreconf -i'
75 Set-Location "${env:build}"
76 Execute-Bash "which ${env:target}-gcc"
77 Execute-Bash "${env:target}-gcc --version"
79 # mingw zstd doesn't come with a pkg-config file, so we manually
80 # configure its flags. liblzma just works.
82 Execute-Bash "ZSTD_CFLAGS='-L/${env:compiler_path}/include' ZSTD_LIBS='-L/${env:compiler_path}/lib -lzstd' ../configure --prefix=/${env:compiler_path} --build=${env:target} --host=${env:target} --with-openssl-dir=/${env:compiler_path} --disable-asciidoc --enable-fatal-warnings ${env:hardening} CFLAGS='-D__USE_MINGW_ANSI_STDIO=0'"
83 Execute-Bash "V=1 make -k -j2"
84 Execute-Bash "V=1 make -k -j2 install"
89 if ($env:compiler -eq "mingw") {
90 <# use the MSYS2 compiler binaries to make check #>
91 $oldpath = ${env:Path} -split ';'
92 $buildpath = @("C:\msys64\${env:compiler_path}\bin") + $oldpath
93 $env:Path = $buildpath -join ';'
94 Set-Location "${env:build}"
95 <# Some compiler dlls must be copied to the test and app
96 # directories, before running tor's tests.
98 Copy-Item "C:/msys64/${env:compiler_path}/bin/libssp-0.dll","C:/msys64/${env:compiler_path}/bin/zlib1.dll" -Destination "${env:build}/src/test"
99 Copy-Item "C:/msys64/${env:compiler_path}/bin/libssp-0.dll","C:/msys64/${env:compiler_path}/bin/zlib1.dll" -Destination "${env:build}/src/app"
100 <# All installed library dlls must be copied to the test and app
101 # directories, before running tor's tests.
102 # (See install command above.)
104 Copy-Item "C:/${env:compiler_path}/bin/libcrypto*.dll","C:/${env:compiler_path}/bin/libssl*.dll","C:/${env:compiler_path}/bin/liblzma*.dll","C:/${env:compiler_path}/bin/libevent*.dll","C:/${env:compiler_path}/bin/libzstd*.dll" -Destination "${env:build}/src/test"
105 Copy-Item "C:/${env:compiler_path}/bin/libcrypto*.dll","C:/${env:compiler_path}/bin/libssl*.dll","C:/${env:compiler_path}/bin/liblzma*.dll","C:/${env:compiler_path}/bin/libevent*.dll","C:/${env:compiler_path}/bin/libzstd*.dll" -Destination "${env:build}/src/app"
106 Execute-Bash "VERBOSE=1 TOR_SKIP_TESTCASES=crypto/openssl_version make -k -j2 check"
111 <# if we failed before install:, these functions won't be defined #>
112 Function Execute-Command ($commandPath)
114 & $commandPath $args 2>&1
115 if ( $LastExitCode -ne 0 ) {
116 $host.SetShouldExit( $LastExitCode )
119 Function Execute-Bash ()
121 Execute-Command 'c:\msys64\usr\bin\bash' '-e' '-c' $args
123 if ($env:compiler -eq "mingw") {
124 <# use the MSYS2 user binaries to archive failures #>
125 $oldpath = ${env:Path} -split ';'
126 $buildpath = @("C:\msys64\usr\bin") + $oldpath
127 $env:Path = @($buildpath) -join ';'
128 Set-Location "${env:build}"
129 <# store logs as appveyor artifacts: see the artifacts tab #>
130 Execute-Bash "7z a logs.zip config.log || true"
131 Execute-Bash "7z a logs.zip test-suite.log || true"
132 Execute-Bash "appveyor PushArtifact logs.zip || true"
133 Execute-Bash "tail -1000 config.log || true"
134 Execute-Bash "cat test-suite.log || true"
137 # notify the IRC channel of any failures
139 - cmd: C:\Python27\python.exe %APPVEYOR_BUILD_FOLDER%\scripts\test\appveyor-irc-notify.py irc.oftc.net:6697 tor-ci failure