git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Paul Tan <pyokagan@gmail.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	Git List <git@vger.kernel.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH/RFC/GSOC] make git-pull a builtin
Date: Tue, 24 Mar 2015 23:58:06 +0800	[thread overview]
Message-ID: <CACRoPnQZwVq2ssqKYsK1vKu3kVCcc0wqkf2-2soEb1vP34Td2g@mail.gmail.com> (raw)
In-Reply-To: <CACsJy8AP7Q9tNNDuQ2aLpCWpBwuD39qPSfip54pmDP58roztEw@mail.gmail.com>

On Mon, Mar 23, 2015 at 6:18 PM, Duy Nguyen <pclouds@gmail.com> wrote:
> Could you share these changes? I'm just wondering if we can add kcov
> support to the test suite.

In this case it's more of an embarrassing hack, as I just needed a way
to make git run "kcov outdir git-pull.sh" whenever git pull is called
since kcov will not instrument any spawned subprocesses. I modified
execv_dashed_external() in git.c to prepend kcov to argv (diff
probably munged by gmail):

diff --git a/git.c b/git.c
index 8c7ee9c..0f8e7d4 100644
--- a/git.c
+++ b/git.c
@@ -536,6 +536,8 @@ static void execv_dashed_external(const char **argv)
        struct strbuf cmd = STRBUF_INIT;
        const char *tmp;
        int status;
+       struct argv_array args = ARGV_ARRAY_INIT;
+       int i;

        if (use_pager == -1)
                use_pager = check_pager_config(argv[0]);
@@ -551,6 +553,11 @@ static void execv_dashed_external(const char **argv)
         */
        tmp = argv[0];
        argv[0] = cmd.buf;
+       argv_array_push(&args, "kcov");
+       argv_array_push(&args, "/home/pyokagan/pyk/git/kcov");
+       argv_array_push(&args, cmd.buf);
+       for (i = 1; argv[i]; i++)
+               argv_array_push(&args, argv[i]);

        trace_argv_printf(argv, "trace: exec:");

@@ -558,7 +565,7 @@ static void execv_dashed_external(const char **argv)
         * if we fail because the command is not found, it is
         * OK to return. Otherwise, we just pass along the status code.
         */
-       status = run_command_v_opt(argv, RUN_SILENT_EXEC_FAILURE |
RUN_CLEAN_ON_EXIT);
+       status = run_command_v_opt(args.argv, RUN_SILENT_EXEC_FAILURE
| RUN_CLEAN_ON_EXIT);
        if (status >= 0 || errno != ENOENT)
                exit(status);

I'm guessing a real solution is to follow what the test suite does for
the --valgrind option, though I haven't looked into it in detail.

  reply	other threads:[~2015-03-24 15:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 13:57 [PATCH/RFC/GSOC] make git-pull a builtin Paul Tan
2015-03-18  8:38 ` Stephen Robin
2015-03-18  9:24   ` Johannes Schindelin
2015-03-18  9:00 ` Johannes Schindelin
2015-03-21 14:00   ` Paul Tan
2015-03-21 17:27     ` Johannes Schindelin
2015-03-18 17:52 ` Matthieu Moy
2015-03-21 13:23   ` Paul Tan
2015-03-21 17:35     ` Johannes Schindelin
2015-03-22 17:39       ` Paul Tan
2015-03-23  9:07         ` Johannes Schindelin
2015-03-23 10:18     ` Duy Nguyen
2015-03-24 15:58       ` Paul Tan [this message]
2015-03-18 22:26 ` Junio C Hamano
2015-03-21 13:40   ` Paul Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACRoPnQZwVq2ssqKYsK1vKu3kVCcc0wqkf2-2soEb1vP34Td2g@mail.gmail.com \
    --to=pyokagan@gmail.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).