New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test suite should support detached .git #13410
Comments
From dennis@kaarsemaker.netCreated by dennis@kaarsemaker.netThis is a bug report for perl from dennis@kaarsemaker.net, ----------------------------------------------------------------- Perl Info
|
From @bulk88On Sun Nov 10 14:22:58 2013, dennis@kaarsemaker.net wrote:
Wheres the patch? -- |
The RT System itself - Status changed from 'new' to 'open' |
From dennis.kaarsemaker@booking.comOn zo, 2013-11-10 at 16:56 -0800, bulk88 via RT wrote:
Here it is. RT wouldn't let me attach it. In fact, it doesn't even let |
From dennis.kaarsemaker@booking.com0001-Make-tests-work-with-detached-git-dir.patchFrom 4b6ad52236b340226f9525a1b59d6ca2fdbf932e Mon Sep 17 00:00:00 2001
From: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Date: Sun, 10 Nov 2013 23:17:38 +0100
Subject: [PATCH] Make tests work with detached git dir
In my jenkins replacement, I run all tests with .git outside the work tree,
pointed to by $GIT_DIR. This is fairly common git practice, so let's make the
testsuite support this and run the relevant porting tests that are skipped
without this patch.
---
Porting/cmpVERSION.pl | 2 +-
t/test.pl | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/Porting/cmpVERSION.pl b/Porting/cmpVERSION.pl
index 46f1fef..48fbdbc 100755
--- a/Porting/cmpVERSION.pl
+++ b/Porting/cmpVERSION.pl
@@ -32,7 +32,7 @@ unless (GetOptions('diffs' => \$diffs,
die "$0: This does not look like a Perl directory\n"
unless -f "perl.h" && -d "Porting";
die "$0: 'This is a Perl directory but does not look like Git working directory\n"
- unless -d ".git";
+ unless (-d ".git" || (exists $ENV{GIT_DIR} && -d $ENV{GIT_DIR}));
my $null = devnull();
diff --git a/t/test.pl b/t/test.pl
index 5b1ee18..de35d71 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -176,6 +176,10 @@ sub find_git_or_skip {
}
$source_dir = $where;
}
+ } elsif (exists $ENV{GIT_WORK_TREE}) {
+ $source_dir = $ENV{GIT_WORK_TREE};
+ } elsif (exists $ENV{GIT_DIR}) {
+ $source_dir = '.'
}
if ($source_dir) {
my $version_string = `git --version`;
--
1.8.5-rc0-319-g4c665cc
|
From @hvdsDennis Kaarsemaker <dennis.kaarsemaker@booking.com> wrote: Hmm, that suggests you use git sometimes, but it doesn't seem like How will you distinguish your case from people that follow this "fairly Hugo |
From dennis.kaarsemaker@booking.comOn ma, 2013-11-11 at 08:00 +0000, hv@crypt.org wrote:
Fair point, it is of course possible to set GIT_DIR when not working in Checking for both $ENV{GIT_DIR} and whether a 'blead' branch exists in If that's still not enough, checking git ls-tree output to see if perl.c How far do you think the check should go? |
From @hvdsDennis Kaarsemaker <dennis.kaarsemaker@booking.com> wrote: I'm not sure: what's the impact of running porting tests on a false If the fact it's a false positive means it will report test fails (which If the impact is low enough that it's not worth putting extra checks in, Alternatively we could run them if $ENV{PERL_PORTER} ... Hugo |
From dennis.kaarsemaker@booking.comOn ma, 2013-11-11 at 08:47 +0000, hv@crypt.org wrote:
That's not what this test is used for. It's used in test_porting to
The impact is that some porting tests get skipped with a pretty clear porting/authors.t ......... fatal: Not a git repository: 'nonexistent' So I think the patch is fine even as-is and no further detection is |
From @tonycozOn Mon Nov 11 00:57:05 2013, dennis.kaarsemaker@booking.com wrote:
Check that a given SHA exists, eg. that: git log -n1 a0d0e21ea6ea90a22318550944fe6cb09ae10cdb for example, succeeds. I thought we had a test that had been modified to do something similar Tony [1] http://lists.debian.org/debian-infrastructure-announce/2013/11/msg00001.html |
From dennis.kaarsemaker@booking.comOn ma, 2013-11-11 at 14:32 -0800, Tony Cook via RT wrote:
That's a good idea! Revised patch attached. |
From dennis.kaarsemaker@booking.com0001-Make-tests-work-with-detached-git-dir.patchFrom 77e5f5352bc2b4ce409eccc944c1bece3c3946bc Mon Sep 17 00:00:00 2001
From: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Date: Sun, 10 Nov 2013 23:17:38 +0100
Subject: [PATCH] Make tests work with detached git dir
In my jenkins replacement, I run all tests with .git outside the work tree,
pointed to by $GIT_DIR. This is fairly common git practice, so let's make the
testsuite support this and run the relevant porting tests that are skipped
without this patch.
---
Porting/cmpVERSION.pl | 2 +-
t/test.pl | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/Porting/cmpVERSION.pl b/Porting/cmpVERSION.pl
index 46f1fef..48fbdbc 100755
--- a/Porting/cmpVERSION.pl
+++ b/Porting/cmpVERSION.pl
@@ -32,7 +32,7 @@ unless (GetOptions('diffs' => \$diffs,
die "$0: This does not look like a Perl directory\n"
unless -f "perl.h" && -d "Porting";
die "$0: 'This is a Perl directory but does not look like Git working directory\n"
- unless -d ".git";
+ unless (-d ".git" || (exists $ENV{GIT_DIR} && -d $ENV{GIT_DIR}));
my $null = devnull();
diff --git a/t/test.pl b/t/test.pl
index 5b1ee18..ccb3ebd 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -176,6 +176,11 @@ sub find_git_or_skip {
}
$source_dir = $where;
}
+ } elsif (exists $ENV{GIT_DIR}) {
+ my $commit = '8d063cd8450e59ea1c611a2f4f5a21059a2804f1';
+ if(`git rev-parse --verify --quiet '$commit^{commit}'` ne $commit) {
+ $source_dir = '.'
+ }
}
if ($source_dir) {
my $version_string = `git --version`;
--
1.8.5-rc0-319-g4c665cc
|
From @hvdsDennis Kaarsemaker <dennis.kaarsemaker@booking.com> wrote: Looks good to me. Hugo |
From @tonycozOn Mon Nov 11 15:20:51 2013, dennis.kaarsemaker@booking.com wrote:
Two porting tests fail for me if I point GIT_DIR at a non-perl git directory: $ GIT_DIR=/home/tony/dev/imager/git/Imager/.git make -j3 test_porting porting/authors.t (Wstat: 0 Tests: 9 Failed: 6) I created the clone with: git clone --separate-git-dir=sepperl.git git://git/perl.git sepperl (git://git/perl.git is my local mirror) Testing with the correct GIT_DIR correctly ran the git dependent tests and passed. Tony |
From dennis@kaarsemaker.netOn di, 2013-12-03 at 21:18 -0800, Tony Cook via RT wrote:
This version should do that correctly. There's now only one situation -- |
From dennis@kaarsemaker.net0001-Make-tests-work-with-detached-git-dir.patchFrom 9d0a665e620cc3dff2470eaec6ca972ffe070479 Mon Sep 17 00:00:00 2001
From: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Date: Sun, 10 Nov 2013 23:17:38 +0100
Subject: [PATCH] Make tests work with detached git dir
In my jenkins replacement, I run all tests with .git outside the work tree,
pointed to by $GIT_DIR. This is fairly common git practice, so let's make the
testsuite support this and run the relevant porting tests that are skipped
without this patch.
---
Porting/cmpVERSION.pl | 2 +-
t/test.pl | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/Porting/cmpVERSION.pl b/Porting/cmpVERSION.pl
index 46f1fef..48fbdbc 100755
--- a/Porting/cmpVERSION.pl
+++ b/Porting/cmpVERSION.pl
@@ -32,7 +32,7 @@ unless (GetOptions('diffs' => \$diffs,
die "$0: This does not look like a Perl directory\n"
unless -f "perl.h" && -d "Porting";
die "$0: 'This is a Perl directory but does not look like Git working directory\n"
- unless -d ".git";
+ unless (-d ".git" || (exists $ENV{GIT_DIR} && -d $ENV{GIT_DIR}));
my $null = devnull();
diff --git a/t/test.pl b/t/test.pl
index 5b1ee18..fcab07a 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -176,6 +176,13 @@ sub find_git_or_skip {
}
$source_dir = $where;
}
+ } elsif (exists $ENV{GIT_DIR}) {
+ my $commit = '8d063cd8450e59ea1c611a2f4f5a21059a2804f1';
+ my $out = `git rev-parse --verify --quiet '$commit^{commit}'`;
+ chomp $out;
+ if($out eq $commit) {
+ $source_dir = '.'
+ }
}
if ($source_dir) {
my $version_string = `git --version`;
--
1.8.5-386-gb78cb96
|
From @tonycozOn Sat Dec 14 14:54:40 2013, dennis@kaarsemaker.net wrote:
Thanks, applied as 6b44ec6. Tony |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#120505 (status was 'resolved')
Searchable as RT120505$
The text was updated successfully, but these errors were encountered: