Git-Libgit2
view release on metacpan or search on metacpan
t/torture-init.t view on Meta::CPAN
# Pin libgit2 away from the user's gitconfig â exact bug Git::Raw shipped.
local $ENV{GIT_CONFIG_GLOBAL} = '/dev/null';
local $ENV{GIT_CONFIG_SYSTEM} = '/dev/null';
init_lib();
my ( $maj, $min, $rev ) = version();
ok( defined $maj && $maj >= 1, "libgit2 version $maj.$min.$rev (major >= 1)" );
# Hammer init/shutdown â should not leak or crash.
my $iterations = 5000;
for my $i ( 1 .. $iterations ) {
my $rc = init_lib();
# Refcount starts at 1 on first init and increments each subsequent pass.
ok( $rc >= 1, "init_lib pass $i returned refcount $rc (>= 1)" );
shutdown_lib();
}
# Final state should be back to zero (or as low as we can given other tests ran first).
my $final_rc = init_lib();
ok( $final_rc >= 1, "init after loop returned refcount $final_rc (>= 1)" );
shutdown_lib();
( run in 0.715 second using v1.01-cache-2.11-cpan-4ab04211f4c )