chiark / gitweb /
Test suite: import-nonnative: Check that .orig contents match imported trees
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 7 Nov 2016 23:05:42 +0000 (23:05 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 7 Nov 2016 23:05:42 +0000 (23:05 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
tests/tests/import-nonnative

index d709ab5..a1884e7 100755 (executable)
@@ -55,6 +55,19 @@ chk2() {
        t-ref-same refs/heads/first-2nd-import
 
        for orig in ../${p}_${v%-*}.orig*.tar.*; do
+               tar -atf $orig | LC_ALL=C sort >../files.o
+               pfx=$(perl <../files.o -ne '
+                       while (<>) {
+                               m#^([^/]+/)# or exit 0;
+                               $x //= $1;
+                               $x eq $1 or exit 0;
+                       }
+                       print "$x\n";
+               ')
+               perl -i~ -pe '
+                       s#^\Q'"$pfx"'\E##;
+                       $_="" if m/^$/ || m#/$#;
+               ' ../files.o
                orig=${orig#../}
                pat="^Import ${orig//./\\.}\$"
                t-refs-same-start
@@ -65,6 +78,9 @@ chk2() {
                        imp=$(cat ../t.imp)
                        t-ref-same-val "$orig $start" "$imp"
                done
+               git ls-tree -r --name-only "$t_ref_val:" \
+                       | sort >../files.g
+               diff ../files.{o,g}
        done
        cd ..
 }