logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Test::SharedFork - fork test

Author

       Tokuhiro Matsuno <tokuhirom  slkjfd gmail.com>

       yappo

Description

       Test::SharedFork is utility module for Test::Builder.

       This module makes fork(2) safety in your test case.

       This module merges test count with parent process & child process.

License

       This library is free software; you can redistribute it and/or modify it under the same terms as Perl
       itself.

perl v5.36.0                                       2022-10-13                              Test::SharedFork(3pm)

Limitations

       This version of the Test::SharedFork does not support ithreads, because threads::shared conflicts with
       Storable.

Name

       Test::SharedFork - fork test

See Also

       Test::TCP, Test::Fork, Test::MultiFork

Synopsis

           use Test::More tests => 200;
           use Test::SharedFork;

           my $pid = fork();
           if ($pid == 0) {
               # child
               ok 1, "child $_" for 1..100;
           } elsif ($pid) {
               # parent
               ok 1, "parent $_" for 1..100;
               waitpid($pid, 0);
           } else {
               die $!;
           }

Thanks To

       kazuhooku

       konbuizm

See Also