Merge pull request #2148 from dscho/azure-pipelines-msvc

Let the MSVC build also be tested in the Azure Pipeline
This commit is contained in:
Johannes Schindelin 2019-04-10 17:03:15 +02:00 коммит произвёл Johannes Schindelin
Родитель 755e5ce3a7 432d834396
Коммит 44ad45d745
10 изменённых файлов: 216 добавлений и 12 удалений

Просмотреть файл

@ -3042,6 +3042,10 @@ rpm::
@false
.PHONY: rpm
ifneq ($(INCLUDE_DLLS_IN_ARTIFACTS),)
OTHER_PROGRAMS += $(shell echo *.dll t/helper/*.dll)
endif
artifacts-tar:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) \
GIT-BUILD-OPTIONS $(TEST_PROGRAMS) $(test_bindir_programs) \
$(MOFILES)

Просмотреть файл

@ -1,6 +1,5 @@
resources:
- repo: self
fetchDepth: 1
variables:
Agent.Source.Git.ShallowFetchDepth: 1
jobs:
- job: windows_build
@ -131,6 +130,147 @@ jobs:
PathtoPublish: t/failed-test-artifacts
ArtifactName: failed-test-artifacts
- job: msvc_build
displayName: Windows (MSVC) Build
condition: succeeded()
pool: Hosted VS2017
timeoutInMinutes: 240
steps:
- powershell: |
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no
cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\
}
displayName: 'Mount test-cache'
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
- powershell: |
$urlbase = "https://dev.azure.com/git/git/_apis/build/builds"
$id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=9&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
$downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[0].resource.downloadUrl
(New-Object Net.WebClient).DownloadFile($downloadUrl, "compat.zip")
Expand-Archive compat.zip -DestinationPath . -Force
Remove-Item compat.zip
displayName: 'Download vcpkg artifacts'
- powershell: |
$urlbase = "https://dev.azure.com/git-for-windows/git/_apis/build/builds"
$id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=22&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
$downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[1].resource.downloadUrl
(New-Object Net.WebClient).DownloadFile($downloadUrl, "git-sdk-64-minimal.zip")
Expand-Archive git-sdk-64-minimal.zip -DestinationPath . -Force
Remove-Item git-sdk-64-minimal.zip
# Let Git ignore the SDK and the test-cache
"/git-sdk-64-minimal/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
displayName: 'Download git-sdk-64-minimal'
- powershell: |
& compat\vcbuild\vcpkg_copy_dlls.bat release
if (!$?) { exit(1) }
& git-sdk-64-minimal\usr\bin\bash.exe -lc @"
INCLUDE_DLLS_IN_ARTIFACTS=YesPlease \
ci/make-test-artifacts.sh artifacts
"@
if (!$?) { exit(1) }
displayName: Build
env:
HOME: $(Build.SourcesDirectory)
MSYSTEM: MINGW64
DEVELOPER: 1
NO_PERL: 1
MSVC: 1
VCPKG_ROOT: $(Build.SourcesDirectory)\compat\vcbuild\vcpkg
- task: PublishPipelineArtifact@0
displayName: 'Publish Pipeline Artifact: MSVC test artifacts'
inputs:
artifactName: 'msvc-artifacts'
targetPath: '$(Build.SourcesDirectory)\artifacts'
- task: PublishPipelineArtifact@0
displayName: 'Publish Pipeline Artifact: git-sdk-64-min-msvc'
inputs:
artifactName: 'git-sdk-64-min-msvc'
targetPath: '$(Build.SourcesDirectory)\git-sdk-64-minimal'
- powershell: |
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
}
displayName: 'Unmount test-cache'
condition: true
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
- job: msvc_test
displayName: Windows (MSVC) Test
dependsOn: msvc_build
condition: succeeded()
pool: Hosted
timeoutInMinutes: 240
strategy:
parallel: 10
steps:
- powershell: |
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no
cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\
}
displayName: 'Mount test-cache'
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact: MSVC test artifacts'
inputs:
artifactName: 'msvc-artifacts'
targetPath: '$(Build.SourcesDirectory)'
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact: git-sdk-64-min-msvc'
inputs:
artifactName: 'git-sdk-64-min-msvc'
targetPath: '$(Build.SourcesDirectory)\git-sdk-64-minimal'
- powershell: |
& git-sdk-64-minimal\usr\bin\bash.exe -lc @"
test -f artifacts.tar.gz || {
echo No test artifacts found\; skipping >&2
exit 0
}
tar xf artifacts.tar.gz || exit 1
# Let Git ignore the SDK and the test-cache
printf '%s\n' /git-sdk-64-minimal/ /test-cache/ >>.git/info/exclude
ci/run-test-slice.sh `$SYSTEM_JOBPOSITIONINPHASE `$SYSTEM_TOTALJOBSINPHASE || {
ci/print-test-failures.sh
exit 1
}
"@
if (!$?) { exit(1) }
displayName: 'Test (parallel)'
env:
HOME: $(Build.SourcesDirectory)
MSYSTEM: MINGW64
NO_SVN_TESTS: 1
GIT_TEST_SKIP_REBASE_P: 1
- powershell: |
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
}
displayName: 'Unmount test-cache'
condition: true
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
- task: PublishTestResults@2
displayName: 'Publish Test Results **/TEST-*.xml'
inputs:
mergeTestResults: true
testRunTitle: 'msvc'
platform: Windows
publishRunAttachments: false
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: 'Publish trash directories of failed tests'
condition: failed()
inputs:
PathtoPublish: t/failed-test-artifacts
ArtifactName: failed-msvc-test-artifacts
- job: linux_clang
displayName: linux-clang
condition: succeeded()

Просмотреть файл

@ -143,8 +143,8 @@ static int push_url_of_remote(struct remote *remote, const char ***url_p)
return remote->url_nr;
}
static NORETURN int die_push_simple(struct branch *branch,
struct remote *remote)
static NORETURN void die_push_simple(struct branch *branch,
struct remote *remote)
{
/*
* There's no point in using shorten_unambiguous_ref here,

Просмотреть файл

@ -116,6 +116,13 @@ then
CI_OS_NAME="$(echo "$AGENT_OS" | tr A-Z a-z)"
test darwin != "$CI_OS_NAME" || CI_OS_NAME=osx
CI_REPO_SLUG="$(expr "$BUILD_REPOSITORY_URI" : '.*/\([^/]*/[^/]*\)$')"
jobs=10
if test -n "$MSVC"
then
CC=compat/vcbuild/scripts/clink.pl
jobname=windows-msvc
jobs=4
fi
CC="${CC:-gcc}"
# use a subdirectory of the cache dir (because the file share is shared
@ -127,9 +134,9 @@ then
}
BREW_INSTALL_PACKAGES=gcc@8
export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save"
export GIT_PROVE_OPTS="--timer --jobs $jobs --state=failed,slow,save"
export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml"
MAKEFLAGS="$MAKEFLAGS --jobs=10"
MAKEFLAGS="$MAKEFLAGS --jobs=$jobs"
test windows_nt != "$CI_OS_NAME" ||
GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
else

