Branch Coverage

RabbitMQ.xs
Criterion Covered Total %
branch 372 618 60.1


line true false branch
88 180 0 if (amqp_release_buffers_ok(state)) {
116 42 0 if ( x == AMQP_STATUS_CONNECTION_CLOSED || x == AMQP_STATUS_SOCKET_ERROR ) {
0 42 if ( x == AMQP_STATUS_CONNECTION_CLOSED || x == AMQP_STATUS_SOCKET_ERROR ) {
121 1 41 else if (x < 0) {
138 0 0 if (
140 0 0 ||
148 0 0 Perl_croak(aTHX_ "%s: %s\n", context,
150 0 0 (x.library_error == AMQP_STATUS_UNKNOWN_TYPE) ? "unknown AMQP type id" :
214 10 121 if ( SvROK( *perl_value ) ) {
216 5 5 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVAV ) {
221 5 0 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVHV ) {
232 0 121 if ( SvUOK( *perl_value ) ) {
243 0 0 if ( SvI64OK( *perl_value ) ) {
246 0 0 if ( SvU64OK( *perl_value ) ) {
250 0 0 if ( SvIOK( *perl_value ) ) {
251 0 0 if ( SvUOK( *perl_value ) ) {
259 0 0 if ( SvNOK( *perl_value ) ) {
265 25 4 if ( force_utf8 || SvUTF8( *perl_value ) ) {
1 24 if ( force_utf8 || SvUTF8( *perl_value ) ) {
271 2 1 if ( SvPOK( *perl_value ) || SvPOKp( *perl_value ) ) {
0 2 if ( SvPOK( *perl_value ) || SvPOKp( *perl_value ) ) {
272 1 0 if ( force_utf8 || SvUTF8( *perl_value ) ) {
0 1 if ( force_utf8 || SvUTF8( *perl_value ) ) {
277 1 1 if ( SvIOK( *perl_value ) || SvIOKp( *perl_value ) ) {
0 1 if ( SvIOK( *perl_value ) || SvIOKp( *perl_value ) ) {
278 0 1 if ( SvUOK( *perl_value ) ) {
283 0 1 if ( SvNOK( *perl_value ) || SvNOKp( *perl_value ) ) {
0 0 if ( SvNOK( *perl_value ) || SvNOKp( *perl_value ) ) {
288 0 0 if ( SvROK( *perl_value ) ) {
290 0 0 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVAV ) {
295 0 0 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVHV ) {
304 0 0 Perl_croak(
327 0 25 if (AMQP_STATUS_OK != res) {
333 0 25 if (AMQP_FRAME_HEADER != frame.frame_type) {
334 0 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
0 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
335 0 0 (AMQP_CHANNEL_CLOSE_METHOD == frame.payload.method.id ||
357 4 21 if (p->_flags & AMQP_BASIC_CONTENT_TYPE_FLAG) {
360 7 18 if (p->_flags & AMQP_BASIC_CONTENT_ENCODING_FLAG) {
368 7 0 if (
370 7 0 &&
376 4 21 if (p->_flags & AMQP_BASIC_CORRELATION_ID_FLAG) {
379 4 21 if (p->_flags & AMQP_BASIC_REPLY_TO_FLAG) {
382 4 21 if (p->_flags & AMQP_BASIC_EXPIRATION_FLAG) {
385 4 21 if (p->_flags & AMQP_BASIC_MESSAGE_ID_FLAG) {
388 4 21 if (p->_flags & AMQP_BASIC_TYPE_FLAG) {
391 4 21 if (p->_flags & AMQP_BASIC_USER_ID_FLAG) {
394 4 21 if (p->_flags & AMQP_BASIC_APP_ID_FLAG) {
397 4 21 if (p->_flags & AMQP_BASIC_DELIVERY_MODE_FLAG) {
400 4 21 if (p->_flags & AMQP_BASIC_PRIORITY_FLAG) {
403 4 21 if (p->_flags & AMQP_BASIC_TIMESTAMP_FLAG) {
406 9 16 if (p->_flags & AMQP_BASIC_HEADERS_FLAG) {
413 31 9 for( i=0; i < p->headers.num_entries; ++i ) {
531 2 8 hv_store( headers,
586 18 7 if (is_utf8_body)
591 34 25 while (body_remaining > 0) {
595 0 34 if (AMQP_STATUS_OK != res) {
601 0 34 if (AMQP_FRAME_BODY != frame.frame_type) {
602 0 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
0 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
603 0 0 (AMQP_CHANNEL_CLOSE_METHOD == frame.payload.method.id ||
616 0 34 if (fragment_len > body_remaining) {
659 4 22 if (AMQP_STATUS_OK != res) {
665 22 0 if (AMQP_FRAME_METHOD != frame.frame_type ||
1 21 if (AMQP_FRAME_METHOD != frame.frame_type ||
668 1 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
0 1 if (AMQP_FRAME_METHOD == frame.frame_type &&
669 0 0 (AMQP_CHANNEL_CLOSE_METHOD == frame.payload.method.id ||
698 0 21 if (AMQP_RESPONSE_NORMAL != ret.reply_type)
728 114 5 for ( idx = 0; idx <= av_len(perl_array); idx += 1) {
753 0 0 element->value.f64 = (double) SvNV(*value);
758 11 0 element->value.bytes = amqp_cstring_bytes(SvPV_nolen(*value));
784 114 5 for (; current_entry < mq_array->num_entries; current_entry += 1) {
883 37 9 for( i=0; i < mq_table->num_entries; i += 1 ) {
989 0 20 amqp_table_entry_t *new_entries = amqp_pool_alloc( &temp_memory_pool, HvKEYS(hash) * sizeof(amqp_table_entry_t) );
993 50 20 while (NULL != (he = hv_iternext(hash))) {
998 0 50 if (SvGMAGICAL(value)) {
1007 50 0 if (
1011 0 50 &&
1013 0 0 &&
1047 2 0 entry->value.value.f64 = (double) SvNV( value );
1052 19 0 entry->value.value.bytes = amqp_cstring_bytes( SvPV_nolen( value )
1090 0 22 if (AMQP_RESPONSE_NORMAL != ret.reply_type)
1093 18 4 if (AMQP_BASIC_GET_OK_METHOD != ret.reply.id)
1108 0 4 if (AMQP_RESPONSE_NORMAL != ret.reply_type)
1115 4 18 *envelope_sv_ptr = envelope_hv ? newRV_noinc(MUTABLE_SV(envelope_hv)) : &PL_sv_undef;
1134 0 32 PERL_MATH_INT64_LOAD_OR_CROAK;
1162 38 0 str_from_hv(options, user);
38 0 str_from_hv(options, user);
1163 38 0 str_from_hv(options, password);
38 0 str_from_hv(options, password);
1164 38 0 str_from_hv(options, vhost);
38 0 str_from_hv(options, vhost);
1165 0 38 int_from_hv(options, channel_max);
0 0 int_from_hv(options, channel_max);
1166 0 38 int_from_hv(options, frame_max);
0 0 int_from_hv(options, frame_max);
1167 1 37 int_from_hv(options, heartbeat);
1 0 int_from_hv(options, heartbeat);
1168 38 0 int_from_hv(options, port);
38 0 int_from_hv(options, port);
1169 1 37 double_from_hv(options, timeout);
0 1 double_from_hv(options, timeout);
1171 38 0 int_from_hv(options, ssl);
38 0 int_from_hv(options, ssl);
1172 38 0 str_from_hv(options, ssl_cacert);
38 0 str_from_hv(options, ssl_cacert);
1173 0 38 str_from_hv(options, ssl_cert);
0 0 str_from_hv(options, ssl_cert);
1174 0 38 str_from_hv(options, ssl_key);
0 0 str_from_hv(options, ssl_key);
1175 38 0 int_from_hv(options, ssl_verify_host);
38 0 int_from_hv(options, ssl_verify_host);
1176 38 0 int_from_hv(options, ssl_init);
38 0 int_from_hv(options, ssl_init);
1177 0 38 str_from_hv(options, sasl_method);
0 0 str_from_hv(options, sasl_method);
1179 1 37 if(timeout >= 0) {
1184 1 37 if ( ssl ) {
1190 0 1 if ( !sock ) {
1196 1 0 if ( ( ssl_cacert != NULL ) && strlen(ssl_cacert) ) {
1 0 if ( ( ssl_cacert != NULL ) && strlen(ssl_cacert) ) {
1197 0 1 if ( amqp_ssl_socket_set_cacert(sock, ssl_cacert) ) {
1207 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) ) {
1208 0 0 if ( amqp_ssl_socket_set_key( sock, ssl_cert, ssl_key ) ) {
1215 0 37 if (!sock) {
1221 21 38 while ( amqp_data_in_buffer(conn) ) {
1227 0 38 if (strcasecmp(sasl_method, "external") == 0) {
1231 37 1 die_on_error(aTHX_ amqp_socket_open_noblock(sock, hostname, port, (timeout<0)?NULL:&to), conn, "opening socket");
1245 36 1 assert_amqp_connected(conn);
0 36 assert_amqp_connected(conn);
1256 1 1 if ( ! has_valid_connection( conn ) ) {
0 1 if ( ! has_valid_connection( conn ) ) {
1276 26 1 assert_amqp_connected(conn);
0 26 assert_amqp_connected(conn);
1278 26 0 if(options) {
1279 26 0 str_from_hv(options, exchange_type);
26 0 str_from_hv(options, exchange_type);
1280 25 1 int_from_hv(options, passive);
25 0 int_from_hv(options, passive);
1281 25 1 int_from_hv(options, durable);
25 0 int_from_hv(options, durable);
1282 26 0 int_from_hv(options, auto_delete);
26 0 int_from_hv(options, auto_delete);
1283 21 5 int_from_hv(options, internal);
21 0 int_from_hv(options, internal);
1285 1 25 if(args)
1312 27 1 assert_amqp_connected(conn);
0 27 assert_amqp_connected(conn);
1314 27 0 if(options) {
1315 27 0 int_from_hv(options, if_unused);
27 0 int_from_hv(options, if_unused);
1332 3 0 assert_amqp_connected(conn);
0 3 assert_amqp_connected(conn);
1335 3 0 if( ( source == NULL || 0 == strlen(source) )
2 1 if( ( source == NULL || 0 == strlen(source) )
1336 2 0 ||
1337 1 1 ( destination == NULL || 0 == strlen(destination) )
1344 1 0 if(args)
1371 3 0 assert_amqp_connected(conn);
0 3 assert_amqp_connected(conn);
1374 3 0 if( ( source == NULL || 0 == strlen(source) )
2 1 if( ( source == NULL || 0 == strlen(source) )
1375 2 0 ||
1376 1 1 ( destination == NULL || 0 == strlen(destination) )
1383 1 0 if(args)
1408 20 1 assert_amqp_connected(conn);
0 20 assert_amqp_connected(conn);
1410 20 0 if(options) {
1411 20 0 int_from_hv(options, if_unused);
20 0 int_from_hv(options, if_unused);
1412 20 0 int_from_hv(options, if_empty);
20 0 int_from_hv(options, if_empty);
1421 0 20 if (reply == NULL) {
1424 0 20 XPUSHs(sv_2mortal(newSVuv(reply->message_count)));
1442 20 1 assert_amqp_connected(conn);
0 20 assert_amqp_connected(conn);
1444 20 0 if(queuename && strcmp(queuename, "")) queuename_b = amqp_cstring_bytes(queuename);
16 4 if(queuename && strcmp(queuename, "")) queuename_b = amqp_cstring_bytes(queuename);
1445 20 0 if(options) {
1446 16 4 int_from_hv(options, passive);
16 0 int_from_hv(options, passive);
1447 16 4 int_from_hv(options, durable);
16 0 int_from_hv(options, durable);
1448 16 4 int_from_hv(options, exclusive);
16 0 int_from_hv(options, exclusive);
1449 20 0 int_from_hv(options, auto_delete);
20 0 int_from_hv(options, auto_delete);
1451 0 20 if(args)
1459 0 19 XPUSHs(sv_2mortal(newSVpvn(r->queue.bytes, r->queue.len)));
1460 19 0 if(GIMME_V == G_ARRAY) {
1 18 if(GIMME_V == G_ARRAY) {
1461 0 1 XPUSHs(sv_2mortal(newSVuv(r->message_count)));
1462 0 1 XPUSHs(sv_2mortal(newSVuv(r->consumer_count)));
1476 18 3 assert_amqp_connected(conn);
0 18 assert_amqp_connected(conn);
1478 18 0 if(queuename == NULL
1479 18 0 ||
1481 18 0 ||
1483 0 18 ||
1490 2 16 if(args)
1510 21 1 assert_amqp_connected(conn);
0 21 assert_amqp_connected(conn);
1512 21 0 if(queuename == NULL || exchange == NULL)
0 21 if(queuename == NULL || exchange == NULL)
1517 1 20 if(args)
1541 16 1 assert_amqp_connected(conn);
0 16 assert_amqp_connected(conn);
1543 16 0 if(options) {
1544 16 0 str_from_hv(options, consumer_tag);
16 0 str_from_hv(options, consumer_tag);
1545 16 0 int_from_hv(options, no_local);
16 0 int_from_hv(options, no_local);
1546 16 0 int_from_hv(options, no_ack);
16 0 int_from_hv(options, no_ack);
1547 16 0 int_from_hv(options, exclusive);
16 0 int_from_hv(options, exclusive);
1549 16 0 r = amqp_basic_consume(conn, channel, amqp_cstring_bytes(queuename),
1565 3 1 assert_amqp_connected(conn);
1 2 assert_amqp_connected(conn);
1570 0 1 if ( r == NULL ) {
1574 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)) {
1592 26 1 assert_amqp_connected(conn);
0 26 assert_amqp_connected(conn);
1594 6 20 if (timeout > 0) {
1600 2 24 if (timeout == -1) {
1606 8 18 ret = consume_message(conn, &RETVAL, timeout ? &timeout_tv : NULL);
1607 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)
1620 2 1 assert_amqp_connected(conn);
0 2 assert_amqp_connected(conn);
1633 1 1 assert_amqp_connected(conn);
0 1 assert_amqp_connected(conn);
1654 1 1 assert_amqp_connected(conn);
0 1 assert_amqp_connected(conn);
1674 19 1 assert_amqp_connected(conn);
0 19 assert_amqp_connected(conn);
1700 29 1 assert_amqp_connected(conn);
0 29 assert_amqp_connected(conn);
1703 29 0 body_b.bytes = SvPV(body, len);
1705 29 0 if(options) {
1706 0 29 if(NULL != (v = hv_fetchs(options, "mandatory", 0))) {
1707 0 0 mandatory = SvIV(*v) ? 1 : 0;
1709 0 29 if(NULL != (v = hv_fetchs(options, "immediate", 0))) {
1710 0 0 immediate = SvIV(*v) ? 1 : 0;
1712 29 0 if(NULL != (v = hv_fetchs(options, "exchange", 0))) {
1713 29 0 exchange_b = amqp_cstring_bytes(SvPV_nolen(*v));
1717 1 28 int_from_hv(options, force_utf8_in_header_strings);
1 0 int_from_hv(options, force_utf8_in_header_strings);
1721 29 0 if (props) {
1722 5 24 if (NULL != (v = hv_fetchs(props, "content_type", 0))) {
1723 5 0 properties.content_type = amqp_cstring_bytes(SvPV_nolen(*v));
1726 8 21 if (NULL != (v = hv_fetchs(props, "content_encoding", 0))) {
1727 8 0 properties.content_encoding = amqp_cstring_bytes(SvPV_nolen(*v));
1730 5 24 if (NULL != (v = hv_fetchs(props, "correlation_id", 0))) {
1731 5 0 properties.correlation_id = amqp_cstring_bytes(SvPV_nolen(*v));
1734 5 24 if (NULL != (v = hv_fetchs(props, "reply_to", 0))) {
1735 5 0 properties.reply_to = amqp_cstring_bytes(SvPV_nolen(*v));
1738 5 24 if (NULL != (v = hv_fetchs(props, "expiration", 0))) {
1739 0 5 properties.expiration = amqp_cstring_bytes(SvPV_nolen(*v));
1742 5 24 if (NULL != (v = hv_fetchs(props, "message_id", 0))) {
1743 5 0 properties.message_id = amqp_cstring_bytes(SvPV_nolen(*v));
1746 5 24 if (NULL != (v = hv_fetchs(props, "type", 0))) {
1747 5 0 properties.type = amqp_cstring_bytes(SvPV_nolen(*v));
1750 5 24 if (NULL != (v = hv_fetchs(props, "user_id", 0))) {
1751 5 0 properties.user_id = amqp_cstring_bytes(SvPV_nolen(*v));
1754 5 24 if (NULL != (v = hv_fetchs(props, "app_id", 0))) {
1755 5 0 properties.app_id = amqp_cstring_bytes(SvPV_nolen(*v));
1758 5 24 if (NULL != (v = hv_fetchs(props, "delivery_mode", 0))) {
1759 5 0 properties.delivery_mode = (uint8_t) SvIV(*v);
1762 5 24 if (NULL != (v = hv_fetchs(props, "priority", 0))) {
1763 5 0 properties.priority = (uint8_t) SvIV(*v);
1766 5 24 if (NULL != (v = hv_fetchs(props, "timestamp", 0))) {
1770 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)) {
1780 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 ) {
1786 0 28 if ( rv != AMQP_STATUS_OK ) {
1799 22 1 assert_amqp_connected(conn);
0 22 assert_amqp_connected(conn);
1801 5 17 if (options)
1802 5 0 int_from_hv(options, no_ack);
5 0 int_from_hv(options, no_ack);
1805 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");
1833 1 1 if ( has_valid_connection( conn ) ) {
1 0 if ( has_valid_connection( conn ) ) {
1847 80 7 if ( has_valid_connection( conn ) ) {
77 3 if ( has_valid_connection( conn ) ) {
1863 4 1 if ( amqp_get_socket(conn) != NULL ) {
1880 27 2 if ( amqp_get_socket(conn) != NULL ) {
1940 1 0 if(args) {
1941 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);
1942 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);
1943 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;
1954 1 1 assert_amqp_connected(conn);
0 1 assert_amqp_connected(conn);
1956 1 0 if ( server_properties )
1972 1 1 assert_amqp_connected(conn);
0 1 assert_amqp_connected(conn);
1974 1 0 if ( client_properties )