From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-2.8 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id AD3DC1F42D for ; Sat, 24 Mar 2018 07:43:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751880AbeCXHne (ORCPT ); Sat, 24 Mar 2018 03:43:34 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:38210 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751583AbeCXHna (ORCPT ); Sat, 24 Mar 2018 03:43:30 -0400 Received: by mail-lf0-f67.google.com with SMTP id u3-v6so478919lff.5 for ; Sat, 24 Mar 2018 00:43:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p/3tYEgP/0gP+rfDqvZvT+9uTPB8YTu8qWrq0k2qbWg=; b=mkJpWzgTSj6OoCxS7hLXQzmontVTZHOqOSkP2/NCSfrWBH8wQtGQ3FCqGiVZ9a+sWD vLzE9V8h8GVTQ5GoikOijf99qsxOoz+q78bC6jHToqzyqChEuW6JA58yvNq+hlMoPbuh E75xwlGy6huDynq/L2dtGRRsdERzBn97dGDzU4sQsFMpSBTrJ9Tu5B6q4cs0NhBZNIV7 nZC7UP2lsS8gBz4nPWsKCkp8p4W/xZs/iUJ2rTF7C9uGwE0vf/gQ/0c7qNr+DwvYE/Ln Kq8ruaz79d0vXY1wfr1Ugf7dj9tj4w8JskBEDJ1VPU0NZw2m2HGKwrm8p0bl87YWiYxS kWVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p/3tYEgP/0gP+rfDqvZvT+9uTPB8YTu8qWrq0k2qbWg=; b=r7Up5llfE3W8n3bre0rf+0tUosNhi2qbA014h0vrKxE73miEoh++C5qKpwyLwDyANH 2x9MevQvddlvlGJfeLn80qpuAQPRBcqcaLWGr3kWoclTjcNWdu5aKO82thaVYm0kMpRJ 0RZuumGBIWGW8aXM1NQ+4x+BafpQEvWzIreRWJawUIaDy1Zj3dR95LB+bR7BkGgORy5/ X11fZNEYzZlOAun9EuwmgUzq6+kgzT9V0OpGZGAc9RczKvLdEaCTt1JwLno4HqWxTFtp hgZjGAYTIvDn70OKfqltJyx+A0ELjYVivhMSsoXOHUR/mcWiS9c+htA56R71XquB8wNB XwkQ== X-Gm-Message-State: AElRT7Ec7ZDXVVw3E1VbsQLA3c5KBoy9SnSTC40CROLGXzPUTCQxkOTR Z1RtFbRwX2tKroY6FSQT8U0= X-Google-Smtp-Source: AIpwx49mo/085UvCvg21IayZlf/sb55e6GIZXqLP7Psnlvmq/VFPDU1uAAAp1fk6x6WMk1Gcnk+B2Q== X-Received: by 2002:a19:d80b:: with SMTP id p11-v6mr1241871lfg.11.1521877408905; Sat, 24 Mar 2018 00:43:28 -0700 (PDT) Received: from localhost.localdomain (c80-216-12-205.bredband.comhem.se. [80.216.12.205]) by smtp.gmail.com with ESMTPSA id o132-v6sm2642867lfe.91.2018.03.24.00.43.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Mar 2018 00:43:28 -0700 (PDT) From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= To: pclouds@gmail.com Cc: git@vger.kernel.org, Eric Sunshine , Jeff Hostetler , Junio C Hamano Subject: [PATCH v2 01/36] t/helper: add an empty test-tool program Date: Sat, 24 Mar 2018 08:42:27 +0100 Message-Id: <20180324074308.18934-3-pclouds@gmail.com> X-Mailer: git-send-email 2.17.0.rc0.348.gd5a49e0b6f In-Reply-To: <20180324074308.18934-1-pclouds@gmail.com> References: <20180317075421.22032-1-pclouds@gmail.com> <20180324074308.18934-1-pclouds@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This will become an umbrella program that absorbs most [1] t/helper programs in. By having a single executable binary we reduce disk usage (libgit.a is replicated by every t/helper program) and shorten link time a bit. Running "make --jobs=1; du -sh t/helper" with ccache fully populated, it takes 27 seconds and 277MB at the beginning of this series, 17 seconds and 42MB at the end. [1] There are a couple programs that will not become part of test-tool: test-line-buffer and test-svn-fe have extra dependencies and test-fake-ssh's program name has to be a single word for some ssh tests. Signed-off-by: Nguyễn Thái Ngọc Duy --- Makefile | 6 +++++- t/helper/test-tool.c | 27 +++++++++++++++++++++++++++ t/helper/test-tool.h | 4 ++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 t/helper/test-tool.c create mode 100644 t/helper/test-tool.h diff --git a/Makefile b/Makefile index a1d8775adb..2376646e98 100644 --- a/Makefile +++ b/Makefile @@ -546,6 +546,7 @@ SCRIPT_PERL = SCRIPT_PYTHON = SCRIPT_SH = SCRIPT_LIB = +TEST_BUILTINS_OBJS = TEST_PROGRAMS_NEED_X = # Having this variable in your environment would break pipelines because @@ -690,6 +691,7 @@ TEST_PROGRAMS_NEED_X += test-string-list TEST_PROGRAMS_NEED_X += test-submodule-config TEST_PROGRAMS_NEED_X += test-subprocess TEST_PROGRAMS_NEED_X += test-svn-fe +TEST_PROGRAMS_NEED_X += test-tool TEST_PROGRAMS_NEED_X += test-urlmatch-normalization TEST_PROGRAMS_NEED_X += test-wildmatch @@ -2083,7 +2085,7 @@ VCSSVN_OBJS += vcs-svn/fast_export.o VCSSVN_OBJS += vcs-svn/svndiff.o VCSSVN_OBJS += vcs-svn/svndump.o -TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) +TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS)) OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \ $(XDIFF_OBJS) \ $(VCSSVN_OBJS) \ @@ -2494,6 +2496,8 @@ t/helper/test-svn-fe$X: $(VCSSVN_LIB) .PRECIOUS: $(TEST_OBJS) +t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS)) + t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS) diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c new file mode 100644 index 0000000000..c730f718ca --- /dev/null +++ b/t/helper/test-tool.c @@ -0,0 +1,27 @@ +#include "git-compat-util.h" +#include "test-tool.h" + +struct test_cmd { + const char *name; + int (*main)(int argc, const char **argv); +}; + +static struct test_cmd cmds[] = { +}; + +int cmd_main(int argc, const char **argv) +{ + int i; + + if (argc < 2) + die("I need a test name!"); + + for (i = 0; i < ARRAY_SIZE(cmds); i++) { + if (!strcmp(cmds[i].name, argv[1])) { + argv++; + argc--; + return cmds[i].main(argc, argv); + } + } + die("There is no test named '%s'", argv[1]); +} diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h new file mode 100644 index 0000000000..6ce57ae0cc --- /dev/null +++ b/t/helper/test-tool.h @@ -0,0 +1,4 @@ +#ifndef __TEST_TOOL_H__ +#define __TEST_TOOL_H__ + +#endif -- 2.17.0.rc0.348.gd5a49e0b6f