diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Test2')
51 files changed, 493 insertions, 275 deletions
diff --git a/Master/tlpkg/tlperl/lib/Test2/API.pm b/Master/tlpkg/tlperl/lib/Test2/API.pm index f5caaa6947b..8193b073661 100755 --- a/Master/tlpkg/tlperl/lib/Test2/API.pm +++ b/Master/tlpkg/tlperl/lib/Test2/API.pm @@ -9,7 +9,7 @@ BEGIN { $ENV{TEST2_ACTIVE} = 1; } -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; my $INST; @@ -70,7 +70,7 @@ use Test2::Event::Subtest(); use Carp qw/carp croak confess/; use Scalar::Util qw/blessed weaken/; -use Test2::Util qw/get_tid clone_io pkg_to_file/; +use Test2::Util qw/get_tid clone_io pkg_to_file gen_uid/; our @EXPORT_OK = qw{ context release @@ -99,6 +99,8 @@ our @EXPORT_OK = qw{ test2_add_uuid_via + test2_add_callback_testing_done + test2_add_callback_context_aquire test2_add_callback_context_acquire test2_add_callback_context_init @@ -127,7 +129,6 @@ our @EXPORT_OK = qw{ test2_ipc_set_pending test2_ipc_get_timeout test2_ipc_set_timeout - test2_ipc_enable_shm test2_formatter test2_formatters @@ -180,6 +181,22 @@ sub test2_no_wait { $INST->no_wait; } +sub test2_add_callback_testing_done { + my $cb = shift; + + test2_add_callback_post_load(sub { + my $stack = test2_stack(); + $stack->top; # Insure we have a hub + my ($hub) = Test2::API::test2_stack->all; + + $hub->set_active(1); + + $hub->follow_up($cb); + }); + + return; +} + sub test2_add_callback_context_acquire { $INST->add_context_acquire_callback(@_) } sub test2_add_callback_context_aquire { $INST->add_context_acquire_callback(@_) } sub test2_add_callback_context_init { $INST->add_context_init_callback(@_) } @@ -213,7 +230,7 @@ sub test2_ipc_get_pending { $INST->get_ipc_pending } sub test2_ipc_set_pending { $INST->set_ipc_pending(@_) } sub test2_ipc_set_timeout { $INST->set_ipc_timeout(@_) } sub test2_ipc_get_timeout { $INST->ipc_timeout() } -sub test2_ipc_enable_shm { $INST->ipc_enable_shm } +sub test2_ipc_enable_shm { 0 } sub test2_formatter { if ($ENV{T2_FORMATTER} && $ENV{T2_FORMATTER} =~ m/^(\+)?(.*)$/) { @@ -289,7 +306,6 @@ sub no_context(&;$) { }; my $UUID_VIA = _add_uuid_via_ref(); -my $CID = 1; sub context { # We need to grab these before anything else to ensure they are not # changed. @@ -369,7 +385,7 @@ sub context { frame => [$pkg, $file, $line, $sub], pid => $$, tid => get_tid(), - cid => 'C' . $CID++, + cid => gen_uid(), hid => $hid, nested => $hub->{nested}, buffered => $hub->{buffered}, @@ -1281,7 +1297,7 @@ to turn this off. These functions return the filehandles that test output should be written to. They are primarily useful when writing a custom formatter and code that turns -events into actual output (TAP, etc.) They will return a dupe of the original +events into actual output (TAP, etc.). They will return a dupe of the original filehandles that formatted output can be sent to regardless of whatever state the currently running test may have left STDOUT and STDERR in. @@ -1326,6 +1342,22 @@ Add a callback that will be called when Test2 is finished loading. This means the callback will be run once, the first time a context is obtained. If Test2 has already finished loading then the callback will be run immediately. +=item test2_add_callback_testing_done(sub { ... }) + +This adds your coderef as a follow-up to the root hub after Test2 is finished loading. + +This is essentially a helper to do the following: + + test2_add_callback_post_load(sub { + my $stack = test2_stack(); + $stack->top; # Insure we have a hub + my ($hub) = Test2::API::test2_stack->all; + + $hub->set_active(1); + + $hub->follow_up(sub { ... }); # <-- Your coderef here + }); + =item test2_add_callback_context_acquire(sub { ... }) Add a callback that will be called every time someone tries to acquire a @@ -1441,8 +1473,7 @@ Turn off IPC polling. =item test2_ipc_enable_shm() -Turn on IPC SHM. Only some IPC drivers use this, and most will turn it on -themselves. +Legacy, this is currently a no-op that returns 0; =item test2_ipc_set_pending($uniq_val) @@ -1557,7 +1588,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/API/Breakage.pm b/Master/tlpkg/tlperl/lib/Test2/API/Breakage.pm index 08aee9dcb1a..ffcf1be582f 100755 --- a/Master/tlpkg/tlperl/lib/Test2/API/Breakage.pm +++ b/Master/tlpkg/tlperl/lib/Test2/API/Breakage.pm @@ -2,7 +2,7 @@ package Test2::API::Breakage; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Test2::Util qw/pkg_to_file/; @@ -168,7 +168,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/API/Context.pm b/Master/tlpkg/tlperl/lib/Test2/API/Context.pm index 6141a43ff8e..9cb1cfca723 100755 --- a/Master/tlpkg/tlperl/lib/Test2/API/Context.pm +++ b/Master/tlpkg/tlperl/lib/Test2/API/Context.pm @@ -2,7 +2,7 @@ package Test2::API::Context; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Carp qw/confess croak/; @@ -325,7 +325,15 @@ sub fail { "Test2::Event::Fail" ); - $e->add_info({tag => 'DIAG', debug => 1, details => $_}) for @diag; + for my $msg (@diag) { + if (ref($msg) eq 'Test2::EventFacet::Info::Table') { + $e->add_info({tag => 'DIAG', debug => 1, $msg->info_args}); + } + else { + $e->add_info({tag => 'DIAG', debug => 1, details => $msg}); + } + } + $self->{+HUB}->send($e); return $e; } @@ -342,7 +350,15 @@ sub fail_and_release { "Test2::Event::Fail" ); - $e->add_info({tag => 'DIAG', debug => 1, details => $_}) for @diag; + for my $msg (@diag) { + if (ref($msg) eq 'Test2::EventFacet::Info::Table') { + $e->add_info({tag => 'DIAG', debug => 1, $msg->info_args}); + } + else { + $e->add_info({tag => 'DIAG', debug => 1, details => $msg}); + } + } + $self->{+HUB}->send($e); $self->release; return 0; @@ -490,7 +506,14 @@ should always use C<context()> which is exported by the L<Test2::API> module. sub my_ok { my ($bool, $name) = @_; my $ctx = context(); - $ctx->ok($bool, $name); + + if ($bool) { + $ctx->pass($name); + } + else { + $ctx->fail($name); + } + $ctx->release; # You MUST do this! return $bool; } @@ -715,6 +738,10 @@ write more clear and compact code. This lets you send an L<Test2::Event::Fail> event. You may optionally provide a C<$name> and C<@diagnostics> messages. +Diagnostics messages can be simple strings, data structures, or instances of +L<Test2::EventFacet::Info::Table> (which are converted inline into the +L<Test2::EventFacet::Info> structure). + =item my $false = $ctx->fail_and_release() =item my $false = $ctx->fail_and_release($name) @@ -760,7 +787,8 @@ failure. If you do not want automatic diagnostics you should use the C<send_event()> method directly. The third argument C<\@on_fail>) is an optional set of diagnostics to be sent in -the event of a test failure. +the event of a test failure. Unlike with C<fail()> these diagnostics must be +plain strings, data structures are not supported. =item $event = $ctx->note($message) @@ -975,7 +1003,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/API/Instance.pm b/Master/tlpkg/tlperl/lib/Test2/API/Instance.pm index 0522dd77aa4..1cf224cf063 100755 --- a/Master/tlpkg/tlperl/lib/Test2/API/Instance.pm +++ b/Master/tlpkg/tlperl/lib/Test2/API/Instance.pm @@ -2,8 +2,7 @@ package Test2::API::Instance; use strict; use warnings; -our $VERSION = '1.302133'; - +our $VERSION = '1.302162'; our @CARP_NOT = qw/Test2::API Test2::API::Instance Test2::IPC::Driver Test2::Formatter/; use Carp qw/confess carp/; @@ -26,9 +25,6 @@ use Test2::Util::HashBase qw{ -preload ipc_disabled - ipc_shm_size - ipc_shm_last - ipc_shm_id ipc_polling ipc_drivers ipc_timeout @@ -216,7 +212,6 @@ sub _finalize { for my $driver (@{$self->{+IPC_DRIVERS}}) { next unless $driver->can('is_viable') && $driver->is_viable; $self->{+IPC} = $driver->new or next; - $self->ipc_enable_shm if $self->{+IPC}->use_shm; return; } @@ -366,91 +361,36 @@ sub enable_ipc_polling { # $_[0] is a context object sub { return unless $self->{+IPC_POLLING}; - return $_[0]->{hub}->cull unless $self->{+IPC_SHM_ID}; - - my $val; - if(shmread($self->{+IPC_SHM_ID}, $val, 0, $self->{+IPC_SHM_SIZE})) { - return if $val eq $self->{+IPC_SHM_LAST}; - $self->{+IPC_SHM_LAST} = $val; - } - else { - warn "SHM Read error: $!\n"; - } - - $_[0]->{hub}->cull; + return unless $self->{+IPC}; + return unless $self->{+IPC}->pending(); + return $_[0]->{hub}->cull; } ) unless defined $self->ipc_polling; $self->set_ipc_polling(1); } -sub ipc_enable_shm { +sub get_ipc_pending { my $self = shift; - - return 1 if defined $self->{+IPC_SHM_ID}; - - $self->{+_PID} = $$ unless defined $self->{+_PID}; - $self->{+_TID} = get_tid() unless defined $self->{+_TID}; - - my ($ok, $err) = try { - # SysV IPC can be available but not enabled. - # - # In some systems (*BSD) accessing the SysV IPC APIs without - # them being enabled can cause a SIGSYS. We suppress the SIGSYS - # and then get ENOSYS from the calls. - local $SIG{SYS} = 'IGNORE' if CAN_SIGSYS; - - require IPC::SysV; - - my $ipc_key = IPC::SysV::IPC_PRIVATE(); - my $shm_size = $self->{+IPC}->can('shm_size') ? $self->{+IPC}->shm_size : 64; - my $shm_id = shmget($ipc_key, $shm_size, 0666) or die "Could not get shm: $!"; - - my $initial = 'a' x $shm_size; - shmwrite($shm_id, $initial, 0, $shm_size) or die "Could not write to shm: $!"; - my $val; - shmread($shm_id, $val, 0, $shm_size) or die "Could not read from shm: $!"; - die "Read SHM value does not match the initial value ('$val' vs '$initial')" - unless $val eq $initial; - - $self->{+IPC_SHM_SIZE} = $shm_size; - $self->{+IPC_SHM_ID} = $shm_id; - $self->{+IPC_SHM_LAST} = $initial; - }; - - return $ok; + return -1 unless $self->{+IPC}; + $self->{+IPC}->pending(); } -sub ipc_free_shm { +sub _check_pid { my $self = shift; - - my $id = delete $self->{+IPC_SHM_ID}; - return unless defined $id; - - shmctl($id, IPC::SysV::IPC_RMID(), 0); -} - -sub get_ipc_pending { - my $self = shift; - return -1 unless defined $self->{+IPC_SHM_ID}; - my $val; - shmread($self->{+IPC_SHM_ID}, $val, 0, $self->{+IPC_SHM_SIZE}) or return -1; - return 0 if $val eq $self->{+IPC_SHM_LAST}; - $self->{+IPC_SHM_LAST} = $val; - return 1; + my ($pid) = @_; + return kill(0, $pid); } sub set_ipc_pending { my $self = shift; - - return undef unless defined $self->{+IPC_SHM_ID}; - + return unless $self->{+IPC}; my ($val) = @_; confess "value is required for set_ipc_pending" unless $val; - shmwrite($self->{+IPC_SHM_ID}, $val, 0, $self->{+IPC_SHM_SIZE}); + $self->{+IPC}->set_pending($val); } sub disable_ipc_polling { @@ -517,18 +457,6 @@ sub _ipc_wait { return 255; } -sub DESTROY { - my $self = shift; - - return if $self->{+PRELOAD}; - - return unless defined($self->{+_PID}) && $self->{+_PID} == $$; - return unless defined($self->{+_TID}) && $self->{+_TID} == get_tid(); - - shmctl($self->{+IPC_SHM_ID}, IPC::SysV::IPC_RMID(), 0) - if defined $self->{+IPC_SHM_ID}; -} - sub set_exit { my $self = shift; @@ -740,42 +668,20 @@ This is intended to be called in an C<END { ... }> block. This will look at test state and set $?. This will also call any end callbacks, and wait on child processes/threads. -=item $obj->ipc_enable_shm() - -Turn on SHM for IPC (if possible) - -=item $shm_id = $obj->ipc_shm_id() - -If SHM is enabled for IPC this will be the shm_id for it. - -=item $shm_size = $obj->ipc_shm_size() - -If SHM is enabled for IPC this will be the size of it. - -=item $shm_last_val = $obj->ipc_shm_last() - -If SHM is enabled for IPC this will return the last SHM value seen. - =item $obj->set_ipc_pending($val) -use the IPC SHM to tell other processes and threads there is a pending event. -C<$val> should be a unique value no other thread/process will generate. +Tell other processes and threads there is a pending event. C<$val> should be a +unique value no other thread/process will generate. -B<Note:> This will also make the current process see a pending event. It does -not set C<ipc_shm_last()>, this is important because doing so could hide a -previous change. +B<Note:> This will also make the current process see a pending event. =item $pending = $obj->get_ipc_pending() -This returns -1 if SHM is not enabled for IPC. - -This returns 0 if the SHM value matches the last known value, which means there -are no pending events. +This returns -1 if it is not possible to know. -This returns 1 if the SHM value has changed, which means there are probably -pending events. +This returns 0 if there are no pending events. -When 1 is returned this will set C<< $obj->ipc_shm_last() >>. +This returns 1 if there are pending events. =item $timeout = $obj->ipc_timeout; @@ -906,7 +812,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/API/Stack.pm b/Master/tlpkg/tlperl/lib/Test2/API/Stack.pm index 8007e1a6540..ffa4ed57f01 100755 --- a/Master/tlpkg/tlperl/lib/Test2/API/Stack.pm +++ b/Master/tlpkg/tlperl/lib/Test2/API/Stack.pm @@ -2,7 +2,7 @@ package Test2::API::Stack; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Test2::Hub(); @@ -210,7 +210,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event.pm b/Master/tlpkg/tlperl/lib/Test2/Event.pm index 307d49b75e5..598456c1dc3 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event.pm @@ -2,14 +2,14 @@ package Test2::Event; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Scalar::Util qw/blessed reftype/; use Carp qw/croak/; -use Test2::Util::HashBase qw/trace -amnesty uuid -hubs/; +use Test2::Util::HashBase qw/trace -amnesty uuid -_eid -hubs/; use Test2::Util::ExternalMeta qw/meta get_meta set_meta delete_meta/; -use Test2::Util qw(pkg_to_file); +use Test2::Util qw/pkg_to_file gen_uid/; use Test2::EventFacet::About(); use Test2::EventFacet::Amnesty(); @@ -120,6 +120,8 @@ sub add_amnesty { } } +sub eid { $_[0]->{+_EID} ||= gen_uid() } + sub common_facet_data { my $self = shift; @@ -130,6 +132,8 @@ sub common_facet_data { $out{about}->{uuid} = $uuid; } + $out{about}->{eid} = $self->{+_EID} || $self->eid; + if (my $trace = $self->trace) { $out{trace} = { %$trace }; } @@ -764,7 +768,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Bail.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Bail.pm index bfd99ee3aa4..4fa83c4899b 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Bail.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Bail.pm @@ -2,7 +2,7 @@ package Test2::Event::Bail; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } @@ -99,7 +99,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Diag.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Diag.pm index f5d3a6a49ea..86617f8afc7 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Diag.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Diag.pm @@ -2,7 +2,7 @@ package Test2::Event::Diag; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } @@ -89,7 +89,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Encoding.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Encoding.pm index cd4b28dcbed..12071637af5 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Encoding.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Encoding.pm @@ -2,7 +2,7 @@ package Test2::Event::Encoding; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Carp qw/croak/; @@ -87,7 +87,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Exception.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Exception.pm index 4ec36c57faa..66bbdb4fb40 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Exception.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Exception.pm @@ -2,7 +2,7 @@ package Test2::Event::Exception; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } @@ -103,7 +103,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Fail.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Fail.pm index f243918627f..2577cd93381 100644 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Fail.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Fail.pm @@ -2,7 +2,7 @@ package Test2::Event::Fail; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Test2::EventFacet::Info; @@ -108,7 +108,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Generic.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Generic.pm index b5bf934135c..02619d9a171 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Generic.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Generic.pm @@ -5,7 +5,7 @@ use warnings; use Carp qw/croak/; use Scalar::Util qw/reftype/; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } use Test2::Util::HashBase; @@ -270,7 +270,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Note.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Note.pm index 2fb1d0d6b9d..3dd09998445 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Note.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Note.pm @@ -2,7 +2,7 @@ package Test2::Event::Note; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } @@ -87,7 +87,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Ok.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Ok.pm index fb9a8db529b..7a603b40ca5 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Ok.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Ok.pm @@ -2,7 +2,7 @@ package Test2::Event::Ok; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } @@ -152,7 +152,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Pass.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Pass.pm index 78fe1b2f3f8..46726234304 100644 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Pass.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Pass.pm @@ -2,7 +2,7 @@ package Test2::Event::Pass; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Test2::EventFacet::Info; @@ -104,7 +104,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Plan.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Plan.pm index a75e14d687e..00b63970f7a 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Plan.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Plan.pm @@ -2,7 +2,7 @@ package Test2::Event::Plan; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } @@ -159,7 +159,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Skip.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Skip.pm index 7a2e660f517..07db32932aa 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Skip.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Skip.pm @@ -2,7 +2,7 @@ package Test2::Event::Skip; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) } @@ -117,7 +117,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Subtest.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Subtest.pm index 3feb0f10ca7..92e3f6dfa14 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Subtest.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Subtest.pm @@ -2,7 +2,7 @@ package Test2::Event::Subtest; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) } use Test2::Util::HashBase qw{subevents buffered subtest_id subtest_uuid}; @@ -150,7 +150,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/TAP/Version.pm b/Master/tlpkg/tlperl/lib/Test2/Event/TAP/Version.pm index 03f2621c0e5..cf7d773e1f4 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/TAP/Version.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/TAP/Version.pm @@ -2,7 +2,7 @@ package Test2::Event::TAP::Version; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Carp qw/croak/; @@ -91,7 +91,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/V2.pm b/Master/tlpkg/tlperl/lib/Test2/Event/V2.pm index 86a44d4c281..020cf2348e6 100644 --- a/Master/tlpkg/tlperl/lib/Test2/Event/V2.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/V2.pm @@ -2,7 +2,7 @@ package Test2::Event::V2; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Scalar::Util qw/reftype/; use Carp qw/croak/; @@ -228,7 +228,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Event/Waiting.pm b/Master/tlpkg/tlperl/lib/Test2/Event/Waiting.pm index 58b583fd5ea..4b790a6ff92 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Event/Waiting.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Event/Waiting.pm @@ -2,7 +2,7 @@ package Test2::Event::Waiting; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } @@ -66,7 +66,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet.pm index 619d369120c..d9fb03f4518 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet.pm @@ -2,7 +2,7 @@ package Test2::EventFacet; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Test2::Util::HashBase qw/-details/; use Carp qw/croak/; @@ -83,7 +83,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/About.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/About.pm index fe1d30eca05..fc36d2766a8 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/About.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/About.pm @@ -2,10 +2,10 @@ package Test2::EventFacet::About; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } -use Test2::Util::HashBase qw{ -package -no_display -uuid }; +use Test2::Util::HashBase qw{ -package -no_display -uuid -eid }; 1; @@ -51,6 +51,12 @@ True if the event should be skipped by formatters. Will be set to a uuid if uuid tagging was enabled. +=item $uuid = $about->{eid} + +=item $uuid = $about->eid() + +A unique (for the test job) identifier for the event. + =back =head1 SOURCE @@ -76,7 +82,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Amnesty.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Amnesty.pm index 9ef227f1669..ac72cf3890c 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Amnesty.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Amnesty.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Amnesty; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; sub is_list { 1 } @@ -81,7 +81,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Assert.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Assert.pm index 090860aa0bb..a11aef15691 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Assert.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Assert.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Assert; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } use Test2::Util::HashBase qw{ -pass -no_debug -number }; @@ -83,7 +83,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Control.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Control.pm index b52718df557..6ea0eaef404 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Control.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Control.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Control; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } use Test2::Util::HashBase qw{ -global -terminate -halt -has_callback -encoding }; @@ -90,7 +90,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Error.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Error.pm index 306dc310d88..4a21ef7e286 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Error.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Error.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Error; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; sub facet_key { 'errors' } sub is_list { 1 } @@ -83,7 +83,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Hub.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Hub.pm index 03c55530544..40b9d658026 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Hub.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Hub.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Hub; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; sub is_list { 1 } sub facet_key { 'hubs' } @@ -20,7 +20,7 @@ __END__ =head1 NAME -Test2::EventFacet::Hub +Test2::EventFacet::Hub - Facet for the hubs an event passes through. =head1 DESCRIPTION @@ -99,7 +99,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info.pm index 805cab1ba97..c382049480d 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info.pm @@ -2,12 +2,12 @@ package Test2::EventFacet::Info; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; sub is_list { 1 } BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } -use Test2::Util::HashBase qw{-tag -debug -important}; +use Test2::Util::HashBase qw{-tag -debug -important -table}; 1; @@ -42,6 +42,36 @@ Human readable string or data structure, this is the information to display. Formatters are free to render the structures however they please. This may contain a blessed object. +If the C<table> attribute (see below) is set then a renderer may choose to +display the table instead of the details. + +=item $structure = $info->{table} + +=item $structure = $info->table() + +If the data the C<info> facet needs to convey can be represented as a table +then the data may be placed in this attribute in a more raw form for better +display. The data must also be represented in the C<details> attribute for +renderers which do not support rendering tables directly. + +The table structure: + + my %table = { + header => [ 'column 1 header', 'column 2 header', ... ], # Optional + + rows => [ + ['row 1 column 1', 'row 1, column 2', ... ], + ['row 2 column 1', 'row 2, column 2', ... ], + ... + ], + + # Allow the renderer to hide empty columns when true, Optional + collapse => $BOOL, + + # List by name or number columns that should never be collapsed + no_collapse => \@LIST, + } + =item $short_string = $info->{tag} =item $short_string = $info->tag() @@ -92,7 +122,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info/Table.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info/Table.pm new file mode 100755 index 00000000000..64bd95539a5 --- /dev/null +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info/Table.pm @@ -0,0 +1,142 @@ +package Test2::EventFacet::Info::Table; +use strict; +use warnings; + +use Carp qw/confess/; + +use Test2::Util::HashBase qw{-header -rows -collapse -no_collapse -as_string}; + +sub init { + my $self = shift; + + confess "Table may not be empty" unless ref($self->{+ROWS}) eq 'ARRAY' && @{$self->{+ROWS}}; + + $self->{+AS_STRING} ||= '<TABLE NOT DISPLAYED>'; +} + +sub as_hash { my $out = +{%{$_[0]}}; delete $out->{as_string}; $out } + +sub info_args { + my $self = shift; + + my $hash = $self->as_hash; + my $desc = $self->as_string; + + return (table => $hash, details => $desc); +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Test2::EventFacet::Info::Table - Intermediary representation of a table. + +=head1 DESCRIPTION + +Intermediary representation of a table for use in specialized +L<Test::API::Context> methods which generate L<Test2::EventFacet::Info> facets. + +=head1 SYNOPSIS + + use Test2::EventFacet::Info::Table; + use Test2::API qw/context/; + + sub my_tool { + my $ctx = context(); + + ... + + $ctx->fail( + $name, + "failure diag message", + Test2::EventFacet::Info::Table->new( + # Required + rows => [['a', 'b'], ['c', 'd'], ...], + + # Strongly Recommended + as_string => "... string to print when table cannot be rendered ...", + + # Optional + header => ['col1', 'col2'], + collapse => $bool, + no_collapse => ['col1', ...], + ), + ); + + ... + + $ctx->release; + } + + my_tool(); + +=head1 ATTRIBUTES + +=over 4 + +=item $header_aref = $t->header() + +=item $rows_aref = $t->rows() + +=item $bool = $t->collapse() + +=item $aref = $t->no_collapse() + +The above are all directly tied to the table hashref structure described in +L<Test2::EventFacet::Info>. + +=item $str = $t->as_string() + +This returns the string form of the table if it was set, otherwise it returns +the string C<< "<TABLE NOT DISPLAYED>" >>. + +=item $href = $t->as_hash() + +This returns the data structure used for tables by L<Test2::EventFacet::Info>. + +=item %args = $t->info_args() + +This returns the arguments that should be used to construct the proper +L<Test2::EventFacet::Info> structure. + + return (table => $t->as_hash(), details => $t->as_string()); + +=back + +=head1 SOURCE + +The source code repository for Test2 can be found at +F<http://github.com/Test-More/test-more/>. + +=head1 MAINTAINERS + +=over 4 + +=item Chad Granum E<lt>exodist@cpan.orgE<gt> + +=back + +=head1 AUTHORS + +=over 4 + +=item Chad Granum E<lt>exodist@cpan.orgE<gt> + +=back + +=head1 COPYRIGHT + +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +See F<http://dev.perl.org/licenses/> + +=cut diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Meta.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Meta.pm index 31a4e0c1f8d..dc369ff2b1c 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Meta.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Meta.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Meta; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } use vars qw/$AUTOLOAD/; @@ -94,7 +94,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Parent.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Parent.pm index baf66e99a67..d36fd92b27c 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Parent.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Parent.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Parent; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Carp qw/confess/; @@ -26,7 +26,7 @@ __END__ =head1 NAME -Test2::EventFacet::Parent - Base class for all event facets. +Test2::EventFacet::Parent - Facet for events contains other events =head1 DESCRIPTION @@ -88,7 +88,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Plan.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Plan.pm index 3789bcb5c91..2f14f7d69e0 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Plan.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Plan.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Plan; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } use Test2::Util::HashBase qw{ -count -skip -none }; @@ -84,7 +84,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Render.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Render.pm index 709a9f61823..07c454365a2 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Render.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Render.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Render; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; sub is_list { 1 } @@ -53,7 +53,7 @@ Tag that should prefix/identify the main text. Optional, if the display text was generated from another facet this should state what facet it was. -=item $mode = $render->[#]->mode{} +=item $mode = $render->[#]->{mode} =item $mode = $render->[#]->mode() @@ -96,7 +96,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Trace.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Trace.pm index 280258c6aa5..34a3fce7ad0 100644 --- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Trace.pm +++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Trace.pm @@ -2,11 +2,11 @@ package Test2::EventFacet::Trace; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } -use Test2::Util qw/get_tid pkg_to_file/; +use Test2::Util qw/get_tid pkg_to_file gen_uid/; use Carp qw/confess/; use Test2::Util::HashBase qw{^frame ^pid ^tid ^cid -hid -nested details -buffered -uuid -huuid}; @@ -24,8 +24,10 @@ sub init { $_[0]->{+DETAILS} = delete $_[0]->{detail} if $_[0]->{detail}; - $_[0]->{+PID} = $$ unless defined $_[0]->{+PID}; - $_[0]->{+TID} = get_tid() unless defined $_[0]->{+TID}; + unless (defined($_[0]->{+PID}) || defined($_[0]->{+TID}) || defined($_[0]->{+CID})) { + $_[0]->{+PID} = $$ unless defined $_[0]->{+PID}; + $_[0]->{+TID} = get_tid() unless defined $_[0]->{+TID}; + } } sub snapshot { @@ -239,11 +241,8 @@ Get the debug-info subroutine name. =item $sig = trace->signature Get a signature string that identifies this trace. This is used to check if -multiple events are related. - -If UUID's are enabled then a uuid is returned. Otherwise the signature includes -pid, tid, file, line number, and the cid which is C<'C\d+'> for traces created -by a context, or C<'T\d+'> for traces created by C<new()>. +multiple events are related. The signature includes pid, tid, file, line +number, and the cid. =back @@ -270,7 +269,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Formatter.pm b/Master/tlpkg/tlperl/lib/Test2/Formatter.pm index 0f179e59bcb..c4515d8c41c 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Formatter.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Formatter.pm @@ -2,7 +2,7 @@ package Test2::Formatter; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; my %ADDED; @@ -19,6 +19,8 @@ sub new_root { return $class->new(@_); } +sub supports_tables { 0 } + sub hide_buffered { 1 } sub terminate { } @@ -61,6 +63,8 @@ A formatter is any package or object with a C<write($event, $num)> method. sub finalize { } + sub supports_tables { return $BOOL } + sub new_root { my $class = shift; ... @@ -92,11 +96,14 @@ The C<finalize> method is always the last thing called on the formatter, I<< except when C<terminate> is called for a Bail event >>. It is passed the following arguments: -The C<new_root> method is called when C<Test2::API::Stack> Initializes the root -hub for the first time. Most formatters will simply have this call C<< -$class->new >>, which is the default behavior. Some formatters however may want -to take extra action during construction of the root formatter, this is where -they can do that. +The C<supports_tables> method should be true if the formatter supports directly +rendering table data from the C<info> facets. This is a newer feature and many +older formatters may not support it. When not supported the formatter falls +back to rendering C<detail> instead of the C<table> data. + +The C<new_root> method is used when constructing a root formatter. The default +is to just delegate to the regular C<new()> method, most formatters can ignore +this. =over 4 @@ -112,6 +119,12 @@ they can do that. =back +The C<new_root> method is called when C<Test2::API::Stack> Initializes the root +hub for the first time. Most formatters will simply have this call C<< +$class->new >>, which is the default behavior. Some formatters however may want +to take extra action during construction of the root formatter, this is where +they can do that. + =head1 SOURCE The source code repository for Test2 can be found at @@ -135,7 +148,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Formatter/TAP.pm b/Master/tlpkg/tlperl/lib/Test2/Formatter/TAP.pm index 2082de7b8f9..25961bf7370 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Formatter/TAP.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Formatter/TAP.pm @@ -2,7 +2,7 @@ package Test2::Formatter::TAP; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Test2::Util qw/clone_io/; @@ -16,6 +16,18 @@ sub OUT_ERR() { 1 } BEGIN { require Test2::Formatter; our @ISA = qw(Test2::Formatter) } +# Not constants because this is a method, and can be overriden +BEGIN { + local $SIG{__DIE__} = 'DEFAULT'; + local $@; + if (($INC{'Term/Table.pm'} && $INC{'Term/Table/Util.pm'}) || eval { require Term::Table; require Term::Table::Util; 1 }) { + *supports_tables = sub { 1 }; + } + else { + *supports_tables = sub { 0 }; + } +} + sub _autoflush { my($fh) = pop; my $old_fh = select $fh; @@ -104,10 +116,9 @@ sub write { print $io "\n" if $ENV{HARNESS_ACTIVE} - && !$ENV{HARNESS_IS_VERBOSE} && $hid == OUT_ERR && $self->{+_LAST_FH} != $io - && $msg =~ m/^#\s*Failed test /; + && $msg =~ m/^#\s*Failed( \(TODO\))? test /; $msg =~ s/^/$indent/mg if $nesting; print $io $msg; @@ -363,11 +374,23 @@ sub info_tap { return map { my $details = $_->{details}; + my $table = $_->{table}; my $IO = $_->{debug} && !($f->{amnesty} && @{$f->{amnesty}}) ? OUT_ERR : OUT_STD; my $msg; - if (ref($details)) { + if ($table && $self->supports_tables) { + $msg = join "\n" => map { "# $_" } Term::Table->new( + header => $table->{header}, + rows => $table->{rows}, + collapse => $table->{collapse}, + no_collapse => $table->{no_collapse}, + sanitize => 1, + mark_tail => 1, + max_width => $self->calc_table_size($f), + )->render(); + } + elsif (ref($details)) { require Data::Dumper; my $dumper = Data::Dumper->new([$details])->Indent(2)->Terse(1)->Pad('# ')->Useqq(1)->Sortkeys(1); chomp($msg = $dumper->Dump); @@ -394,6 +417,20 @@ sub summary_tap { return [OUT_STD, "$summary\n"]; } +sub calc_table_size { + my $self = shift; + my ($f) = @_; + + my $term = Term::Table::Util::term_size(); + my $nesting = 2 + (($f->{trace}->{nested} || 0) * 4); # 4 spaces per level, also '# ' prefix + my $total = $term - $nesting; + + # Sane minimum width, any smaller and we are asking for pain + return 50 if $total < 50; + + return $total; +} + 1; __END__ @@ -477,7 +514,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Hub.pm b/Master/tlpkg/tlperl/lib/Test2/Hub.pm index 6be1c8d1f52..a5706e56771 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Hub.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Hub.pm @@ -2,11 +2,11 @@ package Test2::Hub; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Carp qw/carp croak confess/; -use Test2::Util qw/get_tid ipc_separator/; +use Test2::Util qw/get_tid gen_uid/; use Scalar::Util qw/weaken/; use List::Util qw/first/; @@ -38,13 +38,12 @@ use Test2::Util::HashBase qw{ my $UUID_VIA; -my $ID_POSTFIX = 1; sub init { my $self = shift; $self->{+PID} = $$; $self->{+TID} = get_tid(); - $self->{+HID} = join ipc_separator, $self->{+PID}, $self->{+TID}, $ID_POSTFIX++; + $self->{+HID} = gen_uid(); $UUID_VIA ||= Test2::API::_add_uuid_via_ref(); $self->{+UUID} = ${$UUID_VIA}->('hub') if $$UUID_VIA; @@ -75,7 +74,7 @@ sub _tb_reset { $self->{+PID} = $$; $self->{+TID} = get_tid(); - $self->{+HID} = join ipc_separator, $self->{+PID}, $self->{+TID}, $ID_POSTFIX++; + $self->{+HID} = gen_uid(); if (my $ipc = $self->{+IPC}) { $ipc->add_hub($self->{+HID}); @@ -278,6 +277,8 @@ sub send { my $self = shift; my ($e) = @_; + $e->eid; + $e->add_hub( { details => ref($self), @@ -898,7 +899,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Hub/Interceptor.pm b/Master/tlpkg/tlperl/lib/Test2/Hub/Interceptor.pm index b7af4cf427d..cd459ada066 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Hub/Interceptor.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Hub/Interceptor.pm @@ -2,7 +2,7 @@ package Test2::Hub::Interceptor; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Test2::Hub::Interceptor::Terminator(); @@ -78,7 +78,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Hub/Interceptor/Terminator.pm b/Master/tlpkg/tlperl/lib/Test2/Hub/Interceptor/Terminator.pm index 76ad94a94cc..6f44b08bcdd 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Hub/Interceptor/Terminator.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Hub/Interceptor/Terminator.pm @@ -2,7 +2,7 @@ package Test2::Hub::Interceptor::Terminator; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; 1; @@ -41,7 +41,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Hub/Subtest.pm b/Master/tlpkg/tlperl/lib/Test2/Hub/Subtest.pm index c36a19e1ad6..52d5b4e0fa4 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Hub/Subtest.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Hub/Subtest.pm @@ -2,7 +2,7 @@ package Test2::Hub::Subtest; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) } use Test2::Util::HashBase qw/nested exit_code manual_skip_all/; @@ -126,7 +126,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/IPC.pm b/Master/tlpkg/tlperl/lib/Test2/IPC.pm index cfee4618023..b2a503bfa74 100755 --- a/Master/tlpkg/tlperl/lib/Test2/IPC.pm +++ b/Master/tlpkg/tlperl/lib/Test2/IPC.pm @@ -2,12 +2,13 @@ package Test2::IPC; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Test2::API::Instance; use Test2::Util qw/get_tid/; use Test2::API qw{ + test2_in_preload test2_init_done test2_ipc test2_has_ipc @@ -18,6 +19,16 @@ use Test2::API qw{ context }; +# Make sure stuff is finalized before anyone tried to fork or start a new thread. +{ + # Avoid warnings if things are loaded at run-time + no warnings 'void'; + INIT { + use warnings 'void'; + context()->release() unless test2_in_preload(); + } +} + use Carp qw/confess/; our @EXPORT_OK = qw/cull/; @@ -139,7 +150,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/IPC/Driver.pm b/Master/tlpkg/tlperl/lib/Test2/IPC/Driver.pm index a4d72557327..dbcb7004b3f 100755 --- a/Master/tlpkg/tlperl/lib/Test2/IPC/Driver.pm +++ b/Master/tlpkg/tlperl/lib/Test2/IPC/Driver.pm @@ -2,7 +2,7 @@ package Test2::IPC::Driver; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Carp qw/confess/; @@ -18,7 +18,8 @@ sub import { test2_ipc_add_driver($class); } -sub use_shm { 0 } +sub pending { -1 } +sub set_pending { -1 } for my $meth (qw/send cull add_hub drop_hub waiting is_viable/) { no strict 'refs'; @@ -89,11 +90,6 @@ error. This is the same as C<< $ipc->abort($msg) >> except that it uses C<Carp::longmess> to add a stack trace to the message. -=item $false = $self->use_shm - -The base class always returns false for this method. You may override it if you -wish to use the SHM made available in L<Test2::API>/L<Test2::API::Instance>. - =back =head1 LOADING DRIVERS @@ -141,8 +137,7 @@ load it too late for it to be effective. ... # Send the event to the proper hub. - # If you are using the SHM you should notify other procs/threads that - # there is a pending event. + # This may notify other procs/threads that there is a pending event. Test2::API::test2_ipc_set_pending($uniq_val); } @@ -213,8 +208,7 @@ process+thread. ... # Send the event to the proper hub. - # If you are using the SHM you should notify other procs/threads that - # there is a pending event. + # This may notify other procs/threads that there is a pending event. Test2::API::test2_ipc_set_pending($uniq_val); } @@ -258,15 +252,6 @@ This is a hook called by C<< Test2::IPC::Driver->abort() >>. This is your chance to cleanup when an abort happens. You cannot prevent the abort, but you can gracefully except it. -=item $bool = $ipc->use_shm() - -True if you want to make use of the L<Test2::API>/L<Test2::API::Instance> SHM. - -=item $bites = $ipc->shm_size() - -Use this to customize the size of the SHM space. There are no guarantees about -what the size will be if you do not implement this. - =back =head1 SOURCE @@ -292,7 +277,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/IPC/Driver/Files.pm b/Master/tlpkg/tlperl/lib/Test2/IPC/Driver/Files.pm index 1d37a833264..f6d7ff1b2c0 100755 --- a/Master/tlpkg/tlperl/lib/Test2/IPC/Driver/Files.pm +++ b/Master/tlpkg/tlperl/lib/Test2/IPC/Driver/Files.pm @@ -2,8 +2,7 @@ package Test2::IPC::Driver::Files; use strict; use warnings; -our $VERSION = '1.302133'; - +our $VERSION = '1.302162'; BEGIN { require Test2::IPC::Driver; our @ISA = qw(Test2::IPC::Driver) } @@ -18,9 +17,6 @@ use POSIX(); use Test2::Util qw/try get_tid pkg_to_file IS_WIN32 ipc_separator do_rename do_unlink try_sig_mask/; use Test2::API qw/test2_ipc_set_pending/; -sub use_shm { 1 } -sub shm_size() { 64 } - sub is_viable { 1 } sub init { @@ -168,7 +164,7 @@ do so if Test::Builder is loaded for legacy reasons. if ($ok) { $self->abort("Could not rename file '$file' -> '$ready': $ren_err") unless $ren_ok; - test2_ipc_set_pending(substr($file, -(shm_size))); + test2_ipc_set_pending($file); } else { my $src_file = __FILE__; @@ -270,7 +266,7 @@ sub parse_event_filename { my $ready = substr($file, -6, 6) eq '.ready' || 0 and substr($file, -6, 6, ""); my @parts = split ipc_separator, $file; - my ($global, $hid) = $parts[0] eq 'GLOBAL' ? (1, shift @parts) : (0, join ipc_separator, splice(@parts, 0, 3)); + my ($global, $hid) = $parts[0] eq 'GLOBAL' ? (1, shift @parts) : (0, join ipc_separator, splice(@parts, 0, 4)); my ($pid, $tid, $eid) = splice(@parts, 0, 3); my $type = join '::' => @parts; @@ -473,7 +469,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Tools/Tiny.pm b/Master/tlpkg/tlperl/lib/Test2/Tools/Tiny.pm index 93c3df03e8f..4da76a79ba4 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Tools/Tiny.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Tools/Tiny.pm @@ -16,7 +16,7 @@ use Test2::API qw/context run_subtest test2_stack/; use Test2::Hub::Interceptor(); use Test2::Hub::Interceptor::Terminator(); -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; BEGIN { require Exporter; our @ISA = qw(Exporter) } our @EXPORT = qw{ @@ -425,7 +425,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Transition.pod b/Master/tlpkg/tlperl/lib/Test2/Transition.pod index 12c46ee569f..de6442ce610 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Transition.pod +++ b/Master/tlpkg/tlperl/lib/Test2/Transition.pod @@ -502,7 +502,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Util.pm b/Master/tlpkg/tlperl/lib/Test2/Util.pm index 6de008b683d..c4a865e9b15 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Util.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Util.pm @@ -2,7 +2,7 @@ package Test2::Util; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use POSIX(); use Config qw/%Config/; @@ -29,6 +29,8 @@ our @EXPORT_OK = qw{ ipc_separator + gen_uid + do_rename do_unlink try_sig_mask @@ -157,6 +159,9 @@ sub pkg_to_file { sub ipc_separator() { "~" } +my $UID = 1; +sub gen_uid() { join ipc_separator() => ($$, get_tid(), time, $UID++) } + sub _check_for_sig_sys { my $sig_list = shift; return $sig_list =~ m/\bSYS\b/; @@ -178,7 +183,7 @@ my %PERLIO_SKIP = ( sub clone_io { my ($fh) = @_; - my $fileno = fileno($fh); + my $fileno = eval { fileno($fh) }; return $fh if !defined($fileno) || !length($fileno) || $fileno < 0; @@ -329,6 +334,30 @@ otherwise it returns 0. Convert a package name to a filename. +=item $string = ipc_separator() + +Get the IPC separator. Currently this is always the string C<'~'>. + +=item $string = gen_uid() + +Generate a unique id (NOT A UUID). This will typically be the process id, the +thread id, the time, and an incrementing integer all joined with the +C<ipc_separator()>. + +These ID's are unique enough for most purposes. For identical ids to be +generated you must have 2 processes with the same PID generate IDs at the same +time with the same current state of the incrementing integer. This is a +perfectly reasonable thing to expect to happen across multiple machines, but is +quite unlikely to happen on one machine. + +This can fail to be unique if a process generates an id, calls exec, and does +it again after the exec and it all happens in less than a second. It can also +happen if the systems process id's cycle in less than a second allowing 2 +different programs that use this generator to run with the same PID in less +than a second. Both these cases are sufficiently unlikely. If you need +universally unique ids, or ids that are unique in these conditions, look at +L<Data::UUID>. + =item ($ok, $err) = do_rename($old_name, $new_name) Rename a file, this wraps C<rename()> in a way that makes it more reliable @@ -409,7 +438,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Util/ExternalMeta.pm b/Master/tlpkg/tlperl/lib/Test2/Util/ExternalMeta.pm index f03422c61af..dbd819feeaf 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Util/ExternalMeta.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Util/ExternalMeta.pm @@ -2,7 +2,7 @@ package Test2::Util::ExternalMeta; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Carp qw/croak/; @@ -172,7 +172,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Util/Facets2Legacy.pm b/Master/tlpkg/tlperl/lib/Test2/Util/Facets2Legacy.pm index db74510a4d0..812282d157a 100644 --- a/Master/tlpkg/tlperl/lib/Test2/Util/Facets2Legacy.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Util/Facets2Legacy.pm @@ -2,7 +2,7 @@ package Test2::Util::Facets2Legacy; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; use Carp qw/croak confess/; use Scalar::Util qw/blessed/; @@ -289,7 +289,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Util/HashBase.pm b/Master/tlpkg/tlperl/lib/Test2/Util/HashBase.pm index 8e73af425e2..c34db5fc565 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Util/HashBase.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Util/HashBase.pm @@ -2,7 +2,7 @@ package Test2::Util::HashBase; use strict; use warnings; -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; ################################################################# # # @@ -425,7 +425,7 @@ F<http://github.com/Test-More/HashBase/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/Master/tlpkg/tlperl/lib/Test2/Util/Trace.pm b/Master/tlpkg/tlperl/lib/Test2/Util/Trace.pm index 1e5351f6db5..28124f3406c 100755 --- a/Master/tlpkg/tlperl/lib/Test2/Util/Trace.pm +++ b/Master/tlpkg/tlperl/lib/Test2/Util/Trace.pm @@ -2,7 +2,7 @@ package Test2::Util::Trace; require Test2::EventFacet::Trace; @ISA = ('Test2::EventFacet::Trace'); -our $VERSION = '1.302133'; +our $VERSION = '1.302162'; 1; @@ -44,7 +44,7 @@ F<http://github.com/Test-More/test-more/>. =head1 COPYRIGHT -Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. +Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |