Skip to content

Commit 2b20c9e

Browse files
committed
Merge pull request #2148 from dscho/azure-pipelines-msvc
Let the MSVC build also be tested in the Azure Pipeline
2 parents 2c21920 + 7f0d8a2 commit 2b20c9e

File tree

14 files changed

+234
-28
lines changed

14 files changed

+234
-28
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,6 +3027,10 @@ rpm::
30273027
@false
30283028
.PHONY: rpm
30293029

3030+
ifneq ($(INCLUDE_DLLS_IN_ARTIFACTS),)
3031+
OTHER_PROGRAMS += $(shell echo *.dll t/helper/*.dll)
3032+
endif
3033+
30303034
artifacts-tar:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) \
30313035
GIT-BUILD-OPTIONS $(TEST_PROGRAMS) $(test_bindir_programs) \
30323036
$(MOFILES)

azure-pipelines.yml

Lines changed: 143 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
resources:
2-
- repo: self
3-
fetchDepth: 1
1+
variables:
2+
Agent.Source.Git.ShallowFetchDepth: 1
43

54
jobs:
65
- job: windows_build
@@ -131,6 +130,147 @@ jobs:
131130
PathtoPublish: t/failed-test-artifacts
132131
ArtifactName: failed-test-artifacts
133132

133+
- job: msvc_build
134+
displayName: Windows (MSVC) Build
135+
condition: succeeded()
136+
pool: Hosted VS2017
137+
timeoutInMinutes: 240
138+
steps:
139+
- powershell: |
140+
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
141+
net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no
142+
cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\
143+
}
144+
displayName: 'Mount test-cache'
145+
env:
146+
GITFILESHAREPWD: $(gitfileshare.pwd)
147+
- powershell: |
148+
$urlbase = "https://dev.azure.com/git/git/_apis/build/builds"
149+
$id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=9&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
150+
$downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[0].resource.downloadUrl
151+
(New-Object Net.WebClient).DownloadFile($downloadUrl, "compat.zip")
152+
Expand-Archive compat.zip -DestinationPath . -Force
153+
Remove-Item compat.zip
154+
displayName: 'Download vcpkg artifacts'
155+
- powershell: |
156+
$urlbase = "https://dev.azure.com/git-for-windows/git/_apis/build/builds"
157+
$id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=22&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
158+
$downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[1].resource.downloadUrl
159+
(New-Object Net.WebClient).DownloadFile($downloadUrl, "git-sdk-64-minimal.zip")
160+
Expand-Archive git-sdk-64-minimal.zip -DestinationPath . -Force
161+
Remove-Item git-sdk-64-minimal.zip
162+
163+
# Let Git ignore the SDK and the test-cache
164+
"/git-sdk-64-minimal/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
165+
displayName: 'Download git-sdk-64-minimal'
166+
- powershell: |
167+
& compat\vcbuild\vcpkg_copy_dlls.bat release
168+
if (!$?) { exit(1) }
169+
& git-sdk-64-minimal\usr\bin\bash.exe -lc @"
170+
INCLUDE_DLLS_IN_ARTIFACTS=YesPlease \
171+
ci/make-test-artifacts.sh artifacts
172+
"@
173+
if (!$?) { exit(1) }
174+
displayName: Build
175+
env:
176+
HOME: $(Build.SourcesDirectory)
177+
MSYSTEM: MINGW64
178+
DEVELOPER: 1
179+
NO_PERL: 1
180+
MSVC: 1
181+
VCPKG_ROOT: $(Build.SourcesDirectory)\compat\vcbuild\vcpkg
182+
- task: PublishPipelineArtifact@0
183+
displayName: 'Publish Pipeline Artifact: MSVC test artifacts'
184+
inputs:
185+
artifactName: 'msvc-artifacts'
186+
targetPath: '$(Build.SourcesDirectory)\artifacts'
187+
- task: PublishPipelineArtifact@0
188+
displayName: 'Publish Pipeline Artifact: git-sdk-64-min-msvc'
189+
inputs:
190+
artifactName: 'git-sdk-64-min-msvc'
191+
targetPath: '$(Build.SourcesDirectory)\git-sdk-64-minimal'
192+
- powershell: |
193+
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
194+
cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
195+
}
196+
displayName: 'Unmount test-cache'
197+
condition: true
198+
env:
199+
GITFILESHAREPWD: $(gitfileshare.pwd)
200+
201+
- job: msvc_test
202+
displayName: Windows (MSVC) Test
203+
dependsOn: msvc_build
204+
condition: succeeded()
205+
pool: Hosted
206+
timeoutInMinutes: 240
207+
strategy:
208+
parallel: 10
209+
steps:
210+
- powershell: |
211+
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
212+
net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no
213+
cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\
214+
}
215+
displayName: 'Mount test-cache'
216+
env:
217+
GITFILESHAREPWD: $(gitfileshare.pwd)
218+
- task: DownloadPipelineArtifact@0
219+
displayName: 'Download Pipeline Artifact: MSVC test artifacts'
220+
inputs:
221+
artifactName: 'msvc-artifacts'
222+
targetPath: '$(Build.SourcesDirectory)'
223+
- task: DownloadPipelineArtifact@0
224+
displayName: 'Download Pipeline Artifact: git-sdk-64-min-msvc'
225+
inputs:
226+
artifactName: 'git-sdk-64-min-msvc'
227+
targetPath: '$(Build.SourcesDirectory)\git-sdk-64-minimal'
228+
- powershell: |
229+
& git-sdk-64-minimal\usr\bin\bash.exe -lc @"
230+
test -f artifacts.tar.gz || {
231+
echo No test artifacts found\; skipping >&2
232+
exit 0
233+
}
234+
tar xf artifacts.tar.gz || exit 1
235+
236+
# Let Git ignore the SDK and the test-cache
237+
printf '%s\n' /git-sdk-64-minimal/ /test-cache/ >>.git/info/exclude
238+
239+
ci/run-test-slice.sh `$SYSTEM_JOBPOSITIONINPHASE `$SYSTEM_TOTALJOBSINPHASE || {
240+
ci/print-test-failures.sh
241+
exit 1
242+
}
243+
"@
244+
if (!$?) { exit(1) }
245+
displayName: 'Test (parallel)'
246+
env:
247+
HOME: $(Build.SourcesDirectory)
248+
MSYSTEM: MINGW64
249+
NO_SVN_TESTS: 1
250+
GIT_TEST_SKIP_REBASE_P: 1
251+
- powershell: |
252+
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
253+
cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
254+
}
255+
displayName: 'Unmount test-cache'
256+
condition: true
257+
env:
258+
GITFILESHAREPWD: $(gitfileshare.pwd)
259+
- task: PublishTestResults@2
260+
displayName: 'Publish Test Results **/TEST-*.xml'
261+
inputs:
262+
mergeTestResults: true
263+
testRunTitle: 'msvc'
264+
platform: Windows
265+
publishRunAttachments: false
266+
condition: succeededOrFailed()
267+
- task: PublishBuildArtifacts@1
268+
displayName: 'Publish trash directories of failed tests'
269+
condition: failed()
270+
inputs:
271+
PathtoPublish: t/failed-test-artifacts
272+
ArtifactName: failed-msvc-test-artifacts
273+
134274
- job: linux_clang
135275
displayName: linux-clang
136276
condition: succeeded()

builtin/push.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ static int push_url_of_remote(struct remote *remote, const char ***url_p)
143143
return remote->url_nr;
144144
}
145145

146-
static NORETURN int die_push_simple(struct branch *branch,
147-
struct remote *remote)
146+
static NORETURN void die_push_simple(struct branch *branch,
147+
struct remote *remote)
148148
{
149149
/*
150150
* There's no point in using shorten_unambiguous_ref here,

ci/lib.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ then
116116
CI_OS_NAME="$(echo "$AGENT_OS" | tr A-Z a-z)"
117117
test darwin != "$CI_OS_NAME" || CI_OS_NAME=osx
118118
CI_REPO_SLUG="$(expr "$BUILD_REPOSITORY_URI" : '.*/\([^/]*/[^/]*\)$')"
119+
jobs=10
120+
if test -n "$MSVC"
121+
then
122+
CC=compat/vcbuild/scripts/clink.pl
123+
jobname=windows-msvc
124+
jobs=4
125+
fi
119126
CC="${CC:-gcc}"
120127

121128
# use a subdirectory of the cache dir (because the file share is shared
@@ -127,9 +134,9 @@ then
127134
}
128135

129136
BREW_INSTALL_PACKAGES=gcc@8
130-
export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save"
137+
export GIT_PROVE_OPTS="--timer --jobs $jobs --state=failed,slow,save"
131138
export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml"
132-
MAKEFLAGS="$MAKEFLAGS --jobs=10"
139+
MAKEFLAGS="$MAKEFLAGS --jobs=$jobs"
133140
test windows_nt != "$CI_OS_NAME" ||
134141
GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
135142
else

