Re: [PATCH] t5411: consistent result for proc-receive broken test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jiang Xin <worldhello.net@xxxxxxxxx> 于2020年11月7日周六 上午10:57写道:
> @@ -75,13 +78,18 @@ static void proc_receive_read_commands(struct packet_reader *reader,
>                 if (packet_reader_read(reader) != PACKET_READ_NORMAL)
>                         break;
>
> +               if (die_readline)
> +                       die("die with the --die-readline option");
> +
>                 if (parse_oid_hex(reader->line, &old_oid, &p) ||
>                     *p++ != ' ' ||
>                     parse_oid_hex(p, &new_oid, &p) ||
> -                   *p++ != ' ' ||
> -                   die_readline)
> +                   *p++ != ' ') {
> +                       while (packet_reader_read(reader) != PACKET_READ_EOF)
> +                               ; /* do nothing */
>                         die("protocol error: expected 'old new ref', got '%s'",
>                             reader->line);
> +               }
>                 refname = p;
>                 FLEX_ALLOC_STR(cmd, ref_name, refname);
>                 oidcpy(&cmd->old_oid, &old_oid);

Still have problems under the stress test.  Today I figured out how to
run stress test by setting proper environment variable
GIT_TEST_STRESS_LOAD without consuming too many resources and leading
to random strange errors. E.g.:

    $ GIT_TEST_STRESS_LOAD=11 sh  t5411-proc-receive-hook.sh -v --stress

Will send patch v2 later with the following changes:

-- snip --
diff --git a/t/helper/test-proc-receive.c b/t/helper/test-proc-receive.c
index ee5717ba0a..9f7fbc5b7a 100644
--- a/t/helper/test-proc-receive.c
+++ b/t/helper/test-proc-receive.c
@@ -78,17 +78,18 @@ static void proc_receive_read_commands(struct
packet_reader *reader,
                if (packet_reader_read(reader) != PACKET_READ_NORMAL)
                        break;

-               if (die_readline)
-                       die("die with the --die-readline option");
-
                if (parse_oid_hex(reader->line, &old_oid, &p) ||
                    *p++ != ' ' ||
                    parse_oid_hex(p, &new_oid, &p) ||
-                   *p++ != ' ') {
+                   *p++ != ' ' ||
+                   die_readline) {
+                       char *bad_line = xstrdup(reader->line);
                        while (packet_reader_read(reader) != PACKET_READ_EOF)
                                ; /* do nothing */
+                       if (die_readline)
+                               die("die with the --die-readline option");
                        die("protocol error: expected 'old new ref', got '%s'",
-                           reader->line);
+                           bad_line);
                }
                refname = p;
                FLEX_ALLOC_STR(cmd, ref_name, refname);
-- snap --




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux