Branch Coverage

RabbitMQ.xs
Criterion Covered Total %
branch 393 642 61.2


line true false branch
89 181 0 if (amqp_release_buffers_ok(state)) {
117 47 0 if ( x == AMQP_STATUS_CONNECTION_CLOSED || x == AMQP_STATUS_SOCKET_ERROR ) {
0 47 if ( x == AMQP_STATUS_CONNECTION_CLOSED || x == AMQP_STATUS_SOCKET_ERROR ) {
122 1 46 else if (x < 0) {
139 0 0 if (
141 0 0 ||
149 0 0 Perl_croak(aTHX_ "%s: %s\n", context,
151 0 0 (x.library_error == AMQP_STATUS_UNKNOWN_TYPE) ? "unknown AMQP type id" :
215 10 123 if ( SvROK( *perl_value ) ) {
217 5 5 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVAV ) {
222 5 0 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVHV ) {
233 0 123 if ( SvUOK( *perl_value ) ) {
244 0 0 if ( SvI64OK( *perl_value ) ) {
247 0 0 if ( SvU64OK( *perl_value ) ) {
251 0 0 if ( SvIOK( *perl_value ) ) {
252 0 0 if ( SvUOK( *perl_value ) ) {
260 0 0 if ( SvNOK( *perl_value ) ) {
266 25 8 if ( force_utf8 || SvUTF8( *perl_value ) ) {
1 24 if ( force_utf8 || SvUTF8( *perl_value ) ) {
272 2 1 if ( SvPOK( *perl_value ) || SvPOKp( *perl_value ) ) {
0 2 if ( SvPOK( *perl_value ) || SvPOKp( *perl_value ) ) {
273 1 0 if ( force_utf8 || SvUTF8( *perl_value ) ) {
0 1 if ( force_utf8 || SvUTF8( *perl_value ) ) {
278 1 1 if ( SvIOK( *perl_value ) || SvIOKp( *perl_value ) ) {
0 1 if ( SvIOK( *perl_value ) || SvIOKp( *perl_value ) ) {
279 0 1 if ( SvUOK( *perl_value ) ) {
284 0 1 if ( SvNOK( *perl_value ) || SvNOKp( *perl_value ) ) {
0 0 if ( SvNOK( *perl_value ) || SvNOKp( *perl_value ) ) {
289 0 0 if ( SvROK( *perl_value ) ) {
291 0 0 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVAV ) {
296 0 0 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVHV ) {
305 0 0 Perl_croak(
328 0 25 if (AMQP_STATUS_OK != res) {
334 0 25 if (AMQP_FRAME_HEADER != frame.frame_type) {
335 0 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
0 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
336 0 0 (AMQP_CHANNEL_CLOSE_METHOD == frame.payload.method.id ||
358 4 21 if (p->_flags & AMQP_BASIC_CONTENT_TYPE_FLAG) {
361 7 18 if (p->_flags & AMQP_BASIC_CONTENT_ENCODING_FLAG) {
369 7 0 if (
371 7 0 &&
377 4 21 if (p->_flags & AMQP_BASIC_CORRELATION_ID_FLAG) {
380 4 21 if (p->_flags & AMQP_BASIC_REPLY_TO_FLAG) {
383 4 21 if (p->_flags & AMQP_BASIC_EXPIRATION_FLAG) {
386 4 21 if (p->_flags & AMQP_BASIC_MESSAGE_ID_FLAG) {
389 4 21 if (p->_flags & AMQP_BASIC_TYPE_FLAG) {
392 4 21 if (p->_flags & AMQP_BASIC_USER_ID_FLAG) {
395 4 21 if (p->_flags & AMQP_BASIC_APP_ID_FLAG) {
398 4 21 if (p->_flags & AMQP_BASIC_DELIVERY_MODE_FLAG) {
401 4 21 if (p->_flags & AMQP_BASIC_PRIORITY_FLAG) {
404 4 21 if (p->_flags & AMQP_BASIC_TIMESTAMP_FLAG) {
407 9 16 if (p->_flags & AMQP_BASIC_HEADERS_FLAG) {
414 31 9 for( i=0; i < p->headers.num_entries; ++i ) {
532 2 8 hv_store( headers,
587 18 7 if (is_utf8_body)
592 26 25 while (body_remaining > 0) {
596 0 26 if (AMQP_STATUS_OK != res) {
602 0 26 if (AMQP_FRAME_BODY != frame.frame_type) {
603 0 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
0 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
604 0 0 (AMQP_CHANNEL_CLOSE_METHOD == frame.payload.method.id ||
617 0 26 if (fragment_len > body_remaining) {
660 4 22 if (AMQP_STATUS_OK != res) {
666 22 0 if (AMQP_FRAME_METHOD != frame.frame_type ||
1 21 if (AMQP_FRAME_METHOD != frame.frame_type ||
669 1 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
0 1 if (AMQP_FRAME_METHOD == frame.frame_type &&
670 0 0 (AMQP_CHANNEL_CLOSE_METHOD == frame.payload.method.id ||
699 0 21 if (AMQP_RESPONSE_NORMAL != ret.reply_type)
729 114 5 for ( idx = 0; idx <= av_len(perl_array); idx += 1) {
754 0 0 element->value.f64 = (double) SvNV(*value);
759 11 0 element->value.bytes = amqp_cstring_bytes(SvPV_nolen(*value));
785 114 5 for (; current_entry < mq_array->num_entries; current_entry += 1) {
884 46 11 for( i=0; i < mq_table->num_entries; i += 1 ) {
990 0 23 amqp_table_entry_t *new_entries = amqp_pool_alloc( &temp_memory_pool, HvKEYS(hash) * sizeof(amqp_table_entry_t) );
994 56 23 while (NULL != (he = hv_iternext(hash))) {
999 0 56 if (SvGMAGICAL(value)) {
1008 56 0 if (
1012 5 51 &&
1014 5 0 &&
1048 2 0 entry->value.value.f64 = (double) SvNV( value );
1053 23 0 entry->value.value.bytes = amqp_cstring_bytes( SvPV_nolen( value )
1091 0 22 if (AMQP_RESPONSE_NORMAL != ret.reply_type)
1094 18 4 if (AMQP_BASIC_GET_OK_METHOD != ret.reply.id)
1109 0 4 if (AMQP_RESPONSE_NORMAL != ret.reply_type)
1116 4 18 *envelope_sv_ptr = envelope_hv ? newRV_noinc(MUTABLE_SV(envelope_hv)) : &PL_sv_undef;
1135 0 34 PERL_MATH_INT64_LOAD_OR_CROAK;
1165 39 0 str_from_hv(options, user);
39 0 str_from_hv(options, user);
1166 39 0 str_from_hv(options, password);
39 0 str_from_hv(options, password);
1167 39 0 str_from_hv(options, vhost);
39 0 str_from_hv(options, vhost);
1168 0 39 int_from_hv(options, channel_max);
0 0 int_from_hv(options, channel_max);
1169 0 39 int_from_hv(options, frame_max);
0 0 int_from_hv(options, frame_max);
1170 1 38 int_from_hv(options, heartbeat);
1 0 int_from_hv(options, heartbeat);
1171 39 0 int_from_hv(options, port);
39 0 int_from_hv(options, port);
1172 1 38 double_from_hv(options, timeout);
0 1 double_from_hv(options, timeout);
1174 39 0 int_from_hv(options, ssl);
39 0 int_from_hv(options, ssl);
1175 39 0 str_from_hv(options, ssl_cacert);
39 0 str_from_hv(options, ssl_cacert);
1176 0 39 str_from_hv(options, ssl_cert);
0 0 str_from_hv(options, ssl_cert);
1177 0 39 str_from_hv(options, ssl_key);
0 0 str_from_hv(options, ssl_key);
1178 39 0 int_from_hv(options, ssl_verify_host);
39 0 int_from_hv(options, ssl_verify_host);
1179 39 0 int_from_hv(options, ssl_init);
39 0 int_from_hv(options, ssl_init);
1180 0 39 str_from_hv(options, sasl_method);
0 0 str_from_hv(options, sasl_method);
1182 1 38 if(client_properties)
1187 1 38 if(timeout >= 0) {
1192 1 38 if ( ssl ) {
1198 0 1 if ( !sock ) {
1204 1 0 if ( ( ssl_cacert != NULL ) && strlen(ssl_cacert) ) {
1 0 if ( ( ssl_cacert != NULL ) && strlen(ssl_cacert) ) {
1205 0 1 if ( amqp_ssl_socket_set_cacert(sock, ssl_cacert) ) {
1215 0 1 if ( ( ssl_key != NULL ) && strlen(ssl_key) && ( ssl_cert != NULL ) && strlen(ssl_cert) ) {
0 0 if ( ( ssl_key != NULL ) && strlen(ssl_key) && ( ssl_cert != NULL ) && strlen(ssl_cert) ) {
0 0 if ( ( ssl_key != NULL ) && strlen(ssl_key) && ( ssl_cert != NULL ) && strlen(ssl_cert) ) {
0 0 if ( ( ssl_key != NULL ) && strlen(ssl_key) && ( ssl_cert != NULL ) && strlen(ssl_cert) ) {
1216 0 0 if ( amqp_ssl_socket_set_key( sock, ssl_cert, ssl_key ) ) {
1223 0 38 if (!sock) {
1229 19 39 while ( amqp_data_in_buffer(conn) ) {
1235 0 39 if (strcasecmp(sasl_method, "external") == 0) {
1239 38 1 die_on_error(aTHX_ amqp_socket_open_noblock(sock, hostname, port, (timeout<0)?NULL:&to), conn, "opening socket");
1253 36 1 assert_amqp_connected(conn);
0 36 assert_amqp_connected(conn);
1264 1 1 if ( ! has_valid_connection( conn ) ) {
0 1 if ( ! has_valid_connection( conn ) ) {
1284 26 1 assert_amqp_connected(conn);
0 26 assert_amqp_connected(conn);
1286 26 0 if(options) {
1287 26 0 str_from_hv(options, exchange_type);
26 0 str_from_hv(options, exchange_type);
1288 25 1 int_from_hv(options, passive);
25 0 int_from_hv(options, passive);
1289 25 1 int_from_hv(options, durable);
25 0 int_from_hv(options, durable);
1290 26 0 int_from_hv(options, auto_delete);
26 0 int_from_hv(options, auto_delete);
1291 21 5 int_from_hv(options, internal);
21 0 int_from_hv(options, internal);
1293 1 25 if(args)
1328 27 1 assert_amqp_connected(conn);
0 27 assert_amqp_connected(conn);
1330 27 0 if(options) {
1331 27 0 int_from_hv(options, if_unused);
27 0 int_from_hv(options, if_unused);
1348 3 0 assert_amqp_connected(conn);
0 3 assert_amqp_connected(conn);
1351 3 0 if( ( source == NULL || 0 == strlen(source) )
2 1 if( ( source == NULL || 0 == strlen(source) )
1352 2 0 ||
1353 1 1 ( destination == NULL || 0 == strlen(destination) )
1360 1 0 if(args)
1387 3 0 assert_amqp_connected(conn);
0 3 assert_amqp_connected(conn);
1390 3 0 if( ( source == NULL || 0 == strlen(source) )
2 1 if( ( source == NULL || 0 == strlen(source) )
1391 2 0 ||
1392 1 1 ( destination == NULL || 0 == strlen(destination) )
1399 1 0 if(args)
1424 20 1 assert_amqp_connected(conn);
0 20 assert_amqp_connected(conn);
1426 20 0 if(options) {
1427 20 0 int_from_hv(options, if_unused);
20 0 int_from_hv(options, if_unused);
1428 20 0 int_from_hv(options, if_empty);
20 0 int_from_hv(options, if_empty);
1437 0 20 if (reply == NULL) {
1440 0 20 XPUSHs(sv_2mortal(newSVuv(reply->message_count)));
1458 20 1 assert_amqp_connected(conn);
0 20 assert_amqp_connected(conn);
1460 20 0 if(queuename && strcmp(queuename, "")) queuename_b = amqp_cstring_bytes(queuename);
16 4 if(queuename && strcmp(queuename, "")) queuename_b = amqp_cstring_bytes(queuename);
1461 20 0 if(options) {
1462 16 4 int_from_hv(options, passive);
16 0 int_from_hv(options, passive);
1463 16 4 int_from_hv(options, durable);
16 0 int_from_hv(options, durable);
1464 16 4 int_from_hv(options, exclusive);
16 0 int_from_hv(options, exclusive);
1465 20 0 int_from_hv(options, auto_delete);
20 0 int_from_hv(options, auto_delete);
1467 2 18 if(args)
1475 0 19 XPUSHs(sv_2mortal(newSVpvn(r->queue.bytes, r->queue.len)));
1476 19 0 if(GIMME_V == G_ARRAY) {
1 18 if(GIMME_V == G_ARRAY) {
1477 0 1 XPUSHs(sv_2mortal(newSVuv(r->message_count)));
1478 0 1 XPUSHs(sv_2mortal(newSVuv(r->consumer_count)));
1492 18 3 assert_amqp_connected(conn);
0 18 assert_amqp_connected(conn);
1494 18 0 if(queuename == NULL
1495 18 0 ||
1497 18 0 ||
1499 0 18 ||
1506 2 16 if(args)
1526 21 1 assert_amqp_connected(conn);
0 21 assert_amqp_connected(conn);
1528 21 0 if(queuename == NULL || exchange == NULL)
0 21 if(queuename == NULL || exchange == NULL)
1533 1 20 if(args)
1557 16 1 assert_amqp_connected(conn);
0 16 assert_amqp_connected(conn);
1559 16 0 if(options) {
1560 16 0 str_from_hv(options, consumer_tag);
16 0 str_from_hv(options, consumer_tag);
1561 16 0 int_from_hv(options, no_local);
16 0 int_from_hv(options, no_local);
1562 16 0 int_from_hv(options, no_ack);
16 0 int_from_hv(options, no_ack);
1563 16 0 int_from_hv(options, exclusive);
16 0 int_from_hv(options, exclusive);
1565 16 0 r = amqp_basic_consume(conn, channel, amqp_cstring_bytes(queuename),
1581 3 1 assert_amqp_connected(conn);
1 2 assert_amqp_connected(conn);
1586 0 1 if ( r == NULL ) {
1590 1 0 if(strlen(consumer_tag) == r->consumer_tag.len && 0 == strcmp(consumer_tag, (char *)r->consumer_tag.bytes)) {
0 1 if(strlen(consumer_tag) == r->consumer_tag.len && 0 == strcmp(consumer_tag, (char *)r->consumer_tag.bytes)) {
1608 26 1 assert_amqp_connected(conn);
0 26 assert_amqp_connected(conn);
1610 6 20 if (timeout > 0) {
1616 2 24 if (timeout == -1) {
1622 8 18 ret = consume_message(conn, &RETVAL, timeout ? &timeout_tv : NULL);
1623 4 22 if (AMQP_RESPONSE_LIBRARY_EXCEPTION != ret.reply_type || AMQP_STATUS_TIMEOUT != ret.library_error)
0 4 if (AMQP_RESPONSE_LIBRARY_EXCEPTION != ret.reply_type || AMQP_STATUS_TIMEOUT != ret.library_error)
1636 2 1 assert_amqp_connected(conn);
0 2 assert_amqp_connected(conn);
1649 1 1 assert_amqp_connected(conn);
0 1 assert_amqp_connected(conn);
1670 1 1 assert_amqp_connected(conn);
0 1 assert_amqp_connected(conn);
1690 19 1 assert_amqp_connected(conn);
0 19 assert_amqp_connected(conn);
1716 29 1 assert_amqp_connected(conn);
0 29 assert_amqp_connected(conn);
1719 29 0 body_b.bytes = SvPV(body, len);
1721 29 0 if(options) {
1722 0 29 if(NULL != (v = hv_fetchs(options, "mandatory", 0))) {
1723 0 0 mandatory = SvIV(*v) ? 1 : 0;
1725 0 29 if(NULL != (v = hv_fetchs(options, "immediate", 0))) {
1726 0 0 immediate = SvIV(*v) ? 1 : 0;
1728 29 0 if(NULL != (v = hv_fetchs(options, "exchange", 0))) {
1729 29 0 exchange_b = amqp_cstring_bytes(SvPV_nolen(*v));
1733 1 28 int_from_hv(options, force_utf8_in_header_strings);
1 0 int_from_hv(options, force_utf8_in_header_strings);
1737 29 0 if (props) {
1738 5 24 if (NULL != (v = hv_fetchs(props, "content_type", 0))) {
1739 5 0 properties.content_type = amqp_cstring_bytes(SvPV_nolen(*v));
1742 8 21 if (NULL != (v = hv_fetchs(props, "content_encoding", 0))) {
1743 8 0 properties.content_encoding = amqp_cstring_bytes(SvPV_nolen(*v));
1746 5 24 if (NULL != (v = hv_fetchs(props, "correlation_id", 0))) {
1747 5 0 properties.correlation_id = amqp_cstring_bytes(SvPV_nolen(*v));
1750 5 24 if (NULL != (v = hv_fetchs(props, "reply_to", 0))) {
1751 5 0 properties.reply_to = amqp_cstring_bytes(SvPV_nolen(*v));
1754 5 24 if (NULL != (v = hv_fetchs(props, "expiration", 0))) {
1755 0 5 properties.expiration = amqp_cstring_bytes(SvPV_nolen(*v));
1758 5 24 if (NULL != (v = hv_fetchs(props, "message_id", 0))) {
1759 5 0 properties.message_id = amqp_cstring_bytes(SvPV_nolen(*v));
1762 5 24 if (NULL != (v = hv_fetchs(props, "type", 0))) {
1763 5 0 properties.type = amqp_cstring_bytes(SvPV_nolen(*v));
1766 5 24 if (NULL != (v = hv_fetchs(props, "user_id", 0))) {
1767 5 0 properties.user_id = amqp_cstring_bytes(SvPV_nolen(*v));
1770 5 24 if (NULL != (v = hv_fetchs(props, "app_id", 0))) {
1771 5 0 properties.app_id = amqp_cstring_bytes(SvPV_nolen(*v));
1774 5 24 if (NULL != (v = hv_fetchs(props, "delivery_mode", 0))) {
1775 5 0 properties.delivery_mode = (uint8_t) SvIV(*v);
1778 5 24 if (NULL != (v = hv_fetchs(props, "priority", 0))) {
1779 5 0 properties.priority = (uint8_t) SvIV(*v);
1782 5 24 if (NULL != (v = hv_fetchs(props, "timestamp", 0))) {
1786 10 19 if (NULL != (v = hv_fetchs(props, "headers", 0)) && SvOK(*v)) {
1 9 if (NULL != (v = hv_fetchs(props, "headers", 0)) && SvOK(*v)) {
1 0 if (NULL != (v = hv_fetchs(props, "headers", 0)) && SvOK(*v)) {
0 1 if (NULL != (v = hv_fetchs(props, "headers", 0)) && SvOK(*v)) {
1796 29 0 if ( rv == AMQP_STATUS_CONNECTION_CLOSED || rv == AMQP_STATUS_SOCKET_ERROR ) {
1 28 if ( rv == AMQP_STATUS_CONNECTION_CLOSED || rv == AMQP_STATUS_SOCKET_ERROR ) {
1802 0 28 if ( rv != AMQP_STATUS_OK ) {
1815 22 1 assert_amqp_connected(conn);
0 22 assert_amqp_connected(conn);
1817 5 17 if (options)
1818 5 0 int_from_hv(options, no_ack);
5 0 int_from_hv(options, no_ack);
1821 22 0 die_on_amqp_error(aTHX_ basic_get(conn, channel, queuename ? amqp_cstring_bytes(queuename) : amqp_empty_bytes, &RETVAL, no_ack), conn, "basic_get");
1849 1 1 if ( has_valid_connection( conn ) ) {
1 0 if ( has_valid_connection( conn ) ) {
1863 81 6 if ( has_valid_connection( conn ) ) {
78 3 if ( has_valid_connection( conn ) ) {
1879 4 1 if ( amqp_get_socket(conn) != NULL ) {
1896 29 2 if ( amqp_get_socket(conn) != NULL ) {
1952 4 4 if (timeout_tv == NULL) {
1978 7 0 if (args == NULL || !SvOK(args) || args == &PL_sv_undef) {
3 4 if (args == NULL || !SvOK(args) || args == &PL_sv_undef) {
3 0 if (args == NULL || !SvOK(args) || args == &PL_sv_undef) {
0 3 if (args == NULL || !SvOK(args) || args == &PL_sv_undef) {
0 4 if (args == NULL || !SvOK(args) || args == &PL_sv_undef) {
1981 2 1 if (old_timeout != NULL) {
1989 2 2 int_from_hv(SvRV(args), tv_sec);
2 0 int_from_hv(SvRV(args), tv_sec);
1990 2 2 int_from_hv(SvRV(args), tv_usec);
2 0 int_from_hv(SvRV(args), tv_usec);
2010 1 0 if(args) {
2011 0 1 if(NULL != (v = hv_fetchs(args, "prefetch_size", 0))) prefetch_size = SvIV(*v);
0 0 if(NULL != (v = hv_fetchs(args, "prefetch_size", 0))) prefetch_size = SvIV(*v);
2012 1 0 if(NULL != (v = hv_fetchs(args, "prefetch_count", 0))) prefetch_count = SvIV(*v);
1 0 if(NULL != (v = hv_fetchs(args, "prefetch_count", 0))) prefetch_count = SvIV(*v);
2013 0 1 if(NULL != (v = hv_fetchs(args, "global", 0))) global = SvIV(*v) ? 1 : 0;
0 0 if(NULL != (v = hv_fetchs(args, "global", 0))) global = SvIV(*v) ? 1 : 0;
2024 1 1 assert_amqp_connected(conn);
0 1 assert_amqp_connected(conn);
2026 1 0 if ( server_properties )
2042 2 1 assert_amqp_connected(conn);
0 2 assert_amqp_connected(conn);
2044 2 0 if ( client_properties )