compat/mingw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,6 +2081,8 @@ char *mingw_getenv(const char *name)
20812081
if (!w_key)
20822082
die("Out of memory, (tried to allocate %u wchar_t's)", len_key);
20832083
xutftowcs(w_key, name, len_key);
2084+
/* GetEnvironmentVariableW() only sets the last error upon failure */
2085+
SetLastError(ERROR_SUCCESS);
20842086
len_value = GetEnvironmentVariableW(w_key, w_value, ARRAY_SIZE(w_value));
20852087
if (!len_value && GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
20862088
free(w_key);

compat/vcbuild/scripts/clink.pl

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,54 @@
5555
} elsif ("$arg" =~ /^-L/ && "$arg" ne "-LTCG") {
5656
$arg =~ s/^-L/-LIBPATH:/;
5757
push(@lflags, $arg);
58-
} elsif ("$arg" =~ /^-R/) {
58+
} elsif ("$arg" =~ /^-[Rl]/) {
5959
# eat
60+
} elsif ("$arg" eq "-Werror") {
61+
push(@cflags, "-WX");
62+
} elsif ("$arg" eq "-Wall") {
63+
# cl.exe understands -Wall, but it is really overzealous
64+
push(@cflags, "-W4");
65+
# disable the "signed/unsigned mismatch" warnings; our source code violates that
66+
push(@cflags, "-wd4018");
67+
push(@cflags, "-wd4245");
68+
push(@cflags, "-wd4389");
69+
# disable the "unreferenced formal parameter" warning; our source code violates that
70+
push(@cflags, "-wd4100");
71+
# disable the "conditional expression is constant" warning; our source code violates that
72+
push(@cflags, "-wd4127");
73+
# disable the "const object should be initialized" warning; these warnings affect only objects that are `static`
74+
push(@cflags, "-wd4132");
75+
# disable the "function/data pointer conversion in expression" warning; our source code violates that
76+
push(@cflags, "-wd4152");
77+
# disable the "non-constant aggregate initializer" warning; our source code violates that
78+
push(@cflags, "-wd4204");
79+
# disable the "cannot be initialized using address of automatic variable" warning; our source code violates that
80+
push(@cflags, "-wd4221");
81+
# disable the "possible loss of data" warnings; our source code violates that
82+
push(@cflags, "-wd4244");
83+
push(@cflags, "-wd4267");
84+
# disable the "array is too small to include a terminating null character" warning; we ab-use strings to initialize OIDs
85+
push(@cflags, "-wd4295");
86+
# disable the "'<<': result of 32-bit shift implicitly converted to 64 bits" warning; our source code violates that
87+
push(@cflags, "-wd4334");
88+
# disable the "declaration hides previous local declaration" warning; our source code violates that
89+
push(@cflags, "-wd4456");
90+
# disable the "declaration hides function parameter" warning; our source code violates that
91+
push(@cflags, "-wd4457");
92+
# disable the "declaration hides global declaration" warning; our source code violates that
93+
push(@cflags, "-wd4459");
94+
# disable the "potentially uninitialized local variable '<name>' used" warning; our source code violates that
95+
push(@cflags, "-wd4701");
96+
# disable the "unreachable code" warning; our source code violates that
97+
push(@cflags, "-wd4702");
98+
# disable the "potentially uninitialized local pointer variable used" warning; our source code violates that
99+
push(@cflags, "-wd4703");
100+
# disable the "assignment within conditional expression" warning; our source code violates that
101+
push(@cflags, "-wd4706");
102+
# disable the "'inet_ntoa': Use inet_ntop() or InetNtop() instead" warning; our source code violates that
103+
push(@cflags, "-wd4996");
104+
} elsif ("$arg" =~ /^-W[a-z]/) {
105+
# let's ignore those
60106
} else {
61107
push(@args, $arg);
62108
}

compat/win32/fscache.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ struct fsentry {
6565
struct timespec st_atim;
6666
struct timespec st_mtim;
6767
struct timespec st_ctim;
68-
};
69-
};
68+
} s;
69+
} u;
7070
};
7171

7272
/*
@@ -127,7 +127,7 @@ static struct fsentry *fsentry_alloc(struct fscache *cache, struct fsentry *list
127127
/* init the rest of the structure */
128128
fsentry_init(fse, list, nm, len);
129129
fse->next = NULL;
130-
fse->refcnt = 1;
130+
fse->u.refcnt = 1;
131131
return fse;
132132
}
133133

@@ -139,7 +139,7 @@ inline static void fsentry_addref(struct fsentry *fse)
139139
if (fse->list)
140140
fse = fse->list;
141141

142-
InterlockedIncrement(&(fse->refcnt));
142+
InterlockedIncrement(&(fse->u.refcnt));
143143
}
144144

