Don't need the p_check ... | p_purge as newer ptools will do
[xfstests-dev.git] / tools / srcdiff
index e750a8cabcf87ec66c66a30072775b556d6f14be..b1aad5160507d5803788190a730526fa09fc1441 100755 (executable)
@@ -13,7 +13,7 @@ use strict;
 # 
 # NB: to cross check that srcdiff is finding all the functions in the
 #     user source file, providing you have "mkproto" installed, you
-#     can "cd cmd/xfsprogs/libxfs" and cut&paste this in a bourne shell:
+#     can "cd xfsprogs/libxfs" and cut&paste this in a bourne shell:
 #     $ for file in xfs_*.c; do
 #     > mkproto -nps < $file | perl -ne '
 #     > END { print "    $count\t- " }
@@ -24,10 +24,12 @@ use strict;
 # 
 
 die "WORKAREA not set" unless defined $ENV{'WORKAREA'};
+die "KWORKAREA not set" unless defined $ENV{'KWORKAREA'};
 chdir $ENV{'WORKAREA'};
+my $kworkarea = $ENV{'KWORKAREA'};
 my $xdiff = $ENV{'XDIFF'};
-my $quiet=0;
-my $usage=0;
+my $quiet = 0;
+my $usage = 0;
 
 foreach (@ARGV) {
        if (/^-q$/) {
@@ -43,7 +45,7 @@ if ($usage) {
     exit 1;
 }
 
-my @pkglist = qw( attr acl dmapi xfsdump xfsprogs );
+my @pkglist = qw( xfstests attr acl dmapi xfsdump xfsprogs );
 my @difflist = qw(
        xfs_ag.h  xfs_alloc.h  xfs_alloc_btree.h xfs_arch.h
        xfs_attr_leaf.h  xfs_attr_sf.h  xfs_bit.h  xfs_bmap.h
@@ -51,12 +53,11 @@ my @difflist = qw(
        xfs_da_btree.h  xfs_dfrag.h  xfs_dinode.h  xfs_dir.h
        xfs_dir2.h  xfs_dir2_block.h  xfs_dir2_data.h
        xfs_dir2_leaf.h  xfs_dir2_node.h  xfs_dir2_sf.h
-       xfs_dir_leaf.h  xfs_dir_sf.h  xfs_dqblk.h  xfs_dquot_item.h
-       xfs_extfree_item.h  xfs_ialloc.h  xfs_imap.h
-       xfs_ialloc_btree.h  xfs_inode.h  xfs_inode_item.h
+       xfs_dir_leaf.h  xfs_dir_sf.h  xfs_extfree_item.h  xfs_ialloc.h
+       xfs_imap.h  xfs_ialloc_btree.h  xfs_inode.h  xfs_inode_item.h
        xfs_inum.h  xfs_log.h  xfs_log_priv.h  xfs_log_recover.h
        xfs_mount.h  xfs_quota.h  xfs_rtalloc.h
-       xfs_sb.h  xfs_trans.h  xfs_trans_space.h  xfs_types.h
+       xfs_sb.h  xfs_trans.h  xfs_trans_space.h  xfs_types.h  xfs_fs.h
 );
 
 sub straightdiff {
@@ -65,30 +66,46 @@ sub straightdiff {
        `diff $prefix1/$file $prefix2/$file >/dev/null 2>&1`;
        if (!$quiet) {
                print sprintf("\t%-35s ... ", $file);
-               if ($? != 0)    { print "FAILED\n"; }
+               if ($? != 0)    { printf("FAILED\n(%s/%s differs to %s/%s)\n",
+                                        $prefix1, $file, $prefix2, $file); }
                else            { print "ok\n"; }
-       } elsif ($? != 0) { 
-               printf("\t%-35s ... ", $file);
-               print "FAILED\n"; 
+       
+       } elsif ($? != 0) {
+               printf("\t%-35s ... FAILED\n(%s/%s differs to %s/%s)\n",
+                       $file, $prefix1, $file, $prefix2, $file);
+       }
+}
+
+#
+# xfstests directory m4 directory is a repository of all of the
+# custom m4 macros used in the packages we look after.
+#
+sub m4macrodiff {
+       my ( $package ) = @_;
+
+       foreach (`ls $package/m4/*.m4`) {
+               my $m4 = `basename $_`;
+               chomp($m4);
+               straightdiff $m4, "$package/m4", "xfstests/m4";
        }
 }
 
 my $first = shift @pkglist;
 foreach (@pkglist) {
        print "\n=== Checking $_ package ===\n";
-       straightdiff 'buildrules', "cmd/$first/include", "cmd/$_/include";
-       straightdiff 'buildmacros', "cmd/$first/include", "cmd/$_/include";
+       m4macrodiff $_;
+       straightdiff 'buildrules', "$first/include", "$_/include";
+       straightdiff 'buildmacros', "$first/include", "$_/include";
+       straightdiff 'Makefile', "$first/build", "$_/build";
+       straightdiff 'Makefile', "$first/build/rpm", "$_/build/rpm";
+       straightdiff 'Makefile', "$first/build/tar", "$_/build/tar";
 }
 print "\n=== Checking headers ===\n";
 foreach (@difflist) {
-       straightdiff $_, 'cmd/xfsprogs/include', 'linux/fs/xfs';
+       straightdiff $_, 'xfsprogs/include', "$kworkarea/fs/xfs";
 }
-straightdiff 'xfs_cred.h', 'cmd/xfsprogs/include', 'linux/fs/xfs/linux';
-straightdiff 'xfs_fs.h', 'cmd/xfsprogs/include', 'linux/include/linux';
-straightdiff 'dmapi_kern.h', 'cmd/dmapi/include', 'linux/include/linux';
-straightdiff 'dmapi.h', 'cmd/dmapi/include', 'linux/include/linux';
-straightdiff 'arch.h', 'cmd/xfsprogs/include', 'linux/fs/xfs/support';
-straightdiff 'quotaio_xfs.h', 'cmd/xfsdump/include', 'linux/include/linux';
+straightdiff 'dmapi_kern.h', 'dmapi/include', "$kworkarea/fs/xfs/dmapi";
+straightdiff 'dmapi.h', 'dmapi/include', "$kworkarea/fs/xfs/dmapi";
 
 # 
 # setstate
@@ -255,20 +272,19 @@ sub functiondiff {
        print "( Total: $count routine$plural checked in $file )\n" unless ($quiet);
 }
 
-# cmd/xfsprogs/{libxfs,libxlog}/* fs/xfs/*
+# xfsprogs/{libxfs,libxlog}/* fs/xfs/*
 my @funclist = qw(
        xfs_alloc.c  xfs_alloc_btree.c  xfs_attr_leaf.c
        xfs_bmap.c  xfs_bmap_btree.c  xfs_btree.c  xfs_da_btree.c
        xfs_dir.c  xfs_dir2.c  xfs_dir2_block.c  xfs_dir2_data.c
        xfs_dir2_leaf.c  xfs_dir2_node.c  xfs_dir2_sf.c
        xfs_dir_leaf.c  xfs_ialloc.c  xfs_ialloc_btree.c
-       xfs_inode.c  xfs_rtalloc.c  xfs_rtbit.c xfs_mount.c
-       xfs_trans.c
+       xfs_inode.c  xfs_rtalloc.c  xfs_mount.c  xfs_trans.c
 );
 
 print "\n=== Checking libxfs code ===\n";
 foreach (@funclist) {
-       functiondiff $_, 'cmd/xfsprogs/libxfs', 'linux/fs/xfs';
+       functiondiff $_, 'xfsprogs/libxfs', "$kworkarea/fs/xfs";
 }
 print "\n=== Checking libxlog code ===\n";
-functiondiff 'xfs_log_recover.c', 'cmd/xfsprogs/libxlog', 'linux/fs/xfs';
+functiondiff 'xfs_log_recover.c', 'xfsprogs/libxlog', "$kworkarea/fs/xfs";