From patchwork Thu Sep 26 08:30:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161949 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6259A17EE for ; Thu, 26 Sep 2019 08:30:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41799222C3 for ; Thu, 26 Sep 2019 08:30:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DJVeDjNN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727436AbfIZIaM (ORCPT ); Thu, 26 Sep 2019 04:30:12 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:37223 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726564AbfIZIaL (ORCPT ); Thu, 26 Sep 2019 04:30:11 -0400 Received: by mail-lf1-f65.google.com with SMTP id w67so1037969lff.4 for ; Thu, 26 Sep 2019 01:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=vvWfyWe/pSI2Q4yl+6HpmxNLfmif9NwMsTGV9UJkH8c=; b=DJVeDjNNbS3aUO+qli+ywX6kRgjraedfZnR1jAVcWDZXwzkNUusWhkEIkE3l5tsvZ5 o9Uo3bBW/UbE0KJYSspcc6HJHpzmFco0ntzEyW3uOXE65qBzcJuHPxeTLXIZghlgdxoO k6SBF7aHbcQ9BbV04xjcU9SpOK55ARPeJbVgkWXPJAxph6uab51fUb72VUFj2R9gLdCW JGOGkwehTg7sFy+wxpi7OOCz8qrmUOuHXBeGFok/q+GfIJh8Qiy63hFa4i8e3mAORCto xuU5B0DdKc651g6/iltw+EuMiAlaWomc6rGol3E0Kp6ALq9NBaY35wTMEx9S/0uiJhPE kaYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=vvWfyWe/pSI2Q4yl+6HpmxNLfmif9NwMsTGV9UJkH8c=; b=Lu23EUUXQs+gu85KHKv8KJFXarcZnZi8t0mZK0iSRSmWk+1Dvq1n10Zb+Bs19YW26Y KI+0KH3BtrvmCJr6puzpKikSU/RYpTrwJxBfFpc4pH3qXwh6Ta1JJqW1lzS95NUjQ8AE IDE4HaTZXG0FKaRc5+APsMKptLNeoFYRZU5ahSRdXKwZ2vkxiSsNQLXxxZ3AHbKU1Kq8 P/89F1/K0eEBeb0Az9IDnNHvATC8eX7KfMz7/8uWruBIx/jHtxpPdLGacIuPvKHy5p/r LyFckOcakL8SRfd2kOwOSzo0xGJJZJTIYnXORMwGhejPfUARAF0NhMPu/aFZRI2DNuCl kH7w== X-Gm-Message-State: APjAAAVL8T7o2J9sa4PArL/ZV1euFt/FrCcNVghodU8lsHoLfPJQWAtA dZqFy0k0CvjMy5c0mT0x1t7VygTb X-Google-Smtp-Source: APXvYqzBIy+az3wp2qZ/FDtlpCkFFw4DbeE5B/DnMGJE52GCRI21QGv+IFMxjUWgfSzzb4vyPbn7Mw== X-Received: by 2002:a19:f707:: with SMTP id z7mr1459373lfe.142.1569486610091; Thu, 26 Sep 2019 01:30:10 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p3sm349911ljn.78.2019.09.26.01.30.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:09 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:09 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:29:54 GMT Message-Id: <4d0b38125a13d85963be5e524becf48271893e2b.1569486607.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 01/13] push: do not pretend to return `int` from `die_push_simple()` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin This function is marked as `NORETURN`, and it indeed does not want to return anything. So let's not declare it with the return type `int`. This fixes the following warning when building with MSVC: C4646: function declared with 'noreturn' has non-void return type Signed-off-by: Johannes Schindelin --- builtin/push.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/push.c b/builtin/push.c index 021dd3b1e4..d216270d5f 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -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, From patchwork Thu Sep 26 08:30:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161951 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F3CD76 for ; Thu, 26 Sep 2019 08:30:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 74CDA222C3 for ; Thu, 26 Sep 2019 08:30:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NSW6f2Mi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727831AbfIZIaO (ORCPT ); Thu, 26 Sep 2019 04:30:14 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:46204 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726564AbfIZIaO (ORCPT ); Thu, 26 Sep 2019 04:30:14 -0400 Received: by mail-lf1-f66.google.com with SMTP id t8so1008929lfc.13 for ; Thu, 26 Sep 2019 01:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=4On/JqewR73Dd+z/jZvxquH/PHjeU5FAUfmDuzBbrkU=; b=NSW6f2MiP7z3egAw+PSIEJMTAI9rWFa5LVTka9XExy8V2VF9BvKkUR+s5iicjpU36+ BooBNf98TOftWs3EMgGk9M09kJW+mlzdz95h+o4pkFxBzEbZRlfTRUx1dYll9GMs8xH3 rtNFJLHi/4qJEGimvjYxmeikWff82Mj2ZyWUKruz2zTqcjb412ThocFdkZRtIgQayz6G ykDvpdruSGEOlOz0p0kvbkGTGVXUtWBGnBPgySrUJvkHOIXGFnga0AwrAMHvHs3VMOmk KYADINEo5XF5yofYlSGpnsmELcyBwWYh8WuawBrqECFLLcXZ5rn1MQ4zbh371y4yOENE Kc6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=4On/JqewR73Dd+z/jZvxquH/PHjeU5FAUfmDuzBbrkU=; b=BQjoE9u6nJFAes1GQU0AJ0fF6YpvzkLv1UxJz4Kqywxs8t/OJ7c2Gq/ITmIPM7BPEq ASYQuPEC9gzIGotRhoyl7zVLY8kE8z6mOka8uOhfp7RtAqYX7f/sDiG1GP76PP5jPAQ5 4Yk8EJhZuyS95qneRSyE+lM/1xpYPnHQ6YhPx074VTGAuiyrMKzaANoVgIJkdZmJVyz/ DEw03ZTNe4Vymna9njkR9WteiS9EHnDU/8rkJqcFjw7KteMnhI95EX20n9ldryGVN61Q 7w8WABLEsf3HHZ6Nb0JGD9sDBbsIHx8w5P+1JuLrO5bqJR88OA1NlaoSJhSEio21NVv6 a12w== X-Gm-Message-State: APjAAAWgkb5a2wd2c57ufdtkTHusg8+SXL5fHpZ7AOye4YfvuolSUaqw E7U2kKBpTL6GWtA6FR5ZnTVYKAKA X-Google-Smtp-Source: APXvYqwTtfCw1uP/278kWLRi+70gX21wIWvb3s1VZkyrL+tA4e/gLytIIBjGR8xSxC61MczVAA60xA== X-Received: by 2002:ac2:4c2b:: with SMTP id u11mr1332072lfq.179.1569486611365; Thu, 26 Sep 2019 01:30:11 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b20sm339645ljo.106.2019.09.26.01.30.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:10 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:10 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:29:55 GMT Message-Id: <2abe1e1fb0bf3025489c2e543b9a9c648a164827.1569486607.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 02/13] msvc: avoid using minus operator on unsigned types Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin MSVC complains about this with `-Wall`, which can be taken as a sign that this is indeed a real bug. The symptom is: C4146: unary minus operator applied to unsigned type, result still unsigned Let's avoid this warning in the minimal way, e.g. writing `-1 - ` instead of `- - 1`. Note that the change in the `estimate_cache_size()` function is needed because MSVC considers the "return type" of the `sizeof()` operator to be `size_t`, i.e. unsigned, and therefore it cannot be negated using the unary minus operator. Even worse, that arithmetic is doing extra work, in vain. We want to calculate the entry extra cache size as the difference between the size of the `cache_entry` structure minus the size of the `ondisk_cache_entry` structure, padded to the appropriate alignment boundary. To that end, we start by assigning that difference to the `per_entry` variable, and then abuse the `len` parameter of the `align_padding_size()` macro to take the negative size of the ondisk entry size. Essentially, we try to avoid passing the already calculated difference to that macro by passing the operands of that difference instead, when the macro expects operands of an addition: #define align_padding_size(size, len) \ ((size + (len) + 8) & ~7) - (size + len) Currently, we pass A and -B to that macro instead of passing A - B and 0, where A - B is already stored in the `per_entry` variable, ready to be used. This is neither necessary, nor intuitive. Let's fix this, and have code that is both easier to read and that also does not trigger MSVC's warning. Signed-off-by: Johannes Schindelin --- read-cache.c | 4 ++-- sha1-lookup.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/read-cache.c b/read-cache.c index c701f7f8b8..11f3357216 100644 --- a/read-cache.c +++ b/read-cache.c @@ -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; } diff --git a/sha1-lookup.c b/sha1-lookup.c index 796ab68da8..c819687730 100644 --- a/sha1-lookup.c +++ b/sha1-lookup.c @@ -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, From patchwork Thu Sep 26 08:30:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161953 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4465017EE for ; Thu, 26 Sep 2019 08:30:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 22DFE222C3 for ; Thu, 26 Sep 2019 08:30:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rWgoM/LD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727975AbfIZIaP (ORCPT ); Thu, 26 Sep 2019 04:30:15 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:44377 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727528AbfIZIaO (ORCPT ); Thu, 26 Sep 2019 04:30:14 -0400 Received: by mail-lj1-f194.google.com with SMTP id m13so1207128ljj.11 for ; Thu, 26 Sep 2019 01:30:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=YnMTIPjZvbP+6ylmBnfB+NxC7dfryopwFIX8J+o4KjU=; b=rWgoM/LD8vjGTiddb696DVrw5/nQYpjo+3yi04IYagyqhtnZAZMnz4deP1dzkSzfzb dqdO1DuRST7i6KVdaqHsy71khpSyou3CKFdSnHUaKudAq8S47Zhy38xdp/CKPe3TQeU2 8fHeqFMNF4ssJl578xURXxl3fznesz9CCzbF31lKHYihaOYTt/UF7Q/M8ZNaFcRFvwKp oyG/su0wWL80xBHVrQrD8oRf+934CeO5e7kyQO/OnUSvAiiDqnFb51gcZ7S3fNFSTU9Q CQrOLh1bO9yMytiT8ejNSbk93P0uUT/SxlDKDjPYaeh4YfGXTd+iaRfgrXQb9yxkuVmN CfUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=YnMTIPjZvbP+6ylmBnfB+NxC7dfryopwFIX8J+o4KjU=; b=WpwVRbwF9a4i2Amf4/OipWOpe/HhYkXcNccoxbA3MJq4C6w5WSuU9sWvjLsqc98U+J cZ3zqqTpAwV2AqygnwwKaNv/XPs57XPa/0eKrTCUrKVThi6CoIXle88TDjgr/RqvqMnU vYxUpxJWXNcRdLNM4TGpeSlYi5e9I9BPfoqll+gjEka6ix18/aIR9vrahnnN+5gEWzIo cdS/sKr76fBenWsnNNd9DBF9OFL30m2RI6nbPIeazLHxMNUUPMq29W1y0+zO5x5FIqi+ x8ta9lPYrtT0bna9j8NRvgafspEDrmaMnJyiRX0X059Y2oFMd+9t6mCV7PANfyW9mGJe qpVA== X-Gm-Message-State: APjAAAWK64ie1Z6HT6Qj80AB+LbHHbXP2/L8HGL0RcqjKM95VsV4Rm/f AKmEuawInks+cm84tprDmb7OJGZd X-Google-Smtp-Source: APXvYqwEuZwSJZR8sq8v4rqx1ikzQNj7UP5F9xZeZGDcZhc8wb2r9zzo9kU6W9Tl0W8BJgKxpTHLSg== X-Received: by 2002:a2e:b0f4:: with SMTP id h20mr1746414ljl.10.1569486612524; Thu, 26 Sep 2019 01:30:12 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g3sm347287ljj.59.2019.09.26.01.30.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:12 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:12 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:29:56 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 03/13] winansi: use FLEX_ARRAY to avoid compiler warning Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin MSVC would complain thusly: C4200: nonstandard extension used: zero-sized array in struct/union Let's just use the `FLEX_ARRAY` constant that we introduced for exactly this type of scenario. Signed-off-by: Johannes Schindelin --- compat/winansi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/winansi.c b/compat/winansi.c index cacd82c833..54fd701cbf 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -546,7 +546,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 From patchwork Thu Sep 26 08:30:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161955 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC67D76 for ; Thu, 26 Sep 2019 08:30:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BBBB6222C3 for ; Thu, 26 Sep 2019 08:30:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lNEFpOsM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728332AbfIZIaQ (ORCPT ); Thu, 26 Sep 2019 04:30:16 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:38393 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727529AbfIZIaQ (ORCPT ); Thu, 26 Sep 2019 04:30:16 -0400 Received: by mail-lj1-f196.google.com with SMTP id b20so1232442ljj.5 for ; Thu, 26 Sep 2019 01:30:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=PwAFlDQ5FlWkf4x5wuYtwAm/soXttcp6NKf0ywJLbFQ=; b=lNEFpOsMiV4i2QOP2eCUsE5bqtpDB98teMW1lAH2ebJXhmJiSVTntzofuHF2tuK2ls TvNBt8kX6sIGXHPaEf1YqkyEWznLHbiL5HCnPmkZXa8Mt36AiWlr08VRrn02X7K+xESa QG4MIEzlOkr7uWzahnTSQ6TeQ1nbK0y2OQh8uLrnu878YyfBRAZnLFDlklh52/VeUIvd +YYiayO74XxfwXmlwYIMNdK+njidqjQ0mXLjR+zDC7Z51dxXcxqkZpeCsETVauca2pAk wBySIJsUsqC6oAGdn4ylNJwYtJUZVtCvxkvUzHmmIcB+Gr+vYhl4ABCvduL775lQkbeG DBuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=PwAFlDQ5FlWkf4x5wuYtwAm/soXttcp6NKf0ywJLbFQ=; b=aB2bOrbI3JtXgI+DaOXiS88ggZXbZUkffdCzuWrlP36MKR/RDIujopJ32pvts1efaT 9rbmV/nJktQPd6XnthvMniWAQKfeldfzHbG+NLv/P5UBSvja0oa2jMLg42JrSC20UTQO bQ/0KksvkL6gWVlKl90Gz+WkoP/QntUYkvt1a96SzJfbwGxu8CS2wdXX4TunTRM8IU5f kDUOITEqM87JVQumcM5Hkzc7VHST10OrBDxZiYijG2Y7LsRYWmKMmOia7mKiTqQ15sLT h/qkTnl0L8f2Hzw/TyLJ6A72igpcqFGqyGvcTPtWyIOZn7eqeFqIr4WOhM0tlRIS3lQP 59hQ== X-Gm-Message-State: APjAAAWhrRRLCnGGvxKJ6JXrfb0/DynTWgAZkcDUD9Qm04LDdQne8ZU2 w0CCOPyXn6Q6QN4wPhZXWDZWNTSO X-Google-Smtp-Source: APXvYqy10PE5eU3QitC7CojplyYJRDFKU6nE4USLbzabSp+Uq8L5+2Rweq3JGJL23uEvUMoDVr3zGA== X-Received: by 2002:a2e:80d3:: with SMTP id r19mr1701655ljg.41.1569486613657; Thu, 26 Sep 2019 01:30:13 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q24sm411836ljj.6.2019.09.26.01.30.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:13 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:13 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:29:57 GMT Message-Id: <6417d6f68953f0d7530e6c61bdd09348adade088.1569486607.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 04/13] compat/win32/path-utils.h: add #include guards Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin This adds the common guards that allow headers to be #include'd multiple times. Signed-off-by: Johannes Schindelin --- compat/win32/path-utils.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compat/win32/path-utils.h b/compat/win32/path-utils.h index 0f70d43920..8ed062a6b7 100644 --- a/compat/win32/path-utils.h +++ b/compat/win32/path-utils.h @@ -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 From patchwork Thu Sep 26 08:30:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161957 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B54D76 for ; Thu, 26 Sep 2019 08:30:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EC604222C3 for ; Thu, 26 Sep 2019 08:30:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="p27yFV98" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728428AbfIZIaS (ORCPT ); Thu, 26 Sep 2019 04:30:18 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:39452 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727528AbfIZIaQ (ORCPT ); Thu, 26 Sep 2019 04:30:16 -0400 Received: by mail-lj1-f196.google.com with SMTP id y3so1231155ljj.6 for ; Thu, 26 Sep 2019 01:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=zteYf+iycQJu2502hnxx/ZRaVqCtAFJWK+KlHVf9BQc=; b=p27yFV98a2d7jClf7kiTqeP2tI0JZ7NKhKE0gTETf7d5PA+nkviIi2JO+K/Cw1EbI6 bM+ZPXh73DjM60A62T9IFp3Pq5yx9YvjZhCbHeU2cntkI1yHWHpbf2wSJwgb4fVC8hKB ki3Zz2/hgP3W1d5iGze5meqHZIXQItzVfNF9EIw5+NdWlbqjjkfq25VRlan2Az9xBN/y 7oY5daac+4ln8JhFeY+flvCNFsaVysLdJPiSW12sdVe8rHOQsxMirpFXSAtdytbPx4MZ QDFLCHbeRB9WptvE+b7LQjkdL1oRRS6VzURlzcS5FnqOvhm6G9hC7RjI7VpmBbA2aZxF OPBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=zteYf+iycQJu2502hnxx/ZRaVqCtAFJWK+KlHVf9BQc=; b=mAW4/lGtL2KSE9h4uo/wte2ZNo1MUswjNRcPnGaymzQm+KfUpNktxjuH+34VwqGRu1 xpGMdiquETr0c8YMOCiFf21XTKXMwF/EntFjuViCsQuX26+sc8eHTFxss8VxFqi1FUrY cQ4N3JUFRdfuoLfcV8tpsAQXskprpDqITpH4Y6ESTio5uSEU4GKkBTRho1kK2gNkrZGy 3v4VtyPjbuG8esTKLgrP3RQZOv3UY6opaBlk9SNRSnrhUfke0li8NCmB4+0TZ18tG/er EcMP/fGELRHThYSpQAH6Z5ppo70rkAa+asdSpQ+cRg6/+wy53cG+RNURM6MIGI+OxKCy rb6Q== X-Gm-Message-State: APjAAAX3KzfPSedEog4VX8NLM9OD2ZW4Wk/p1rlex23NzMfFDG1vdEG5 uia0WInM6xAwnvNJqvNXBJZVL8j1 X-Google-Smtp-Source: APXvYqyUpIiMoE7eynjgVDfqAngg0zUR/gg8RffwT3vMCuSdbZKw2DLYfxD0AeMYEUKMntfvj2mYzA== X-Received: by 2002:a2e:8616:: with SMTP id a22mr1726076lji.6.1569486614847; Thu, 26 Sep 2019 01:30:14 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j84sm352352ljb.91.2019.09.26.01.30.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:14 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:14 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:29:58 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 05/13] msvc: ignore some libraries when linking Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin To build with MSVC, we "translate" GCC options to MSVC options, and part of those options refer to the libraries to link into the final executable. Currently, this part looks somewhat like this on Windows: -lcurl -lnghttp2 -lidn2 -lssl -lcrypto -lssl -lcrypto -lgdi32 -lcrypt32 -lwldap32 -lz -lws2_32 -lexpat Some of those are direct dependencies (such as curl and ssl) and others are indirect (nghttp2 and idn2, for example, are dependencies of curl, but need to be linked in for reasons). We already handle the direct dependencies, e.g. `-liconv` is already handled as adding `libiconv.lib` to the list of libraries to link against. Let's just ignore the remaining `-l*` options so that MSVC does not have to warn us that it ignored e.g. the `/lnghttp2` option. We do that by extending the clause that already "eats" the `-R*` options to also eat the `-l*` options. Signed-off-by: Johannes Schindelin --- compat/vcbuild/scripts/clink.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/vcbuild/scripts/clink.pl b/compat/vcbuild/scripts/clink.pl index c7b021bfac..00fc339cba 100755 --- a/compat/vcbuild/scripts/clink.pl +++ b/compat/vcbuild/scripts/clink.pl @@ -68,7 +68,7 @@ } elsif ("$arg" =~ /^-L/ && "$arg" ne "-LTCG") { $arg =~ s/^-L/-LIBPATH:/; push(@lflags, $arg); - } elsif ("$arg" =~ /^-R/) { + } elsif ("$arg" =~ /^-[Rl]/) { # eat } else { push(@args, $arg); From patchwork Thu Sep 26 08:30:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161959 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64D9276 for ; Thu, 26 Sep 2019 08:30:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42A99222C0 for ; Thu, 26 Sep 2019 08:30:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="enK5Xlco" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728637AbfIZIaS (ORCPT ); Thu, 26 Sep 2019 04:30:18 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:43032 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727529AbfIZIaS (ORCPT ); Thu, 26 Sep 2019 04:30:18 -0400 Received: by mail-lj1-f196.google.com with SMTP id n14so1213555ljj.10 for ; Thu, 26 Sep 2019 01:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=PTJvnArUvKNsOxVEuhJbTo8k3kGB1/WAG8v2GjmdSbc=; b=enK5XlcoK5z0eyvh+UUNaqn4mqRzi51HsomZ6qwb/vEs1RtL1q+EoLQelsThCfRPld tsnQ2BN0A/utH7B84qUjDI7yU68DtzRh4nhgx4VZzcv97a6NJ8VhXGL71jeDSHjWRDyl bzwgN9cPPWB6NrsiIM0G6dzapssaT9nYVDNurndDVL3mAsbWs1aoPWhCeSMpfKqBTvE/ TuZ7NCXlspDaVA/qwijiiKKhDQa0idKQ3xLdJDXF7PpsqHDTmuukQIO71ZLHqpUAbIni TDg/xWlx9zJP14S7hTHV/hoX50AOWXi70hb4sjDIBHY1CST7lfUndhLcRGtHZB7qCl/n l/wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=PTJvnArUvKNsOxVEuhJbTo8k3kGB1/WAG8v2GjmdSbc=; b=SFI6IOx51Eh08p8HHfrt0V9X5rql7DHLPrXYrCLL8Zh6vAlP9CE83eaw3gJkMUPfmd qGq6/n4sU8dgMPdbXYGpyk4fIkJg1DC6xt9p83efi/gHsvzGjxv0fZJSrbFwef615P5Q aWWOr7fg70S3ReuuyWj1hSk5nSkoldSBQVL6yzq+mP6f/hxgaJzy840ksXg7phAPQ5P9 Ji1DCn8dmB3W5XLyy3LhfOsOeUyLoltoMagcs/aNVDsEaWWNEdva5MNSlVZ7p5xhaAQV cfbiNv+Iw0TvdiKADNjJxhhdh1w9oU8S1Sh8A8m4TwrzjaDYhhU8hGIeti3cBrWS71P9 9Mwg== X-Gm-Message-State: APjAAAWLhHi3thqb5Dep23nKhx+zFBdoILvW9HJXtuv4TTQnpiO3PsmK buUBQhT7fCUL5APjCISiFDg4IYs5 X-Google-Smtp-Source: APXvYqykGSYzHn69NnVzoslZgHrlFqACU6m1LOl0Chl3NSdnw44zujz7LCBUKSyPWe3B9vzZph748Q== X-Received: by 2002:a2e:86d5:: with SMTP id n21mr1652919ljj.1.1569486616254; Thu, 26 Sep 2019 01:30:16 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 3sm343153ljs.20.2019.09.26.01.30.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:15 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:15 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:29:59 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 06/13] msvc: handle DEVELOPER=1 Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin We frequently build Git using the `DEVELOPER=1` make setting as a shortcut to enable all kinds of more stringent compiler warnings. Those compiler warnings are relatively specific to GCC, though, so let's try our best to translate them to the equivalent options to pass to MS Visual C++'s `cl.exe`. Signed-off-by: Johannes Schindelin --- compat/vcbuild/scripts/clink.pl | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/compat/vcbuild/scripts/clink.pl b/compat/vcbuild/scripts/clink.pl index 00fc339cba..ec95a3b2d0 100755 --- a/compat/vcbuild/scripts/clink.pl +++ b/compat/vcbuild/scripts/clink.pl @@ -70,6 +70,52 @@ push(@lflags, $arg); } 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 '' 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); } From patchwork Thu Sep 26 08:30:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161961 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1749912 for ; Thu, 26 Sep 2019 08:30:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C01B1222C0 for ; Thu, 26 Sep 2019 08:30:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EYp/snAp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728845AbfIZIaV (ORCPT ); Thu, 26 Sep 2019 04:30:21 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45118 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728554AbfIZIaT (ORCPT ); Thu, 26 Sep 2019 04:30:19 -0400 Received: by mail-lj1-f195.google.com with SMTP id q64so1203424ljb.12 for ; Thu, 26 Sep 2019 01:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=RVE9a0xIxOv1m/oHcTcIhY+O/HERoXxmdzKfXgJwF88=; b=EYp/snAp4QcGcUQM6qkIOnI5eqMV6O/yDL5YpU8BePg1HSQgnY6wo3C03iTa8Be8JY yJNlhbY957Ogfv4Vm8wNRvSUQgiG8WtpIfzIUy4kN8Bb6h4Yfr80Pc4i+eE8Zu4f6W8k ruytie/lPrQj3FuT6dc6/goeEzwKzf+PfqQn7ccVo2zo3W674jB5VJZzG7U8B6pFKu0V PvcPReEDT0Rm/7qgJ12X7biFqrp4dGtH3ppZbzRpQDO+tT7KpATw3fMf7iee+jUCPGCZ njR7CyQyvrnQu+0LlS4EvutdSGvpmwfSmmYwaXtenbbXWh6Ov/zAvHjAQrVJA0mfEfxx AgGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=RVE9a0xIxOv1m/oHcTcIhY+O/HERoXxmdzKfXgJwF88=; b=GKEjkezZph1qx/663WfcsoMmpQItVwf1AiC1PsZ/9iKXzUro+yPeo+H2If9gamaGrL ojWtBUQ1kpspLhsZ4Vr26F2unGOe4P0Rf3roJ5tUNZIVK9ImPUTHF1tujPqHJ3Cb5BnJ 4U9jrG5UD5G8XnIm2axg5p44ylA8supa0jRHZ8LLIhxRzpsS6m7iVq0BkdSatmCZlcjJ 880MrRgX+KDguXnavZk/qXNlvoq5RKSYsnIPyVbYCNymBzrEzIFhAjlr/QJ7pdDFtpLT eXgUL/cWQLVj6DQzl1jlI/Ht/tOnuk6QNbaL2AM9SoeHKRDk6ssoSgnwycH0elKU0fKf WDFw== X-Gm-Message-State: APjAAAWe8zfYK+84lhkKkSk4UWpxBERNKhSn9xbhFc5bQ7SJ8+/YZ2RE gCTLGhxKv40M69Jpjy1XI20gWpmv X-Google-Smtp-Source: APXvYqzu4lC6yoOWfXVEQrA7Xq+V2g78TCG1kYHFXNS5r+HeGxsFn2lpHpCIoHoLgXymRNAXe1vDbQ== X-Received: by 2002:a2e:3e09:: with SMTP id l9mr1701329lja.215.1569486617467; Thu, 26 Sep 2019 01:30:17 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 196sm340572ljj.76.2019.09.26.01.30.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:17 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:17 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:30:00 GMT Message-Id: <0590514e43a32a96de87f144439936b66d0723e6.1569486607.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 07/13] msvc: work around a bug in GetEnvironmentVariable() Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin The return value of that function is 0 both for variables that are unset, as well as for variables whose values are empty. To discern those two cases, one has to call `GetLastError()`, whose return value is `ERROR_ENVVAR_NOT_FOUND` and `ERROR_SUCCESS`, respectively. Except that it is not actually set to `ERROR_SUCCESS` in the latter case, apparently, but the last error value seems to be simply unchanged. To work around this, let's just re-set the last error value just before inspecting the environment variable. This fixes a problem that triggers failures in t3301-notes.sh (where we try to override config settings by passing empty values for certain environment variables). This problem is hidden in the MINGW build by the fact that older MSVC runtimes (such as the one used by MINGW builds) have a `calloc()` that re-sets the last error value in case of success, while newer runtimes set the error value only if `NULL` is returned by that function. Signed-off-by: Johannes Schindelin --- compat/mingw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/mingw.c b/compat/mingw.c index 4891789771..7d8cb814ba 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1661,6 +1661,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); From patchwork Thu Sep 26 08:30:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161963 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30EFD76 for ; Thu, 26 Sep 2019 08:30:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0F922222C0 for ; Thu, 26 Sep 2019 08:30:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fY0q3eob" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729127AbfIZIaZ (ORCPT ); Thu, 26 Sep 2019 04:30:25 -0400 Received: from mail-lj1-f177.google.com ([209.85.208.177]:42576 "EHLO mail-lj1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727529AbfIZIaV (ORCPT ); Thu, 26 Sep 2019 04:30:21 -0400 Received: by mail-lj1-f177.google.com with SMTP id y23so1210366lje.9 for ; Thu, 26 Sep 2019 01:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=uc1FRuQv1blFb9Pgjg/gjq1hKALg3HS9Tf2+tLI+NHg=; b=fY0q3eobDgtfmRipds/xbX1JRJSUuFz+b7F9aLapwKZctaIEtBJgFd2aa3TvoFprMg oJOwhmwYzxHwz4SnqM00gulZ9RTvtG7j9hk3mBIADtH9N1AaZYA9X3QmLHAL+aOjcHrm Sg2BJtcUjqQ6s9RzgUesbw0nlABj2+1YDeeS6RT3Oxr7ViDSY1h7NZa4twHZy1SuNPuU m2Rw6LZs8GKh2Wk7CLTvmiXOdOvEtNvxax62vPUowU+0lKGh0q4wBPqPlAkDfMMdbdCZ iEITuhA8di+RKz3V634NYuIpd17eKMs/Skjb2cAFWILPnjSYFDKRxG3WmyT+FrbONaW3 eBNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=uc1FRuQv1blFb9Pgjg/gjq1hKALg3HS9Tf2+tLI+NHg=; b=Ukok4vuO148UMlrUUuuPYHnZTVOYVSDzkYXYi+gzSf28r6jiESLpaECvM/S4248Bse lOoq4qWSyvtd0PxmaKrajLSdxhRKADddRGdvgY9L1wYCKS2DMQ8rnn8dkWmH9Vi2GGSS LjdGz15dIDttCZsKi4XeE1UitmySdkUxFGH9kAvQGIWNLl1tXoKxfrkp7gfmdVtj7ktv L6vmvrbBMiyX+mfJZf4w1O3dWgFAKHzSpcdhVKnSJ5rlzbiTG/7QEQt3P6X95UqjEQcQ ZSfTCn1fLNHREPVejRazJgwxYn9AZes33289OUNO3LcAO6bY1wXQqWLbBcSRam1k+Uap 8ozw== X-Gm-Message-State: APjAAAWKr0nbjynskwNRNS94mlYUG7gVxTsnPFrHHuRucXd7PSeRakA2 5HuvSMa1ZsPCCU4u441tMAd2FHVz X-Google-Smtp-Source: APXvYqx432WSk2YTFlPe6XK7kGFkG8lieLPEZ8KGlRwUQyuSAmJWSGHdN4saFKQP9p2wYpIekbVmOg== X-Received: by 2002:a2e:9d16:: with SMTP id t22mr1462059lji.207.1569486619088; Thu, 26 Sep 2019 01:30:19 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k15sm351954ljg.65.2019.09.26.01.30.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:18 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:18 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:30:01 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 08/13] vcxproj: only copy `git-remote-http.exe` once it was built Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin In b18ae14a8f6 (vcxproj: also link-or-copy builtins, 2019-07-29), we started to copy or hard-link the built-ins as a post-build step of the `git` project. At the same time, we tried to copy or hard-link `git-remote-http.exe`, but it is quite possible that it was not built at that time. Let's move that latter task into a post-install step of the `git-remote-http` project instead. Signed-off-by: Johannes Schindelin --- config.mak.uname | 10 +++++++--- contrib/buildsystems/Generators/Vcxproj.pm | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/config.mak.uname b/config.mak.uname index db7f06b95f..701aad62b1 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -703,20 +703,24 @@ vcxproj: perl contrib/buildsystems/generate -g Vcxproj git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj - # Generate the LinkOrCopyBuiltins.targets file + # Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file (echo '' && \ echo ' ' && \ for name in $(BUILT_INS);\ do \ echo ' '; \ done && \ + echo ' ' && \ + echo '') >git/LinkOrCopyBuiltins.targets + (echo '' && \ + echo ' ' && \ for name in $(REMOTE_CURL_ALIASES); \ do \ echo ' '; \ done && \ echo ' ' && \ - echo '') >git/LinkOrCopyBuiltins.targets - git add -f git/LinkOrCopyBuiltins.targets + echo '') >git-remote-http/LinkOrCopyRemoteHttp.targets + git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets # Add command-list.h $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 command-list.h diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm index 576ccabe1d..868b787855 100644 --- a/contrib/buildsystems/Generators/Vcxproj.pm +++ b/contrib/buildsystems/Generators/Vcxproj.pm @@ -277,6 +277,9 @@ sub createProject { if ($target eq 'git') { print F " \n"; } + if ($target eq 'git-remote-http') { + print F " \n"; + } print F << "EOM"; EOM From patchwork Thu Sep 26 08:30:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161967 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 664B2912 for ; Thu, 26 Sep 2019 08:30:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43898222C0 for ; Thu, 26 Sep 2019 08:30:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QHaf/zpB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729092AbfIZIaY (ORCPT ); Thu, 26 Sep 2019 04:30:24 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:38402 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728638AbfIZIaW (ORCPT ); Thu, 26 Sep 2019 04:30:22 -0400 Received: by mail-lj1-f193.google.com with SMTP id b20so1232850ljj.5 for ; Thu, 26 Sep 2019 01:30:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=BFyAjQnd1YVfz2Ku67xIMyrmgwG0vlKeKxSQ3lSdH1M=; b=QHaf/zpB5j9ml/Wr78i/OZ9IyJWckNfDuxOo4MdDGv+x4LO2lJP/dboV5cwAQmFavA Q3tvakkQdIjbqHA3WGNLlZaH0r9akbo9OFx+VkFc2L8s6CYmI8cVh0Fc486e2zNe1E6/ 9UfyIJUfqBPVmb68+3IhPbodKuqkNIV8+9zs2P/426GNv0hBWgzUj4RhC6xlDk4F8omb YDrHF0EyXr9ObcQI7MX2wQL3vjzO3zLRQ9+bx/Efv9sEdebFT4OxQqzKM7GPgHENj6+3 vTN6GPhXtLhT0uyF7wVBFo/Y88QZLi8vY9Ja9+YJ3gUA40ZKBW77NMyD+DYKTnuAGD4X IA2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=BFyAjQnd1YVfz2Ku67xIMyrmgwG0vlKeKxSQ3lSdH1M=; b=jQmKAZTijyY5kZ19BhQyxuHdfttPx5H57ZDAvskJi7Iv9NN4NNktsHUjZdKP5tgIt+ ymWVA48EJvSaTFMuGLUBObPbtu0SdTKzkqulD4Mp1dTkA6ym7wKer8j5xuIPitUUiU1u et9YtgtueqPXlB07MwA14RYicgJHi1GPgS5TnQByuhFRNMLOPEHlrLP4NcX6mNxjjhZB RsKIkBKkNQFopZxwWHw2nFHlMwIYuP2vHVBBs72HmeV0ictDVwmb1Mng7Bu8oh6OXwq+ KLmpvHRsDI6EF3xmvx40wU5oesQG2s5zjwhJt1IxJWmyiNoFGLTeCChqf3zpd1j1kVOE vP4w== X-Gm-Message-State: APjAAAX9ARWcA5NVieEaOJF9D7fHUFXpzWTGqF413pc5MMNL/i8afmcV zHyVaY7ij/E3YUovP0m2k8qn11fz X-Google-Smtp-Source: APXvYqyUgz0MQfHLJrrJ3MPwqb8pGLOEIbeLMKVIZnJDGXaBQyRbqLMwZ/Q4T2JpHfor4Pd+q7F92w== X-Received: by 2002:a2e:a17b:: with SMTP id u27mr1698002ljl.65.1569486620481; Thu, 26 Sep 2019 01:30:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n3sm381655lfl.62.2019.09.26.01.30.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:20 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:20 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:30:02 GMT Message-Id: <6adfc63e98b481c25dc45ed96caeaeb20a70f9fa.1569486607.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 09/13] vcxproj: include more generated files Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin In the CI builds, we bundle all generated files into a so-called artifacts `.tar` file, so that the test phase can fan out into multiple parallel builds. This patch makes sure that all files are included in the `vcxproj` target which are needed for that artifacts `.tar` file. Signed-off-by: Johannes Schindelin --- config.mak.uname | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config.mak.uname b/config.mak.uname index 701aad62b1..cc8efd95b1 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -728,11 +728,10 @@ vcxproj: # Add scripts rm -f perl/perl.mak - $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 \ - $(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN) + $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(SCRIPT_LIB) $(SCRIPTS) # Strip out the sane tool path, needed only for building sed -i '/^git_broken_path_fix ".*/d' git-sh-setup - git add -f $(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN) + git add -f $(SCRIPT_LIB) $(SCRIPTS) # Add Perl module $(MAKE) $(LIB_PERL_GEN) @@ -762,6 +761,10 @@ vcxproj: $(MAKE) -C templates git add -f templates/boilerplates.made templates/blt/ + # Add the translated messages + make MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(MOFILES) + git add -f $(MOFILES) + # Add build options $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS git add -f GIT-BUILD-OPTIONS From patchwork Thu Sep 26 08:30:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161965 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D531D912 for ; Thu, 26 Sep 2019 08:30:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AAC2B222C7 for ; Thu, 26 Sep 2019 08:30:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FHlgFEd1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729175AbfIZIaZ (ORCPT ); Thu, 26 Sep 2019 04:30:25 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:40052 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728554AbfIZIaY (ORCPT ); Thu, 26 Sep 2019 04:30:24 -0400 Received: by mail-lf1-f67.google.com with SMTP id d17so1025548lfa.7 for ; Thu, 26 Sep 2019 01:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=HGFrFNyVHi280AGFhSwMmw4T+7XoU3wVKH7GZLHn6U0=; b=FHlgFEd1nvw25b6ijKsbekILav2bGJDy+0YMv+tDdU2ojEOhRzYXYeOUWxGxhRXDVs 0qlvozqTlD71aJIxg6hkoSwxcKEVHkdoWg2mf0+9UfYVQLl7VK5ILJb0ajJBFiBRAk7u LeE44JPhz96bpsPWLRoZeF+CM+82/YzAA64fh7pdgU+8z7psJ5ZVYER7kN6sKVF4U/iE 1XUqaZVge7Oh0QPjxyaRsXABPxML4kU7cvg5gXKTygghRjVMUXG1/A4F44KrstmjNWWL M3zYcrvHJT8zVu7GQOx2hDWrNpvhWS/jPtfpvPaUp6lzjbnggXpUd5FBqzali0FYhpys R4cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=HGFrFNyVHi280AGFhSwMmw4T+7XoU3wVKH7GZLHn6U0=; b=ec4h1CCOmcVj4aJhU/PYHfLvRE4ofBd3AiycCgqnFSQ81Yis5Q08RuySNTBwDid9N1 tRfNntiMm5N77yILVgSsRD2a65KBBNiFOJPkP3YtR3t7sU1NmqP4dXJgzVwda3soVStg JDvGlQJtMvTgu9EgL0xY/CVhrahri7hlM3CmAHZ/QvJQvb5Db0EZhbYTshWfj8VBZHab +HcI/suXw4zM9UnKZr6LHULca4S4yl2Y9law5CNDDrFxZytb0QrVJBuWhTH7f+BeTlob 5sB3UknHeDvJL177MFL00xa2i9FxAwVOILFbx+VGjY4sfy5kdAaEmbZz9LqpNZA+PQU/ cSeQ== X-Gm-Message-State: APjAAAW7780Ms2wrM9f1JSbwOBjRQXNO/SPQSyZ4cMW0H55HIR1PLphP OhAyLfLN+NT9ycnt/NKtn7Uf1h+H X-Google-Smtp-Source: APXvYqzwkitjFbo3JmJOC1tyf3ptTa4f9qlwlttkpkxn+9HzzxLjl4VB/Wr1b60y5Z6Jk0Ew2csdFw== X-Received: by 2002:ac2:5966:: with SMTP id h6mr1476616lfp.78.1569486621713; Thu, 26 Sep 2019 01:30:21 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n2sm344988ljj.30.2019.09.26.01.30.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:21 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:21 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:30:03 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 10/13] test-tool run-command: learn to run (parts of) the testsuite Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin Git for Windows jumps through hoops to provide a development environment that allows to build Git and to run its test suite. To that end, an entire MSYS2 system, including GNU make and GCC is offered as "the Git for Windows SDK". It does come at a price: an initial download of said SDK weighs in with several hundreds of megabytes, and the unpacked SDK occupies ~2GB of disk space. A much more native development environment on Windows is Visual Studio. To help contributors use that environment, we already have a Makefile target `vcxproj` that generates a commit with project files (and other generated files), and Git for Windows' `vs/master` branch is continuously re-generated using that target. The idea is to allow building Git in Visual Studio, and to run individual tests using a Portable Git. The one missing thing is a way to run the entire test suite: neither `make` nor `prove` are required to run Git, therefore Git for Windows does not support those commands in the Portable Git. To help with that, add a simple test helper that exercises the `run_processes_parallel()` function to allow for running test scripts in parallel (which is really necessary, especially on Windows, as Git's test suite takes such a long time to run). This will also come in handy for the upcoming change to our Azure Pipeline: we will use this helper in a Portable Git to test the Visual Studio build of Git. Signed-off-by: Johannes Schindelin --- t/helper/test-run-command.c | 153 ++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c index 2cc93bb69c..ead6dc611a 100644 --- a/t/helper/test-run-command.c +++ b/t/helper/test-run-command.c @@ -10,9 +10,14 @@ #include "test-tool.h" #include "git-compat-util.h" +#include "cache.h" #include "run-command.h" #include "argv-array.h" #include "strbuf.h" +#include "parse-options.h" +#include "string-list.h" +#include "thread-utils.h" +#include "wildmatch.h" #include #include @@ -50,11 +55,159 @@ static int task_finished(int result, return 1; } +struct testsuite { + struct string_list tests, failed; + int next; + int quiet, immediate, verbose, verbose_log, trace, write_junit_xml; +}; +#define TESTSUITE_INIT \ + { STRING_LIST_INIT_DUP, STRING_LIST_INIT_DUP, -1, 0, 0, 0, 0, 0, 0 } + +static int next_test(struct child_process *cp, struct strbuf *err, void *cb, + void **task_cb) +{ + struct testsuite *suite = cb; + const char *test; + if (suite->next >= suite->tests.nr) + return 0; + + test = suite->tests.items[suite->next++].string; + argv_array_pushl(&cp->args, "sh", test, NULL); + if (suite->quiet) + argv_array_push(&cp->args, "--quiet"); + if (suite->immediate) + argv_array_push(&cp->args, "-i"); + if (suite->verbose) + argv_array_push(&cp->args, "-v"); + if (suite->verbose_log) + argv_array_push(&cp->args, "-V"); + if (suite->trace) + argv_array_push(&cp->args, "-x"); + if (suite->write_junit_xml) + argv_array_push(&cp->args, "--write-junit-xml"); + + strbuf_addf(err, "Output of '%s':\n", test); + *task_cb = (void *)test; + + return 1; +} + +static int test_finished(int result, struct strbuf *err, void *cb, + void *task_cb) +{ + struct testsuite *suite = cb; + const char *name = (const char *)task_cb; + + if (result) + string_list_append(&suite->failed, name); + + strbuf_addf(err, "%s: '%s'\n", result ? "FAIL" : "SUCCESS", name); + + return 0; +} + +static int test_failed(struct strbuf *out, void *cb, void *task_cb) +{ + struct testsuite *suite = cb; + const char *name = (const char *)task_cb; + + string_list_append(&suite->failed, name); + strbuf_addf(out, "FAILED TO START: '%s'\n", name); + + return 0; +} + +static const char * const testsuite_usage[] = { + "test-run-command testsuite [] [...]", + NULL +}; + +static int testsuite(int argc, const char **argv) +{ + struct testsuite suite = TESTSUITE_INIT; + int max_jobs = 1, i, ret; + DIR *dir; + struct dirent *d; + struct option options[] = { + OPT_BOOL('i', "immediate", &suite.immediate, + "stop at first failed test case(s)"), + OPT_INTEGER('j', "jobs", &max_jobs, "run jobs in parallel"), + OPT_BOOL('q', "quiet", &suite.quiet, "be terse"), + OPT_BOOL('v', "verbose", &suite.verbose, "be verbose"), + OPT_BOOL('V', "verbose-log", &suite.verbose_log, + "be verbose, redirected to a file"), + OPT_BOOL('x', "trace", &suite.trace, "trace shell commands"), + OPT_BOOL(0, "write-junit-xml", &suite.write_junit_xml, + "write JUnit-style XML files"), + OPT_END() + }; + + memset(&suite, 0, sizeof(suite)); + suite.tests.strdup_strings = suite.failed.strdup_strings = 1; + + argc = parse_options(argc, argv, NULL, options, + testsuite_usage, PARSE_OPT_STOP_AT_NON_OPTION); + + if (max_jobs <= 0) + max_jobs = online_cpus(); + + dir = opendir("."); + if (!dir) + die("Could not open the current directory"); + while ((d = readdir(dir))) { + const char *p = d->d_name; + + if (*p != 't' || !isdigit(p[1]) || !isdigit(p[2]) || + !isdigit(p[3]) || !isdigit(p[4]) || p[5] != '-' || + !ends_with(p, ".sh")) + continue; + + /* No pattern: match all */ + if (!argc) { + string_list_append(&suite.tests, p); + continue; + } + + for (i = 0; i < argc; i++) + if (!wildmatch(argv[i], p, 0)) { + string_list_append(&suite.tests, p); + break; + } + } + closedir(dir); + + if (!suite.tests.nr) + die("No tests match!"); + if (max_jobs > suite.tests.nr) + max_jobs = suite.tests.nr; + + fprintf(stderr, "Running %d tests (%d at a time)\n", + suite.tests.nr, max_jobs); + + ret = run_processes_parallel(max_jobs, next_test, test_failed, + test_finished, &suite); + + if (suite.failed.nr > 0) { + ret = 1; + fprintf(stderr, "%d tests failed:\n\n", suite.failed.nr); + for (i = 0; i < suite.failed.nr; i++) + fprintf(stderr, "\t%s\n", suite.failed.items[i].string); + } + + string_list_clear(&suite.tests, 0); + string_list_clear(&suite.failed, 0); + + return !!ret; +} + int cmd__run_command(int argc, const char **argv) { struct child_process proc = CHILD_PROCESS_INIT; int jobs; + if (argc > 1 && !strcmp(argv[1], "testsuite")) + exit(testsuite(argc - 1, argv + 1)); + if (argc < 3) return 1; while (!strcmp(argv[1], "env")) { From patchwork Thu Sep 26 08:30:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50F7F76 for ; Thu, 26 Sep 2019 08:30:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 309AC222C3 for ; Thu, 26 Sep 2019 08:30:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Dx3HGL1k" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729233AbfIZIa2 (ORCPT ); Thu, 26 Sep 2019 04:30:28 -0400 Received: from mail-lj1-f176.google.com ([209.85.208.176]:34395 "EHLO mail-lj1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727529AbfIZIa0 (ORCPT ); Thu, 26 Sep 2019 04:30:26 -0400 Received: by mail-lj1-f176.google.com with SMTP id j19so1250533lja.1 for ; Thu, 26 Sep 2019 01:30:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=+ALQB6JMvVM0c9hGwY/fZEppEZoPfVaLQt24/cPaKnQ=; b=Dx3HGL1kqhj10iEV6cdMv39TZIFW5bH0ckf1xL+yhFGjWCA2FZU5SuBVibr8Cmi7gz Xr2+/csqTQPhOprxMEOgYbqomnMQTxai5jllloti5ocmXvUGB3gojTWbaliCxTcPuWR2 p/SWqbeXX+6oGSsa7oeUN0acxpzwfJjxgGCp57kLf0xWvpkC+spyyaRJD/a3CMxogjsj TLUaEKzfaBZSM9oV+LyYUQisLsTCBx7Ni/a4GKHGzadr2x0B4EETJcnu6W6uEjWsbJkG 8ekeBnseTbkOz6UNEOmQ06fJyaugjiI/DnvbN3k+12O6TiLZCRZOGCgXrBE2XcCcxaWr UoIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=+ALQB6JMvVM0c9hGwY/fZEppEZoPfVaLQt24/cPaKnQ=; b=RvfzcSClEfbKT/Px4yWUMC4FQu/tag+jx5XQ0vB5yjIholSzEG9T/GH133IIxKppMj SuAe5IrP9/NCo/+h4e6Cz8gaR0wLVGaq62jMdJcHphVQo31CPKvMgDB3AFFaYuDZJoKi R7PMkfePJWdh/obbAQOGLmUy/A3nUrwquL+SX45l4wG7KdXFxK+LLGbsc5nGbCMg4Il2 OjvOBeQy/x7cRRITUO9TeCbpJaXK9c2lYOIyP31XELPRkyrRLKMSgbXoxbP8VoKfunmQ RlIYtF+U/pPCX3knemEDHAajrYMKrZHu3UltEcn+TSPs3kmNZBlsKfFA3qEXsjboxbQh rzeQ== X-Gm-Message-State: APjAAAVg36tEX3vFBUhTJPo1ojwzpqhVy3pAROcW9Jf/haUMYYPL4O1N YtsMJdpV27b6QPu3CgLe7HfEck4h X-Google-Smtp-Source: APXvYqyL61s0D6slVxYKf6/wGtCjPM2gLHi2gQYk2g2sYkR0wK3nmkoFR6UUkAcXMTmHyr5q5VqTbg== X-Received: by 2002:a2e:1614:: with SMTP id w20mr1669141ljd.159.1569486622904; Thu, 26 Sep 2019 01:30:22 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k23sm413380ljc.13.2019.09.26.01.30.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:22 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:22 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:30:04 GMT Message-Id: <99724f6a1e45b497e15037bbac1cb5f70a3bb236.1569486607.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 11/13] tests: let --immediate and --write-junit-xml play well together Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin When the `--immediate` option is in effect, any test failure will immediately exit the test script. Together with `--write-junit-xml`, we will want the JUnit-style `.xml` file to be finalized (and not leave the XML incomplete). Let's make it so. This comes in particularly handy when trying to debug via Azure Pipelines, where the JUnit-style XML is consumed to present the test results in an informative and helpful way. Signed-off-by: Johannes Schindelin --- t/test-lib.sh | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/t/test-lib.sh b/t/test-lib.sh index d1ba33745a..f21c781e68 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -695,7 +695,7 @@ test_failure_ () { say_color error "not ok $test_count - $1" shift printf '%s\n' "$*" | sed -e 's/^/# /' - test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; } + test "$immediate" = "" || { finalize_junit_xml; GIT_EXIT_OK=t; exit 1; } } test_known_broken_ok_ () { @@ -1063,6 +1063,25 @@ write_junit_xml_testcase () { junit_have_testcase=t } +finalize_junit_xml () { + if test -n "$write_junit_xml" && test -n "$junit_xml_path" + then + test -n "$junit_have_testcase" || { + junit_start=$(test-tool date getnanos) + write_junit_xml_testcase "all tests skipped" + } + + # adjust the overall time + junit_time=$(test-tool date getnanos $junit_suite_start) + sed "s/]*/& time=\"$junit_time\"/" \ + <"$junit_xml_path" >"$junit_xml_path.new" + mv "$junit_xml_path.new" "$junit_xml_path" + + write_junit_xml " " "" + write_junit_xml= + fi +} + test_atexit_cleanup=: test_atexit_handler () { # In a succeeding test script 'test_atexit_handler' is invoked @@ -1085,21 +1104,7 @@ test_done () { # removed, so the commands can access pidfiles and socket files. test_atexit_handler - if test -n "$write_junit_xml" && test -n "$junit_xml_path" - then - test -n "$junit_have_testcase" || { - junit_start=$(test-tool date getnanos) - write_junit_xml_testcase "all tests skipped" - } - - # adjust the overall time - junit_time=$(test-tool date getnanos $junit_suite_start) - sed "s/]*/& time=\"$junit_time\"/" \ - <"$junit_xml_path" >"$junit_xml_path.new" - mv "$junit_xml_path.new" "$junit_xml_path" - - write_junit_xml " " "" - fi + finalize_junit_xml if test -z "$HARNESS_ACTIVE" then From patchwork Thu Sep 26 08:30:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 02C7276 for ; Thu, 26 Sep 2019 08:30:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D5AA6222C0 for ; Thu, 26 Sep 2019 08:30:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jhfmC04s" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729263AbfIZIa3 (ORCPT ); Thu, 26 Sep 2019 04:30:29 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:44802 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728554AbfIZIa1 (ORCPT ); Thu, 26 Sep 2019 04:30:27 -0400 Received: by mail-lf1-f67.google.com with SMTP id q11so1012388lfc.11 for ; Thu, 26 Sep 2019 01:30:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=1WrFUOjNOCYQ9G5fl078OoTy2uTYYjpRxw5Us+PnBoc=; b=jhfmC04sdSLtrH+/tKVbSV193wXCVARU2RzZmUUTL7AwMFHCF7/FuoDDEQEJcGlXYK 1/mkPPwzKWhjxcRkZKUcu1vlE2A5s7nCaG5ggsn5FweoZnxlsMpqk17WvIQWrxHMGi5k S2tZ2RZM583VIAcR2b/nvLgwz37ptexCKyFmTpWJS9pVVrOvxr6L1nec9tq6159kd0z2 Se5W8iFi0KmZHNF+ooW16z6ySUJ/KOw6rQ82YUOTfWMPa2z13sDqFnmKuHYqsvg/jRd1 Bn68GMSXScN3lmj9965+whND1f5XbmSNir/OBpPTmDhVlWw0KNi1e3JhOtoD7Oc7U/E+ IvTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=1WrFUOjNOCYQ9G5fl078OoTy2uTYYjpRxw5Us+PnBoc=; b=YdrCo0112veTH4OntcWjbUFNb6+p2JFjW1zKH11SYXlh7ijvqlrbgvtPOCaeQl6jth tpYwAbQi3/JgXwnewrmZvhSIivF/UPVhDDa7sCYcgeBI1brr3MVFeLivazrDRiLkWZIQ etGAb7crLsyCiAx2L9hnVOv53dnH3g7gYh9ZKIzdZGR+dV/73F9XEqaanYRwOJ95fxbg U6VIhPBEVNh3nRz+G7FRzXxDYGPK3MLtajHzklHTJzML3dCozG5ozI8v8cd9e1Ziu2qv jU2PD0X75WZ1R6UBrfKjzcRCFy4TIV+wOW8MjvVxLvP0cApJu29rtYdvADob8mDq6SO1 MKdA== X-Gm-Message-State: APjAAAUNn62+KvvDNeBN3A5Ktr8xpbrw8niF0mcyBw8auAsmx4HzSx4Y kHHfyOX9sdDOSk7V+QvL1cPlaob/ X-Google-Smtp-Source: APXvYqwQZtpIHmD6iYkcCBWpr49Bx4lwclv8VAkdb0T5zWcUFyHoA0rWtsOtAxPYwv7Tv1h2T4yvKw== X-Received: by 2002:a05:6512:25b:: with SMTP id b27mr1471920lfo.60.1569486624048; Thu, 26 Sep 2019 01:30:24 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m6sm411270ljj.3.2019.09.26.01.30.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:23 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:23 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:30:05 GMT Message-Id: <29dceaae5ece947e7748330c3fdee4f9667f0fab.1569486607.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 12/13] ci: really use shallow clones on Azure Pipelines Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin This was a left-over from the previous YAML schema, and it no longer works. The problem was noticed while editing `azure-pipelines.yml` in VS Code with the very helpful "Azure Pipelines" extension (syntax highlighting and intellisense for `azure-pipelines.yml`...). Signed-off-by: Johannes Schindelin --- azure-pipelines.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c329b7218b..55ee23ad0f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,5 @@ -resources: -- repo: self - fetchDepth: 1 +variables: + Agent.Source.Git.ShallowFetchDepth: 1 jobs: - job: windows_build From patchwork Thu Sep 26 08:30:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11161973 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7920417EE for ; Thu, 26 Sep 2019 08:30:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E1E7222C0 for ; Thu, 26 Sep 2019 08:30:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MlWjA5Hi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729291AbfIZIac (ORCPT ); Thu, 26 Sep 2019 04:30:32 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:42179 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729194AbfIZIa1 (ORCPT ); Thu, 26 Sep 2019 04:30:27 -0400 Received: by mail-lj1-f193.google.com with SMTP id y23so1210664lje.9 for ; Thu, 26 Sep 2019 01:30:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=2sgHY/MFdO8y7LIMA6x3QeA95At2V5bCVZfn9F3/7mM=; b=MlWjA5HiuPVeKbmzZww66kwhdb6qj8mJVhX2Wa8vxKhwjiQpD+EhtuA2+Qr/k+N2ML eQJnlPJVJk7MmWvXxknYP7RLFpEBO4rMxl4wKkjvxJ6bVxJtzb2X8fF8c2NHUeouyO8E pxbNwI54k1uG8tbxbzF2CMDTOfPypmGSnV6mdEOZmYEyEm9JQ67E21mZ9qGPupoMt3SB s7KuaSGIDIR47PQ2dhWuI4BNN812FW8e5r5TQUVaC0krMxWloRMG4EVE38M/PSMXu6YF KfwBGXz0aQtwcQhAOUOYYSYNp+l/4ju99ZotJfN4jFaj2q0TS+QS4aYCTvxz077Mr3Mq hwRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=2sgHY/MFdO8y7LIMA6x3QeA95At2V5bCVZfn9F3/7mM=; b=P5pCWt4wTFCK9D1DR52eim6iPNcerX58Sq/i4XIKJf/SIwnC4+ks124Z4poamFXtQb Qcw/p6GOwqNAIXhvpmFQ46FM4Wb3Y/lXoig+A8pqJppxrwtzYjdhQxPRqm9A/YOd+fW+ 4ViL1wrBAf1XIUtp1JaUxaNtKzg8jV4NcGNGSGgQpyjj3cgUu0aa7AdA55eEE807zNkZ BNVMomYMCgabJ8wJwBTPblB1gj98vQMq7SVDVS72+81LpSSla165Yi0x33OgafkIysw6 KjS/6LONvzxUlKplRKYSvF1dVdg79sY5Q9uK7CxZaSHzVKml1I8zj1oNz7jNXyGkKTC6 qxwQ== X-Gm-Message-State: APjAAAU0z9POBxdZsVancYmZy5Kf/2QaOHW1gbG0yxkGyz52LvWJ4M9+ Qt6xSg0W/qfW40oZ28KzWPfQLOFC X-Google-Smtp-Source: APXvYqy5pIGhchwMF5ndsXCD0O7VmE24Eomxp/zCMEUbfFm6MT/FEzZlrb5XHsUaIprL+s3cLzubrQ== X-Received: by 2002:a2e:b045:: with SMTP id d5mr1719375ljl.105.1569486625254; Thu, 26 Sep 2019 01:30:25 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 77sm341935ljj.84.2019.09.26.01.30.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 01:30:24 -0700 (PDT) Date: Thu, 26 Sep 2019 01:30:24 -0700 (PDT) X-Google-Original-Date: Thu, 26 Sep 2019 08:30:06 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 13/13] ci: also build and test with MS Visual Studio on Azure Pipelines Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin ... because we can, now. Technically, we actually build using `MSBuild`, which is however pretty close to building interactively in Visual Studio. As there is no convenient way to run Git's test suite in Visual Studio, we unpack a Portable Git to run it, using the just-added test helper to allow running test scripts in parallel. Signed-off-by: Johannes Schindelin --- Makefile | 4 ++ azure-pipelines.yml | 159 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+) diff --git a/Makefile b/Makefile index 3716dadc08..3f6dcec54b 100644 --- a/Makefile +++ b/Makefile @@ -3025,6 +3025,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) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 55ee23ad0f..875e63cac1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -130,6 +130,165 @@ jobs: PathtoPublish: t/failed-test-artifacts ArtifactName: failed-test-artifacts +- job: vs_build + displayName: Visual Studio 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-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: | + & git-sdk-64-minimal\usr\bin\bash.exe -lc @" + make vcxproj + "@ + if (!$?) { exit(1) } + displayName: Generate Visual Studio Solution + env: + HOME: $(Build.SourcesDirectory) + MSYSTEM: MINGW64 + DEVELOPER: 1 + NO_PERL: 1 + GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'" + - 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' + - task: MSBuild@1 + inputs: + solution: git.sln + platform: x64 + configuration: Release + maximumCpuCount: 4 + - powershell: | + & compat\vcbuild\vcpkg_copy_dlls.bat release + if (!$?) { exit(1) } + & git-sdk-64-minimal\usr\bin\bash.exe -lc @" + mkdir -p artifacts && + eval \"`$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts | grep ^tar)\" + "@ + if (!$?) { exit(1) } + displayName: Bundle artifact tar + env: + HOME: $(Build.SourcesDirectory) + MSYSTEM: MINGW64 + DEVELOPER: 1 + NO_PERL: 1 + MSVC: 1 + VCPKG_ROOT: $(Build.SourcesDirectory)\compat\vcbuild\vcpkg + - powershell: | + $tag = (Invoke-WebRequest -UseBasicParsing "https://gitforwindows.org/latest-tag.txt").content + $version = (Invoke-WebRequest -UseBasicParsing "https://gitforwindows.org/latest-version.txt").content + $url = "https://github.com/git-for-windows/git/releases/download/${tag}/PortableGit-${version}-64-bit.7z.exe" + (New-Object Net.WebClient).DownloadFile($url,"PortableGit.exe") + & .\PortableGit.exe -y -oartifacts\PortableGit + # Wait until it is unpacked + while (-not @(Remove-Item -ErrorAction SilentlyContinue PortableGit.exe; $?)) { sleep 1 } + displayName: Download & extract portable Git + - task: PublishPipelineArtifact@0 + displayName: 'Publish Pipeline Artifact: MSVC test artifacts' + inputs: + artifactName: 'vs-artifacts' + targetPath: '$(Build.SourcesDirectory)\artifacts' + - 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: vs_test + displayName: Visual Studio Test + dependsOn: vs_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: VS test artifacts' + inputs: + artifactName: 'vs-artifacts' + targetPath: '$(Build.SourcesDirectory)' + - powershell: | + & PortableGit\git-cmd.exe --command=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' /PortableGit/ /test-cache/ >>.git/info/exclude + + cd t && + PATH=\"`$PWD/helper:`$PATH\" && + test-tool.exe run-command testsuite -V -x --write-junit-xml \ + `$(test-tool.exe path-utils slice-tests \ + `$SYSTEM_JOBPOSITIONINPHASE `$SYSTEM_TOTALJOBSINPHASE t[0-9]*.sh) + "@ + 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: 'vs' + 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-vs-test-artifacts + - job: linux_clang displayName: linux-clang condition: succeeded()