[zeromq-dev] Adding new tests to Malamute

Kevin Sapper kevinsapper88 at gmail.com
Thu May 5 23:28:45 CEST 2016


I agree enabled verbose and add lots of printf statements. Expect that it
will take you a day or two to understand.
Am 05.05.2016 10:32 nachm. schrieb "Pieter Hintjens" <ph at imatix.com>:

> The best way to understand what's going on is to look at the code for
> mlm_client_content () and possibly debug by adding printfs as it runs.
> This is really educational and will help you use Malamute better.
>
> Please do read & follow coding style on all patches, space before '('
> and noNamesLikeThis.
>
> Cheers :)
> Pieter
>
> On Thu, May 5, 2016 at 5:25 PM, Osiris Pedroso <opedroso at gmail.com> wrote:
> > I am in the process of adding a few new tests to malamute self tests,
> > learning its API in the process.
> >
> > They will target specific portions of the APIs:
> >
> > mlm_stream_api_test      (single broadcaster, single listener)
> > mlm_service_api_test      (single requester, single service provider)
> > mlm_services_api_test    (multiple requesters, multiple service
> providers)
> > mlm_mailbox_api_test
> >
> > I am midway through the services API (#3) test and encountered an
> unexpected
> > behavior (see last code line):
> > ```
> > // define that requesters will generate printJob events
> > rc = mlm_client_set_producer(requester1, "printServiceStream");
> > assert(rc == 0);
> > rc = mlm_client_set_producer(requester2, "printServiceStream");
> > assert(rc == 0);
> > // define that workers will listen to printJob events related to requests
> > rc = mlm_client_set_consumer(worker1, "printServiceStream", "request.*");
> > assert(rc == 0);
> > rc = mlm_client_set_consumer(worker2, "printServiceStream", "request.*");
> > assert(rc == 0);
> >
> > rc = mlm_client_sendx(requester1, "request", "start", NULL);
> > assert(rc == 0);
> >
> > rc = mlm_client_recvx(worker1, &subject, &content, NULL);
> > assert(rc != -1);
> >
> > assert(mlm_client_status(worker1) == 0);
> > assert(streq(mlm_client_command(worker1), "STREAM DELIVER"));
> > assert(mlm_client_reason(worker1) == NULL);
> > assert(streq(mlm_client_address(worker1), "printServiceStream"));
> > assert(streq(mlm_client_sender(worker1), "requesterAddress1"));
> > assert(streq(mlm_client_subject(worker1), "request"));
> > assert(mlm_client_tracker(worker1) == NULL);
> > zmsg_t *zmsg_content = mlm_client_content(worker1);
> > assert(zmsg_content != NULL);
> > int isZmsg = zmsg_is(zmsg_content);
> > assert(isZmsg == 0); // don't understand why, but this is the return
> value
> > ```
> >
> > The problem is that the zmsg* returned by mlm_client_content() does not
> seem
> > like a valid zmsg* according to zmsg_is(). The tag value in the message
> is
> > 0xfeeefeee, but the expected value is 0x0003cafe
> >
> > Since it is a zmsg_t* returned by malamute itself , I expected it to be a
> > valid zmsg.
> >
> > Please advise.
> >
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160505/b3d33987/attachment.htm>


More information about the zeromq-dev mailing list