diff options
author | Bram <perl-rt@wizbit.be> | 2022-09-17 19:43:46 +0200 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2022-09-19 15:15:37 +1000 |
commit | 534b66374b96a50023b85157019b49970f0bd3e6 (patch) | |
tree | e9270ebf1d52b6bbae9b5766c5d6e1f2d17871df /Porting/updateAUTHORS.pl | |
parent | 95aca9b049c0a768ab80bef52b8162b498735588 (diff) | |
download | perl-534b66374b96a50023b85157019b49970f0bd3e6.tar.gz |
Skip 'pending changes' test for automated testing
This code is called via t/porting/authors.t; it basically checks
if there are pending/uncommitted changes and if the author is a known
contributor.
That test doesn't really work too well in combination with Test::Smoke since
that does create some files in the build-directory and may patch some files
(for example patching 'patchlevel.h' to include the commit id).
The end result: on several smokers the t/porting/authors.t test was failing
[because they lack a git config for user+email or because the configured
name/email is not a known contributor].
Unfortunately Test::Smoke does not set the AUTOMATED_TESTING flag so
detect if Test::Smoke is running by checking for the 'mktest.out' file.
This commit also reverts the temporary work-around that was added in
commit 6c19d6c6d4db446fa9513b7d617134c938c89a4e. (That work-around
didn't cover all cases; there are smokers running with a different name/email
configured then the one in AUTHORS and for those the test still failed with
the temp work-around.)
Fixes #20141
Diffstat (limited to 'Porting/updateAUTHORS.pl')
-rwxr-xr-x | Porting/updateAUTHORS.pl | 134 |
1 files changed, 57 insertions, 77 deletions
diff --git a/Porting/updateAUTHORS.pl b/Porting/updateAUTHORS.pl index 490ba6d2ec..b3094e41d3 100755 --- a/Porting/updateAUTHORS.pl +++ b/Porting/updateAUTHORS.pl @@ -135,90 +135,70 @@ sub main { sprintf "%s is listed in AUTHORS", _clean_name($_)) for sort keys %{ $self->{missing_author} || {} }; - my $uncommitted_files= $self->git_status_porcelain; - if ($uncommitted_files) { - my ($author_name, $author_email)= - $self->current_author_name_email(); - my ($committer_name, $committer_email)= - $self->current_committer_name_email(); - - # ---- BEGIN TEMP --- - # - # Several of the smokers are not happy: - # - # Test::Smoke leaves some files in the build dir which causes this - # code to (correctly) conclude that there are uncommitted files. - # The test then continues to check if the author name/email is - # configured and if the 'user' is known in AUTHORS. - # On several smokers (including mine) there is *no* git config - # and that causes the tests to fail. - # - # The old code (t/porting/pending-authors.t) which was removed - # differs from this code in two ways: - # - it ignored untracked files (in git status) - # - it skipped the tests when author name/email was not set in - # the git config. - # - # For now: restore the old behavior and 'skip' the tests when - # there is no git config. + SKIP: { + # What is tested in this block: + # - check if there uncommitted changes in the git-tree + # - if so: is the (configured) author a known contributor? + + skip "AUTOMATED_TESTING is set" if ($ENV{AUTOMATED_TESTING}); + + # Test::Smoke leaves some files in the build dir which causes + # this code to (correctly) conclude that there are uncommitted + # files which then proceeds to check the author name/email. # - # (A better fix might be to add the Test::Smoke files into - # the .gitignore file but it needs to be checked if there are - # side effects from that + required knowing which files were - # created.) + # On several smokers: + # - there is *no* git config; + # - a different name/address is configured then the one listed + # in AUTHORS; + # which causes the test to fail. # - if ($uncommitted_files !~ m/^[^\?]/m) { - note( - "Only untracked files in \$uncommited_files - skipping tests" + # Unfortunately Test::Smoke doesn't set the AUTOMATED_TESTING + # env-var.. Therefor check if mktest.out exist, it's one of the + # first files Test::Smoke creates in the build directory. + skip "Test::Smoke running" if (-e "./mktest.out"); + + my $uncommitted_files= $self->git_status_porcelain; + if ($uncommitted_files) { + my ($author_name, $author_email)= + $self->current_author_name_email(); + my ($committer_name, $committer_email)= + $self->current_committer_name_email(); + + ok($author_name && $author_email, + "git knows your author name and email."); + ok( + $committer_name && $committer_email, + "git knows your committer name and email." ); - done_testing(); - return 0; - } - if (not $author_name or not $author_email) { - note("Author name or email unknown in git - skipping tests"); - done_testing(); - return 0; - } - if (not $committer_name or not $committer_email) { - note("Committer name or email unknown in git - skipping tests"); - done_testing(); - return 0; - } - # - # ---- END TEMP --- - - ok($author_name && $author_email, - "git knows your author name and email."); - ok( - $committer_name && $committer_email, - "git knows your committer name and email." - ); - - my $author_known= - $self->known_contributor($author_name, $author_email); - my $committer_known= - $self->known_contributor($committer_name, $committer_email); - if ( - is( - $author_known && $committer_known, - 1, "Uncommitted changes are by a known contributor?" - )) - { - diag - "Testing uncommtted changes! Remember to commit before you push!" - if $ENV{TEST_VERBOSE}; + + my $author_known= + $self->known_contributor($author_name, $author_email); + my $committer_known= + $self->known_contributor($committer_name, $committer_email); + if ( + is( + $author_known && $committer_known, + 1, "Uncommitted changes are by a known contributor?" + )) + { + diag + "Testing uncommtted changes! Remember to commit before you push!" + if $ENV{TEST_VERBOSE}; + } + else { + diag error_advice_for_uncommitted_changes( + $author_name, $author_email, + $committer_name, $committer_email, + $uncommitted_files + ); + } } else { - diag error_advice_for_uncommitted_changes( - $author_name, $author_email, $committer_name, - $committer_email, $uncommitted_files - ); + # this will always pass... but it adds test output that is helpful + ok(!$uncommitted_files, + "git status --porcelain should be empty"); } } - else { - # this will always pass... but it adds test output that is helpful - ok(!$uncommitted_files, "git status --porcelain should be empty"); - } diag "\nFiles need updating! You probably just need to run\n\n", " Porting/updateAUTHORS.pl\n\n", "and commit the results." |