diff options
Diffstat (limited to 't')
-rw-r--r-- | t/helper/test-pkt-line.c | 23 | ||||
-rwxr-xr-x | t/t0070-fundamental.sh | 6 |
2 files changed, 29 insertions, 0 deletions
diff --git a/t/helper/test-pkt-line.c b/t/helper/test-pkt-line.c index 69152958e5..5e638f0b97 100644 --- a/t/helper/test-pkt-line.c +++ b/t/helper/test-pkt-line.c @@ -84,6 +84,25 @@ static void unpack_sideband(void) } } +static int send_split_sideband(void) +{ + const char *part1 = "Hello,"; + const char *primary = "\001primary: regular output\n"; + const char *part2 = " world!\n"; + + send_sideband(1, 2, part1, strlen(part1), LARGE_PACKET_MAX); + packet_write(1, primary, strlen(primary)); + send_sideband(1, 2, part2, strlen(part2), LARGE_PACKET_MAX); + packet_response_end(1); + + return 0; +} + +static int receive_sideband(void) +{ + return recv_sideband("sideband", 0, 1); +} + int cmd__pkt_line(int argc, const char **argv) { if (argc < 2) @@ -95,6 +114,10 @@ int cmd__pkt_line(int argc, const char **argv) unpack(); else if (!strcmp(argv[1], "unpack-sideband")) unpack_sideband(); + else if (!strcmp(argv[1], "send-split-sideband")) + send_split_sideband(); + else if (!strcmp(argv[1], "receive-sideband")) + receive_sideband(); else die("invalid argument '%s'", argv[1]); diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh index 7b111a56fd..357201640a 100755 --- a/t/t0070-fundamental.sh +++ b/t/t0070-fundamental.sh @@ -34,4 +34,10 @@ test_expect_success 'check for a bug in the regex routines' ' test-tool regex --bug ' +test_expect_success 'incomplete sideband messages are reassembled' ' + test-tool pkt-line send-split-sideband >split-sideband && + test-tool pkt-line receive-sideband <split-sideband 2>err && + grep "Hello, world" err +' + test_done |