summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-02-05 23:14:00 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-02-05 23:20:50 -0700
commit9b920de937b18e59e106ee0a7a5bb313b9be0d0c (patch)
tree8c5708d47c67e0ed4576689a05c3e16ab92e7dfe
parent116d154011db1aa5c1e416c85b97f51ce51b0c4e (diff)
downloadp5-Git-Annex-9b920de937b18e59e106ee0a7a5bb313b9be0d0c.tar.gz
skip some tests if we detect tmpfs device ID issues
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rwxr-xr-xt/21_annex-to-annex.t2
-rwxr-xr-xt/22_annex-to-annex-dropunused.t3
-rw-r--r--t/lib/t/Util.pm19
3 files changed, 23 insertions, 1 deletions
diff --git a/t/21_annex-to-annex.t b/t/21_annex-to-annex.t
index 2666b4b..9e84388 100755
--- a/t/21_annex-to-annex.t
+++ b/t/21_annex-to-annex.t
@@ -14,6 +14,8 @@ use Capture::Tiny qw(capture_merged);
use File::Spec::Functions qw(catfile rel2abs);
use File::chdir;
+plan skip_all => "device ID issues" if device_id_issues;
+
# make sure that `make test` will always use the right version of the
# script we seek to test
#
diff --git a/t/22_annex-to-annex-dropunused.t b/t/22_annex-to-annex-dropunused.t
index fd0322a..c8bd47a 100755
--- a/t/22_annex-to-annex-dropunused.t
+++ b/t/22_annex-to-annex-dropunused.t
@@ -8,10 +8,13 @@ use lib 't/lib';
use Test::More;
use File::Spec::Functions qw(rel2abs);
use t::Setup;
+use t::Util;
use File::chdir;
use File::Basename qw(dirname);
use File::Copy qw(copy);
+plan skip_all => "device ID issues" if device_id_issues;
+
# make sure that `make test` will always use the right version of the
# script we seek to test
my $a2a = "annex-to-annex";
diff --git a/t/lib/t/Util.pm b/t/lib/t/Util.pm
index a69ac4c..bb8f59e 100644
--- a/t/lib/t/Util.pm
+++ b/t/lib/t/Util.pm
@@ -6,8 +6,10 @@ use warnings;
use parent 'Exporter';
use File::Slurp;
use File::Spec::Functions qw(rel2abs);
+use File::chdir;
+use File::Temp qw(tempdir);
-our @EXPORT = qw( corrupt_annexed_file );
+our @EXPORT = qw( corrupt_annexed_file device_id_issues );
sub corrupt_annexed_file {
my ($git, $file) = @_;
@@ -20,4 +22,19 @@ sub corrupt_annexed_file {
append_file $loc, "bazbaz\n";
}
+# on a tmpfs as commonly used with sbuild, the device IDs for files
+# and directories can be different, which will cause annex-to-annex to
+# refuse to hardlink. we use this sub to skip some tests if we detect
+# that. possibly annex-to-annex should only look at the device IDs of
+# files (by creating a temporary file inside $dest and looking at the
+# device ID of that)
+sub device_id_issues {
+ local $CWD = tempdir CLEANUP => 1;
+ mkdir "foo";
+ write_file "bar", "bar\n";
+ my $foo_id = (stat "foo")[0];
+ my $bar_id = (stat "bar")[0];
+ return($foo_id != $bar_id);
+}
+
1;