Branch Coverage

Shared.xs
Criterion Covered Total %
branch 325 556 58.4


line true false branch
124 30 7 const char *p = SvOK(path) ? SvPV_nolen(path) : NULL;
126 2 35 if (!h) croak("Data::Queue::Shared::Int->new: %s", errbuf);
143 0 6 if (!h) croak("Data::Queue::Shared::Int->new_memfd: %s", errbuf);
159 0 1 if (!h) croak("Data::Queue::Shared::Int->new_from_fd: %s", errbuf);
171 2 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
173 0 2 RETVAL = h->backing_fd;
181 42 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 42 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 42 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
191 137 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 137 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 137 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
193 134 3 RETVAL = queue_int_try_push(h, (int64_t)value);
202 45 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 45 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 45 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
205 42 3 if (queue_int_try_pop(h, &value))
217 2 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
220 2 0 if (items > 2) timeout = SvNV(ST(2));
221 1 1 RETVAL = queue_int_push_wait(h, (int64_t)value, timeout);
230 104 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 104 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 104 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
234 104 0 if (items > 1) timeout = SvNV(ST(1));
235 103 1 if (queue_int_pop_wait(h, &value, timeout))
246 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
250 11 2 for (uint32_t i = 0; i < count; i++) {
251 1 10 if (!queue_int_try_push(h, (int64_t)SvIV(ST(i + 1)))) break;
255 0 3 RETVAL = pushed;
264 2 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
267 6 1 for (UV i = 0; i < count; i++) {
268 1 5 if (!queue_int_try_pop(h, &value)) break;
269 0 5 mXPUSHi((IV)value);
276 8 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 8 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 8 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
286 6 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 6 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 6 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
288 0 6 RETVAL = h->capacity;
296 5 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 5 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 5 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
298 4 1 RETVAL = (queue_int_size(h) == 0);
306 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
308 2 1 RETVAL = (queue_int_size(h) >= h->capacity);
316 5 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 5 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 5 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
325 7 1 if (sv_isobject(self_or_class)) {
327 0 7 if (!h) croak("Attempted to use a destroyed object");
330 0 1 if (items < 2) croak("Usage: Data::Queue::Shared::Int->unlink($path)");
333 2 6 if (!path) croak("cannot unlink anonymous or memfd queue");
334 0 6 if (unlink(path) != 0)
341 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
343 1 2 RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef;
351 6 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 6 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 6 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
373 9 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 9 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 9 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
376 6 3 if (queue_int_peek(h, &value))
387 12 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 12 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 12 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
391 1 11 max_count = (items > 1) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
392 65 1 while (max_count-- > 0 && queue_int_try_pop(h, &value))
54 11 while (max_count-- > 0 && queue_int_try_pop(h, &value))
393 0 54 mXPUSHi((IV)value);
400 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
404 3 0 if (items > 2) timeout = SvNV(ST(2));
406 1 2 if (!queue_int_pop_wait(h, &value, timeout)) XSRETURN(0);
407 0 2 mXPUSHi((IV)value);
409 8 0 for (UV i = 1; i < count; i++) {
410 2 6 if (!queue_int_try_pop(h, &value)) break;
411 0 6 mXPUSHi((IV)value);
419 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
423 11 2 for (uint32_t i = 0; i < nvalues; i++) {
424 1 10 if (!queue_int_push_wait(h, (int64_t)SvIV(ST(i + 2)), timeout)) break;
434 2 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
436 0 2 if (queue_sync(h) != 0)
443 8 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 8 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 8 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
446 0 8 if (RETVAL < 0) croak("eventfd: %s", strerror(errno));
455 1 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 1 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 1 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
463 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
465 0 3 RETVAL = h->notify_fd;
473 6 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 6 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 6 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
481 5 0 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 5 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
0 5 EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
496 13 23 if (items > 3)
500 32 4 const char *p = SvOK(path) ? SvPV_nolen(path) : NULL;
502 1 35 if (!h) croak("Data::Queue::Shared::Str->new: %s", errbuf);
519 1 3 if (items > 3)
524 0 4 if (!h) croak("Data::Queue::Shared::Str->new_memfd: %s", errbuf);
540 0 1 if (!h) croak("Data::Queue::Shared::Str->new_from_fd: %s", errbuf);
552 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
554 0 3 RETVAL = h->backing_fd;
562 40 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 40 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 40 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
572 167 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 167 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 167 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
578 0 167 if (r == -2) croak("Data::Queue::Shared::Str: string too long (max 2GB)");
579 164 3 RETVAL = (r == 1);
588 81 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 81 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 81 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
594 78 3 if (r == 1) {
596 3 75 if (utf8) SvUTF8_on(RETVAL);
597 0 3 } else if (r == -1) {
610 2 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
614 2 0 if (items > 2) timeout = SvNV(ST(2));
618 0 2 if (r == -2) croak("Data::Queue::Shared::Str: string too long (max 2GB)");
619 1 1 RETVAL = (r == 1);
628 54 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 54 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 54 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
634 54 0 if (items > 1) timeout = SvNV(ST(1));
636 53 1 if (r == 1) {
638 0 53 if (utf8) SvUTF8_on(RETVAL);
639 0 1 } else if (r == -1) {
651 2 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
656 6 1 for (uint32_t i = 0; i < count; i++) {
662 0 6 if (r == -2) { queue_mutex_unlock(h->hdr); croak("Data::Queue::Shared::Str: string too long (max 2GB)"); }
663 1 5 if (r != 1) break;
667 2 0 if (pushed) queue_wake_consumers(h->hdr);
668 0 2 RETVAL = pushed;
677 1 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 1 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 1 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
684 2 1 for (UV i = 0; i < count; i++) {
686 0 2 if (last_r <= 0) break;
688 0 2 if (utf8) SvUTF8_on(sv);
689 0 2 mXPUSHs(sv);
693 0 1 if (last_r == -1) croak("Data::Queue::Shared::Str: out of memory");
699 6 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 6 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 6 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
709 1 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 1 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 1 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
711 0 1 RETVAL = h->capacity;
719 8 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 8 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 8 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
721 7 1 RETVAL = (queue_str_size(h) == 0);
729 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
731 2 1 RETVAL = (queue_str_size(h) >= h->capacity);
739 7 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 7 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 7 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
748 5 1 if (sv_isobject(self_or_class)) {
750 0 5 if (!h) croak("Attempted to use a destroyed object");
753 0 1 if (items < 2) croak("Usage: Data::Queue::Shared::Str->unlink($path)");
756 0 6 if (!path) croak("cannot unlink anonymous or memfd queue");
757 0 6 if (unlink(path) != 0)
764 2 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
766 1 1 RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef;
774 9 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 9 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 9 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
798 7 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 7 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 7 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
804 6 1 if (r == 1) {
806 1 5 if (utf8) SvUTF8_on(RETVAL);
807 0 1 } else if (r == -1) {
820 14 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 14 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 14 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
826 0 14 if (r == -2) croak("Data::Queue::Shared::Str: string too long (max 2GB)");
827 13 1 RETVAL = (r == 1);
836 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
840 2 1 if (items > 2) timeout = SvNV(ST(2));
844 0 3 if (r == -2) croak("Data::Queue::Shared::Str: string too long (max 2GB)");
845 2 1 RETVAL = (r == 1);
853 8 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 8 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 8 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
859 1 7 max_count = (items > 1) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
862 29 1 while (max_count-- > 0) {
864 7 22 if (last_r <= 0) break;
866 0 22 if (utf8) SvUTF8_on(sv);
867 0 22 mXPUSHs(sv);
871 0 8 if (last_r == -1) croak("Data::Queue::Shared::Str: out of memory");
878 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
884 3 0 if (items > 2) timeout = SvNV(ST(2));
888 0 3 if (r == -1) croak("Data::Queue::Shared::Str: out of memory");
889 1 2 if (r != 1) XSRETURN(0);
891 0 2 if (utf8) SvUTF8_on(sv);
892 0 2 mXPUSHs(sv);
895 6 0 for (UV i = 1; i < count; i++) {
897 2 4 if (r <= 0) break;
899 0 4 if (utf8) SvUTF8_on(sv);
900 0 4 mXPUSHs(sv);
908 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
912 6 2 for (uint32_t i = 0; i < nvalues; i++) {
918 0 6 if (r == -2) croak("Data::Queue::Shared::Str: string too long (max 2GB)");
919 1 5 if (r != 1) break;
929 19 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 19 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 19 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
935 17 2 if (r == 1) {
937 1 16 if (utf8) SvUTF8_on(RETVAL);
938 0 2 } else if (r == -1) {
950 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
956 3 0 if (items > 1) timeout = SvNV(ST(1));
958 2 1 if (r == 1) {
960 0 2 if (utf8) SvUTF8_on(RETVAL);
961 0 1 } else if (r == -1) {
973 2 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
975 0 2 if (queue_sync(h) != 0)
982 2 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
985 0 2 if (RETVAL < 0) croak("eventfd: %s", strerror(errno));
994 0 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
1002 0 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
1004 0 0 RETVAL = h->notify_fd;
1012 3 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 3 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
1020 2 0 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
0 2 EXTRACT_HANDLE("Data::Queue::Shared::Str", self);