145145
/*
@@ -150,7 +150,7 @@ static void fsentry_release(struct fsentry *fse)
150150
if (fse->list)
151151
fse = fse->list;
152152

153-
InterlockedDecrement(&(fse->refcnt));
153+
InterlockedDecrement(&(fse->u.refcnt));
154154
}
155155

156156
static int xwcstoutfn(char *utf, int utflen, const wchar_t *wcs, int wcslen)
@@ -205,11 +205,11 @@ static struct fsentry *fseentry_create_entry(struct fscache *cache, struct fsent
205205

206206
fse->st_mode = file_attr_to_st_mode(fdata->FileAttributes,
207207
fdata->EaSize, buf);
208-
fse->st_size = S_ISLNK(fse->st_mode) ? MAX_LONG_PATH :
208+
fse->u.s.st_size = S_ISLNK(fse->st_mode) ? MAX_LONG_PATH :
209209
fdata->EndOfFile.LowPart | (((off_t)fdata->EndOfFile.HighPart) << 32);
210-
filetime_to_timespec((FILETIME *)&(fdata->LastAccessTime), &(fse->st_atim));
211-
filetime_to_timespec((FILETIME *)&(fdata->LastWriteTime), &(fse->st_mtim));
212-
filetime_to_timespec((FILETIME *)&(fdata->CreationTime), &(fse->st_ctim));
210+
filetime_to_timespec((FILETIME *)&(fdata->LastAccessTime), &(fse->u.s.st_atim));
211+
filetime_to_timespec((FILETIME *)&(fdata->LastWriteTime), &(fse->u.s.st_mtim));
212+
filetime_to_timespec((FILETIME *)&(fdata->CreationTime), &(fse->u.s.st_ctim));
213213

214214
return fse;
215215
}
@@ -579,10 +579,10 @@ int fscache_lstat(const char *filename, struct stat *st)
579579
st->st_rdev = 0;
580580
st->st_nlink = 1;
581581
st->st_mode = fse->st_mode;
582-
st->st_size = fse->st_size;
583-
st->st_atim = fse->st_atim;
584-
st->st_mtim = fse->st_mtim;
585-
st->st_ctim = fse->st_ctim;
582+
st->st_size = fse->u.s.st_size;
583+
st->st_atim = fse->u.s.st_atim;
584+
st->st_mtim = fse->u.s.st_mtim;
585+
st->st_ctim = fse->u.s.st_ctim;
586586

587587
/* don't forget to release fsentry */
588588
fsentry_release(fse);

compat/win32/ntifs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ typedef struct _IO_STATUS_BLOCK {
9999
union {
100100
NTSTATUS Status;
101101
PVOID Pointer;
102-
} DUMMYUNIONNAME;
102+
} u;
103103
ULONG_PTR Information;
104104
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
105105

compat/win32/path-utils.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifndef WIN32_PATH_UTILS_H
2+
#define WIN32_PATH_UTILS_H
3+
14
#define has_dos_drive_prefix(path) \
25
(isalpha(*(path)) && (path)[1] == ':' ? 2 : 0)
36
int win32_skip_dos_drive_prefix(char **path);
@@ -18,3 +21,5 @@ static inline char *win32_find_last_dir_sep(const char *path)
1821
#define find_last_dir_sep win32_find_last_dir_sep
1922
int win32_offset_1st_component(const char *path);
2023
#define offset_1st_component win32_offset_1st_component
24+
25+
#endif

compat/winansi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ static HANDLE swap_osfhnd(int fd, HANDLE new_handle)
546546
typedef struct _OBJECT_NAME_INFORMATION
547547
{
548548
UNICODE_STRING Name;
549-
WCHAR NameBuffer[0];
549+
WCHAR NameBuffer[FLEX_ARRAY];
550550
} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
551551

552552
#define ObjectNameInformation 1

parse-options.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,9 @@ int parse_opt_commits(const struct option *, const char *, int);
282282
int parse_opt_tertiary(const struct option *, const char *, int);
283283
int parse_opt_string_list(const struct option *, const char *, int);
284284
int parse_opt_noop_cb(const struct option *, const char *, int);
285-
int parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx, const struct option *, const char *, int);
285+
enum parse_opt_result parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx,
286+
const struct option *opt,
287+
const char *arg, int unset);
286288
int parse_opt_passthru(const struct option *, const char *, int);
287289
int parse_opt_passthru_argv(const struct option *, const char *, int);
288290

pkt-line.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void packet_delim(int fd);
2525
void packet_write_fmt(int fd, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
2626
void packet_buf_flush(struct strbuf *buf);
2727
void packet_buf_delim(struct strbuf *buf);
28-
void set_packet_header(char *buf, int size);
28+
void set_packet_header(char *buf, const int size);
2929
void packet_write(int fd_out, const char *buf, size_t size);
3030
void packet_buf_write(struct strbuf *buf, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
3131
void packet_buf_write_len(struct strbuf *buf, const char *data, size_t len);

0 commit comments

Comments
 (0)