Просмотреть файл

@ -1689,6 +1689,8 @@ char *mingw_getenv(const char *name)
if (!w_key)
die("Out of memory, (tried to allocate %u wchar_t's)", len_key);
xutftowcs(w_key, name, len_key);
/* GetEnvironmentVariableW() only sets the last error upon failure */
SetLastError(ERROR_SUCCESS);
len_value = GetEnvironmentVariableW(w_key, w_value, ARRAY_SIZE(w_value));
if (!len_value && GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
free(w_key);

Просмотреть файл

@ -68,8 +68,54 @@ while (@ARGV) {
} elsif ("$arg" =~ /^-L/ && "$arg" ne "-LTCG") {
$arg =~ s/^-L/-LIBPATH:/;
push(@lflags, $arg);
} elsif ("$arg" =~ /^-R/) {
} elsif ("$arg" =~ /^-[Rl]/) {
# eat
} elsif ("$arg" eq "-Werror") {
push(@cflags, "-WX");
} elsif ("$arg" eq "-Wall") {
# cl.exe understands -Wall, but it is really overzealous
push(@cflags, "-W4");
# disable the "signed/unsigned mismatch" warnings; our source code violates that
push(@cflags, "-wd4018");
push(@cflags, "-wd4245");
push(@cflags, "-wd4389");
# disable the "unreferenced formal parameter" warning; our source code violates that
push(@cflags, "-wd4100");
# disable the "conditional expression is constant" warning; our source code violates that
push(@cflags, "-wd4127");
# disable the "const object should be initialized" warning; these warnings affect only objects that are `static`
push(@cflags, "-wd4132");
# disable the "function/data pointer conversion in expression" warning; our source code violates that
push(@cflags, "-wd4152");
# disable the "non-constant aggregate initializer" warning; our source code violates that
push(@cflags, "-wd4204");
# disable the "cannot be initialized using address of automatic variable" warning; our source code violates that
push(@cflags, "-wd4221");
# disable the "possible loss of data" warnings; our source code violates that
push(@cflags, "-wd4244");
push(@cflags, "-wd4267");
# disable the "array is too small to include a terminating null character" warning; we ab-use strings to initialize OIDs
push(@cflags, "-wd4295");
# disable the "'<<': result of 32-bit shift implicitly converted to 64 bits" warning; our source code violates that
push(@cflags, "-wd4334");
# disable the "declaration hides previous local declaration" warning; our source code violates that
push(@cflags, "-wd4456");
# disable the "declaration hides function parameter" warning; our source code violates that
push(@cflags, "-wd4457");
# disable the "declaration hides global declaration" warning; our source code violates that
push(@cflags, "-wd4459");
# disable the "potentially uninitialized local variable '<name>' used" warning; our source code violates that
push(@cflags, "-wd4701");
# disable the "unreachable code" warning; our source code violates that
push(@cflags, "-wd4702");
# disable the "potentially uninitialized local pointer variable used" warning; our source code violates that
push(@cflags, "-wd4703");
# disable the "assignment within conditional expression" warning; our source code violates that
push(@cflags, "-wd4706");
# disable the "'inet_ntoa': Use inet_ntop() or InetNtop() instead" warning; our source code violates that
push(@cflags, "-wd4996");
} elsif ("$arg" =~ /^-W[a-z]/) {
# let's ignore those
} else {
push(@args, $arg);
}

Просмотреть файл

@ -1,3 +1,6 @@
#ifndef WIN32_PATH_UTILS_H
#define WIN32_PATH_UTILS_H
#define has_dos_drive_prefix(path) \
(isalpha(*(path)) && (path)[1] == ':' ? 2 : 0)
int win32_skip_dos_drive_prefix(char **path);
@ -18,3 +21,5 @@ static inline char *win32_find_last_dir_sep(const char *path)
#define find_last_dir_sep win32_find_last_dir_sep
int win32_offset_1st_component(const char *path);
#define offset_1st_component win32_offset_1st_component
#endif

Просмотреть файл

@ -550,7 +550,7 @@ static HANDLE swap_osfhnd(int fd, HANDLE new_handle)
typedef struct _OBJECT_NAME_INFORMATION
{
UNICODE_STRING Name;
WCHAR NameBuffer[0];
WCHAR NameBuffer[FLEX_ARRAY];
} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
#define ObjectNameInformation 1

Просмотреть файл

@ -1276,7 +1276,7 @@ static int add_index_entry_with_check(struct index_state *istate, struct cache_e
*/
if (istate->cache_nr > 0 &&
strcmp(ce->name, istate->cache[istate->cache_nr - 1]->name) > 0)
pos = -istate->cache_nr - 1;
pos = -1 - istate->cache_nr;
else
pos = index_name_stage_pos(istate, ce->name, ce_namelen(ce), ce_stage(ce));
@ -1894,7 +1894,7 @@ static size_t estimate_cache_size(size_t ondisk_size, unsigned int entries)
/*
* Account for potential alignment differences.
*/
per_entry += align_padding_size(sizeof(struct cache_entry), -sizeof(struct ondisk_cache_entry));
per_entry += align_padding_size(per_entry, 0);
return ondisk_size + entries * per_entry;
}

Просмотреть файл

@ -97,7 +97,7 @@ int sha1_pos(const unsigned char *sha1, void *table, size_t nr,
lo = mi + 1;
mi = lo + (hi - lo) / 2;
} while (lo < hi);
return -lo-1;
return -1 - lo;
}
int bsearch_hash(const unsigned char *sha1, const uint32_t *fanout_nbo,