Developer-Dashboard
view release on metacpan or search on metacpan
t/15-release-metadata.t view on Meta::CPAN
like( $dist, qr/^prune_directory = \^\\\.developer-dashboard\$$/m,
'dist.ini prunes the local runtime tree before gathering files for a distribution build' );
like( $dist, qr/^license = MIT$/m, 'dist.ini declares the canonical MIT distribution license' );
{
my $fixture = tempdir( CLEANUP => 1 );
make_path( File::Spec->catdir( $fixture, 'lib', 'Developer' ) );
copy( _repo_path('Makefile.PL'), File::Spec->catfile( $fixture, 'Makefile.PL' ) )
or die "Unable to copy Makefile.PL into $fixture: $!";
copy(
_repo_path( 'lib', 'Developer', 'Dashboard.pm' ),
File::Spec->catfile( $fixture, 'lib', 'Developer', 'Dashboard.pm' ),
) or die "Unable to copy Developer::Dashboard into $fixture: $!";
make_path( File::Spec->catdir( $fixture, 'lib', 'Developer', 'Dashboard' ) );
copy(
_repo_path( 'lib', 'Developer', 'Dashboard', 'Version.pm' ),
File::Spec->catfile( $fixture, 'lib', 'Developer', 'Dashboard', 'Version.pm' ),
) or die "Unable to copy Developer::Dashboard::Version into $fixture: $!";
copy( _repo_path('HtmlEscape.xs'), File::Spec->catfile( $fixture, 'HtmlEscape.xs' ) )
or die "Unable to copy HtmlEscape.xs into $fixture: $!";
make_path( File::Spec->catdir( $fixture, 'share' ) );
my $fake_bin = File::Spec->catdir( $fixture, 'fake-bin' );
make_path($fake_bin);
my $fake_pkg_config = File::Spec->catfile( $fake_bin, 'pkg-config' );
open my $pkg_config_handle, '>', $fake_pkg_config
or die "Unable to write pkg-config fixture '$fake_pkg_config': $!";
print {$pkg_config_handle} <<'PKG_CONFIG_FIXTURE';
#!/usr/bin/env perl
use strict;
use warnings;
exit ( ( $ENV{DD_TEST_PKG_CONFIG_STATUS} // 1 ) == 0 ? 0 : 1 );
PKG_CONFIG_FIXTURE
close $pkg_config_handle
or die "Unable to close pkg-config fixture '$fake_pkg_config': $!";
chmod 0755, $fake_pkg_config
or die "Unable to make pkg-config fixture executable '$fake_pkg_config': $!";
my ( $configure_stdout, $configure_stderr, $configure_exit ) = capture {
my $original = Cwd::cwd();
chdir $fixture or die "Unable to chdir to $fixture: $!";
local $ENV{HOME} = $fixture;
local $ENV{PATH} = join $Config{path_sep}, $fake_bin, ( $ENV{PATH} // q{} );
local $ENV{DD_TEST_PKG_CONFIG_STATUS} = 1;
system( $^X, 'Makefile.PL' );
my $exit = $? >> 8;
chdir $original or die "Unable to return to $original: $!";
return $exit;
};
is( $configure_exit, 0, 'Makefile.PL generates metadata in a temporary source fixture' )
or diag("stdout:\n$configure_stdout\nstderr:\n$configure_stderr");
unlike( $configure_stderr, qr/Setting VERSION via file .* failed/,
'MakeMaker obtains the version from the lightweight version module without warnings' );
my $mymeta_path = File::Spec->catfile( $fixture, 'MYMETA.json' );
ok( -f $mymeta_path, 'Makefile.PL writes MYMETA.json' );
my $generated_meta = JSON::XS->new->decode( _slurp($mymeta_path) );
is_deeply( $generated_meta->{license}, ['mit'], 'generated MakeMaker metadata declares only the canonical MIT license' );
my $generated_makefile = _slurp( File::Spec->catfile( $fixture, 'Makefile' ) );
if ( $^O eq 'linux' ) {
unlike( $generated_makefile, qr/^build-system-menu-helper:/m,
'Linux Makefile omits the native helper build when pkg-config reports missing GTK/Ayatana modules' );
like( $configure_stdout, qr/System Menu helper.*not built.*pkg-config/is,
'Linux Makefile.PL visibly explains why the optional helper was not built' );
}
else {
pass('Linux-only optional GTK helper assertions are not applicable on this platform');
pass('Linux-only optional GTK helper notice is not applicable on this platform');
}
if ( $^O eq 'linux' ) {
my ( $available_stdout, $available_stderr, $available_exit ) = capture {
my $original = Cwd::cwd();
chdir $fixture or die "Unable to chdir to $fixture: $!";
local $ENV{HOME} = $fixture;
local $ENV{PATH} = join $Config{path_sep}, $fake_bin, ( $ENV{PATH} // q{} );
local $ENV{DD_TEST_PKG_CONFIG_STATUS} = 0;
local $ENV{DD_REQUIRE_SYSTEM_MENU_HELPER} = 1;
system( $^X, 'Makefile.PL' );
my $exit = $? >> 8;
chdir $original or die "Unable to return to $original: $!";
return $exit;
};
is( $available_exit, 0,
'Linux configure succeeds when GTK/Ayatana modules are available and the helper is required' )
or diag("stdout:\n$available_stdout\nstderr:\n$available_stderr");
$generated_makefile = _slurp( File::Spec->catfile( $fixture, 'Makefile' ) );
like( $generated_makefile, qr/^build-system-menu-helper:/m,
'Linux Makefile retains the native helper target when both pkg-config modules exist' );
my ( $required_stdout, $required_stderr, $required_exit ) = capture {
my $original = Cwd::cwd();
chdir $fixture or die "Unable to chdir to $fixture: $!";
local $ENV{HOME} = $fixture;
local $ENV{PATH} = join $Config{path_sep}, $fake_bin, ( $ENV{PATH} // q{} );
local $ENV{DD_TEST_PKG_CONFIG_STATUS} = 1;
local $ENV{DD_REQUIRE_SYSTEM_MENU_HELPER} = 1;
system( $^X, 'Makefile.PL' );
my $exit = $? >> 8;
chdir $original or die "Unable to return to $original: $!";
return $exit;
};
isnt( $required_exit, 0,
'Linux configure fails when the required native helper dependencies are missing' );
like( "$required_stdout\n$required_stderr",
qr/Required Linux System Menu helper cannot be built.*gtk/i,
'required-helper failure names the missing native dependency setup' );
}
}
like( $makefile, qr/VERSION_FROM\s*=>\s*'lib\/Developer\/Dashboard\/Version\.pm'/,
'Makefile.PL reads version metadata from the lightweight version module' );
like( $dist, qr/^skip = \^Module::CPANTS::Analyse\$$/m, 'dist.ini skips release-only Module::CPANTS::Analyse from generated install-time prereqs' );
like( $dist, qr/^skip = \^Module::CPANTS::Kwalitee\$$/m, 'dist.ini skips release-only Module::CPANTS::Kwalitee from generated install-time prereqs' );
like(
$dist,
qr/^skip = \^\(\?:Inline\|MCE::Map\|SPVM\|SPVM::Digest::SHA\)\$$/m,
'dist.ini keeps optional Problem 48 benchmark engines out of required install prerequisites',
);
like( $dist, qr/^exclude_filename = LICENSE$/m, 'dist.ini excludes the tracked LICENSE so dzil does not build duplicate LICENSE files' );
like( $dist, qr/^exclude_match = \^cover_db\(\?:\[-_\]\[\^\/\]\+\)\?\(\?:\/\|\$\)$/m, 'dist.ini excludes root coverage databases and their contents from release tarballs' );
like( $dist, qr/^package = env$/m, 'dist.ini prevents the env helper package from being advertised as a standalone module' );
like( $dist, qr/^package = Developer::Dashboard::Handle::Proxy$/m, 'dist.ini prevents the nested handle proxy package from being advertised as a standalone module' );
like( $dist, qr/^exclude_match = \^node_modules\/$/m, 'dist.ini excludes node_modules so JavaScript dependency trees do not leak into release tarballs' );
like( $dist, qr/^exclude_match = \^test_by_michael\/$/m, 'dist.ini excludes test_by_michael so private scratch fixtures do not leak into release tarballs' );
like( $dist, qr/^exclude_match = \^updates\/$/m, 'dist.ini excludes checkout-only update scripts so user-defined update remains the installed runtime contract' );
like( $dist, qr/^exclude_match = \^dogfood-output\/$/m, 'dist.ini excludes dogfood-output so browser QA evidence and screenshots do not leak into release tarballs' );
like( $dist, qr/^exclude_match = \^\\\.worktrees\/$/m, 'dist.ini excludes .worktrees so ticket worktrees do not leak into release tarballs' );
like( $dist, qr/^exclude_match = \^\\\.developer-dashboard\/$/m, 'dist.ini excludes .developer-dashboard so operator runtime state does not leak into release tarballs' );
like( $dist, qr/^exclude_match = \^_developer-dashboard\/$/m, 'dist.ini excludes _developer-dashboard so a non-dot rename of the runtime root does not leak into release tarballs (DD-432 class)' );
unlike( $dist, qr/^exclude_match = \^integration\/$/m, 'dist.ini keeps integration assets in the release tarball so install-time integration tests can read them' );
unlike( $dist, qr/^exclude_match = \\.md\$$/m, 'dist.ini keeps Markdown documentation in the release tarball so release tests can read the shipped docs' );
like( $dist, qr/^\[ShareDir\]$/m, 'dist.ini installs the seeded share assets into the built distribution' );
unlike( $dist, qr/^Test::Pod = 0$/m, 'dist.ini does not ship Test::Pod as a distribution test prerequisite' );
}
else {
like( $meta, qr/"version"\s*:\s*"\Q$version\E"/, 'META.json version matches the module version in the built distribution' );
}
like( $changes, qr/^\Q$version\E\s+\d{4}-\d{2}-\d{2}$/m, 'Changes top entry matches the bumped version' );
ok( $plain_readme ne '', 'plain README is tracked for release kwalitee compatibility' );
like( $plain_readme, qr/Developer Dashboard/, 'plain README identifies the distribution clearly' );
ok( $security_pod ne '', 'SECURITY.pod is tracked so the release tarball ships a security policy document' );
ok( $contributing_pod ne '', 'CONTRIBUTING.pod is tracked so the release tarball ships contribution guidance' );
like( $security_pod, qr/security\@manif3station\.local/i, 'SECURITY.pod includes a concrete private security contact address' );
for my $path (
qw(
bin/pjq
bin/pyq
bin/ptomq
bin/pjp
bin/jq
bin/yq
bin/tomq
bin/propq
bin/iniq
bin/csvq
bin/xmlq
bin/of
bin/open-file
)
)
{
ok( !-e _repo_path($path), "$path is no longer shipped as a public executable" );
}
ok( -f _repo_path( 'bin', 'd2' ), 'bin/d2 is shipped as the real short d2 entrypoint' );
t/15-release-metadata.t view on Meta::CPAN
}
my %seen;
my @matches;
FILE:
for my $path ( sort grep { !$seen{$_}++ && $tracked_repo_paths{ _tracked_key($_) } } @files ) {
next if _same_path( $path, $self );
next if $path =~ m{/t/fixtures/};
my $content = _slurp($path);
my @lines = split /\n/, $content, -1;
for my $index ( 0 .. $#lines ) {
next if $lines[$index] !~ $regex;
push @matches, sprintf '%s:%d:%s', $path, $index + 1, $lines[$index];
next FILE;
}
}
return join "\n", @matches;
}
sub _command_on_path {
my ($name) = @_;
return 0 if !defined $name || $name eq '';
# File::Spec->path splits PATH on the platform's own separator. Splitting
# on a colon can never find a command on Windows, where PATH is joined
# with semicolons, so the README sync checks skipped there even with
# pod2markdown installed. On Windows the name is also tried with each
# PATHEXT extension, because a command there is a file such as
# pod2markdown.bat and Perl's -x goes by that extension.
my $is_windows = $^O eq 'MSWin32';
my @extensions = $is_windows
? grep { length } split /;/, ( $ENV{PATHEXT} || '.COM;.EXE;.BAT;.CMD' )
: (q{});
for my $dir ( File::Spec->path ) {
next if !defined $dir || $dir eq '';
for my $extension (@extensions) {
my $candidate = File::Spec->catfile( $dir, $name . $extension );
next if !-f $candidate;
return 1 if $is_windows || -x $candidate;
}
}
return 0;
}
__END__
=head1 NAME
15-release-metadata.t - verify release metadata and repository documentation records
=head1 DESCRIPTION
This test keeps the shipped version metadata, public executable list, core
documentation, and numbered problem-report index aligned for the private-helper
and isolated-skill packaging model. It also pins the declared runtime dependency floors, so a
distribution carrying a published advisory cannot be permitted by the manifests
even where no current advisory database is installed to notice.
It configures isolated MakeMaker fixtures with mocked pkg-config results to
verify optional Linux System Menu helper handling, including the strict mode
used by CI.
It also resolves every C<t/NN-name.t> path cited in the README, the markdown under
C<doc/> and C<docs/>, and the POD of every Perl file, so a renamed test file
cannot leave a stale citation behind in the documentation. The collector cron
assertions distinguish a once-hourly expression from a wildcard-minute,
per-minute expression in the plain reference, canonical POD, and generated
README.
=for comment FULL-POD-DOC START
=head1 PURPOSE
Test file in the Developer Dashboard codebase. This file verifies release metadata, shipped assets, docs, and contributor guardrails.
Open this file when you need the implementation, regression coverage, or runtime entrypoint for that responsibility rather than guessing which part of the tree owns it.
=head1 WHY IT EXISTS
It exists to enforce the TDD contract for this behaviour, stop regressions from shipping, and keep the mandatory coverage and release gates honest.
=head1 WHEN TO USE
Use this file when you are reproducing or fixing behaviour in its area, when you want a focused regression check before the full suite, or when you need to extend coverage without waiting for every unrelated test.
=head1 HOW TO USE
Run it directly with C<prove -lv t/15-release-metadata.t> while iterating, then keep it green under C<prove -lr t> before release. Add or update assertions here before changing the implementation that it covers. The metadata contract distinguishes re...
=head1 WHAT USES IT
It is used by developers during TDD, by the full C<prove -lr t> suite, by coverage runs, and by release verification before commit or push.
=head1 EXAMPLES
Example 1:
prove -lv t/15-release-metadata.t
Run the release metadata, documentation, and optional native-helper configure
contract checks by themselves while editing docs, version metadata, or build
prerequisites.
Example 2:
HARNESS_PERL_SWITCHES=-MDevel::Cover prove -lv t/15-release-metadata.t
Confirm the metadata and mocked native-helper configuration guardrails still
behave under the covered test path.
Example 3:
dzil build
The cron documentation assertions fail until the canonical POD and plain
collector scheduling reference explain C<0 */1 * * *> as hourly and
C<* */1 * * *> as per-minute. The generated README is checked both for those
examples and against the canonical POD renderer.
Follow the metadata assertions with a real distribution build, because this test protects the release contract.
Example 4:
( run in 0.815 second using v1.01-cache-2.11-cpan-60884a8df76 )