Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jeremie.galarneau@efficios.com (Jérémie Galarneau)
Subject: [lttng-dev] [LTTNG-TOOLS PATCH 2/2] Test the viewer detach command
Date: Wed, 3 Jun 2015 12:06:44 +0200	[thread overview]
Message-ID: <CA+jJMxsak7PKxUSszJ+mpvnf23VMA9x7X0kKQax2B6WM_UZtDQ@mail.gmail.com> (raw)
In-Reply-To: <CA+jJMxv4a8Pt-5P55e2ZTf_ka5sL36N_bWLuqSc4j06g3s6jng@mail.gmail.com>

To add to the previous comments, this commit introduced
the lttng_live_recv() and lttng_live_send() wrappers based on those in
Babeltrace. The patch should be adapted to use them.

commit 102369184926015f7e68c4af93dda14ab48d474d
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date:   Tue Apr 28 17:23:34 2015 -0400

    Fix: live_test regression on large number of cpus

    Merge fixes from Babeltrace lttng-live plugin, especially about
    incorrect use of send() and recv().

    Can be triggered with 32 virtual processors visible on the system with
    the root_regression test suite.

    Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
    Signed-off-by: J?r?mie Galarneau <jeremie.galarneau at efficios.com>

J?r?mie

On Wed, Jun 3, 2015 at 12:04 PM, J?r?mie Galarneau <
jeremie.galarneau at efficios.com> wrote:

>
>
> On Thu, Mar 26, 2015 at 5:57 PM, Julien Desfossez <jdesfossez at efficios.com
> > wrote:
>
>> Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
>> ---
>>  tests/regression/tools/live/live_test.c | 64
>> ++++++++++++++++++++++++++++++++-
>>  1 file changed, 63 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/regression/tools/live/live_test.c
>> b/tests/regression/tools/live/live_test.c
>> index e30c391..8d718f6 100644
>> --- a/tests/regression/tools/live/live_test.c
>> +++ b/tests/regression/tools/live/live_test.c
>> @@ -50,7 +50,7 @@
>>  #define LIVE_TIMER 2000000
>>
>>  /* Number of TAP tests in this file */
>> -#define NUM_TESTS 8
>> +#define NUM_TESTS 11
>>  #define mmap_size 524288
>>
>>  int ust_consumerd32_fd;
>> @@ -257,6 +257,59 @@ error:
>>         return ret;
>>  }
>>
>> +int detach_viewer_session(uint64_t id)
>> +{
>> +       struct lttng_viewer_cmd cmd;
>> +       struct lttng_viewer_detach_session_response resp;
>> +       struct lttng_viewer_detach_session_request rq;
>> +       int ret;
>> +       ssize_t ret_len;
>> +
>> +       cmd.cmd = htobe32(LTTNG_VIEWER_DETACH_SESSION);
>> +       cmd.data_size = sizeof(rq);
>> +       cmd.cmd_version = 0;
>> +
>> +       memset(&rq, 0, sizeof(rq));
>> +       rq.session_id = htobe64(id);
>> +
>> +       do {
>> +               ret_len = send(control_sock, &cmd, sizeof(cmd), 0);
>> +       } while (ret_len < 0 && errno == EINTR);
>> +       if (ret_len < 0) {
>> +               fprintf(stderr, "[error] Error sending cmd\n");
>> +               ret = ret_len;
>> +               goto error;
>> +       }
>> +       assert(ret_len == sizeof(cmd));
>>
>
> Please fail the test without asserting if this happens.
>
>
>> +       do {
>> +               ret = send(control_sock, &rq, sizeof(rq), 0);
>> +       } while (ret < 0 && errno == EINTR);
>> +       if (ret < 0) {
>> +               fprintf(stderr, "Error sending attach request\n");
>> +               goto error;
>> +       }
>> +
>> +       do {
>> +               ret_len = recv(control_sock, &resp, sizeof(resp), 0);
>> +       } while (ret_len < 0 && errno == EINTR);
>> +       if (ret_len < 0) {
>> +               fprintf(stderr, "[error] Error receiving detach session
>> reply\n");
>> +               ret = ret_len;
>> +               goto error;
>> +       }
>> +       assert(ret_len == sizeof(resp));
>>
>
> Same here.
>
> Thanks!
> J?r?mie
>
> +
>> +       if (be32toh(resp.status) != LTTNG_VIEWER_DETACH_SESSION_OK) {
>> +               fprintf(stderr, "[error] Error detaching viewer
>> session\n");
>> +               ret = -1;
>> +               goto error;
>> +       }
>> +       ret = 0;
>> +
>> +error:
>> +       return ret;
>> +}
>> +
>>  int attach_session(int id)
>>  {
>>         struct lttng_viewer_cmd cmd;
>> @@ -643,5 +696,14 @@ int main(int argc, char **argv)
>>                         first_packet_stream_id, first_packet_offset,
>>                         first_packet_len);
>>
>> +       ret = detach_viewer_session(session_id);
>> +       ok(ret == 0, "Detach viewer session");
>> +
>> +       ret = list_sessions(&session_id);
>> +       ok(ret > 0, "List sessions : %d session(s)", ret);
>> +
>> +       ret = attach_session(session_id);
>> +       ok(ret > 0, "Attach to session, %d streams received", ret);
>> +
>>         return exit_status();
>>  }
>> --
>> 1.9.1
>>
>>
>
>
> --
> J?r?mie Galarneau
> EfficiOS Inc.
> http://www.efficios.com
>



-- 
J?r?mie Galarneau
EfficiOS Inc.
http://www.efficios.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20150603/558b7be0/attachment.html>


      reply	other threads:[~2015-06-03 10:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1427389072-3763-1-git-send-email-jdesfossez@efficios.com>
     [not found] ` <1427389072-3763-2-git-send-email-jdesfossez@efficios.com>
2015-06-03 10:04   ` Jérémie Galarneau
2015-06-03 10:06     ` Jérémie Galarneau [this message]

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

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

  git send-email \
    --in-reply-to=CA+jJMxsak7PKxUSszJ+mpvnf23VMA9x7X0kKQax2B6WM_UZtDQ@mail.gmail.com \
    --to=jeremie.galarneau@efficios.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox