Merge branch 'tz/cred-netrc-cleanup'

Build and test procedure for netrc credential helper (in contrib/)
has been updated.

* tz/cred-netrc-cleanup:
  git-credential-netrc: make "all" default target of Makefile
  git-credential-netrc: fix exit status when tests fail
  git-credential-netrc: use in-tree Git.pm for tests
  git-credential-netrc: minor whitespace cleanup in test script
This commit is contained in:
Junio C Hamano
2018-06-28 12:53:33 -07:00
3 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,6 @@
# The default target of this Makefile is...
all::
test: test:
./t-git-credential-netrc.sh ./t-git-credential-netrc.sh

View File

@ -17,15 +17,16 @@
# set up test repository # set up test repository
test_expect_success \ test_expect_success \
'set up test repository' \ 'set up test repository' \
'git config --add gpg.program test.git-config-gpg' 'git config --add gpg.program test.git-config-gpg'
# The external test will outputs its own plan # The external test will outputs its own plan
test_external_has_tap=1 test_external_has_tap=1
export PERL5LIB="$GITPERLLIB"
test_external \ test_external \
'git-credential-netrc' \ 'git-credential-netrc' \
perl "$TEST_DIRECTORY"/../contrib/credential/netrc/test.pl perl "$GIT_BUILD_DIR"/contrib/credential/netrc/test.pl
test_done test_done
) )

View File

@ -1,5 +1,4 @@
#!/usr/bin/perl #!/usr/bin/perl
use lib (split(/:/, $ENV{GITPERLLIB}));
use warnings; use warnings;
use strict; use strict;
@ -12,7 +11,6 @@ BEGIN {
# t-git-credential-netrc.sh kicks off our testing, so we have to go # t-git-credential-netrc.sh kicks off our testing, so we have to go
# from there. # from there.
Test::More->builder->current_test(1); Test::More->builder->current_test(1);
Test::More->builder->no_ending(1);
} }
my @global_credential_args = @ARGV; my @global_credential_args = @ARGV;
@ -104,6 +102,9 @@ $cred = run_credential( ['-f', $netrcGpg, '-g', 'test.command-option-gpg', 'get'
ok(scalar keys %$cred == 2, 'Got keys decrypted by command option'); ok(scalar keys %$cred == 2, 'Got keys decrypted by command option');
my $is_passing = eval { Test::More->is_passing };
exit($is_passing ? 0 : 1) unless $@ =~ /Can't locate object method/;
sub run_credential sub run_credential
{ {
my $args = shift @_; my $args = shift @_;