1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/group/check.bat Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,187 @@
1.4 +@rem
1.5 +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +@rem All rights reserved.
1.7 +@rem This component and the accompanying materials are made available
1.8 +@rem under the terms of the License "Eclipse Public License v1.0"
1.9 +@rem which accompanies this distribution, and is available
1.10 +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +@rem
1.12 +@rem Initial Contributors:
1.13 +@rem Nokia Corporation - initial contribution.
1.14 +@rem
1.15 +@rem Contributors:
1.16 +@rem
1.17 +@rem Description:
1.18 +@rem
1.19 +
1.20 +@perl -x check.bat
1.21 +@goto end
1.22 +#!perl
1.23 +
1.24 +require Cwd;
1.25 +$cwd=Cwd::getcwd();
1.26 +#print "cwd: ",$cwd,"\n";
1.27 +$cwd =~ s/\//\\/;
1.28 +$cwd =~ /^(\w:)?([\\|\/]\S+[\\|\/])/isx;
1.29 +$drive=$1;
1.30 +$prjroot=$2;
1.31 +#print "drive ",$drive,"\n";
1.32 +#print "project root: ",$prjroot,"\n";
1.33 +@cpps=();
1.34 +@mmps=();
1.35 +@mmpflags=();
1.36 +%sources=();
1.37 +%sourceusers=();
1.38 +ls ($prjroot);
1.39 +#print "CPP files:\n";
1.40 +#foreach $entry (@cpps)
1.41 +# {
1.42 +# print $entry,"\n";
1.43 +# }
1.44 +#print "MMP files:\n";
1.45 +$count=0;
1.46 +$countz=0;
1.47 +$countsrc=0;
1.48 +foreach $entry (@mmps)
1.49 + {
1.50 +# print $entry,"\n";
1.51 + $srclist=$sources{$entry};
1.52 + $mmpflags[$count]=0;
1.53 + ++$count;
1.54 + ++$countz if (scalar(@$srclist)==0);
1.55 + $countsrc += scalar(@$srclist);
1.56 + foreach $src (@$srclist)
1.57 + {
1.58 + $uselist=$sourceusers{$src};
1.59 + $sourceusers{$src}=$uselist." ".$entry;
1.60 +# print "\t",$src,"\n";
1.61 + }
1.62 + }
1.63 +$hashsize=scalar(%sources);
1.64 +#print $hashsize;
1.65 +#print "Count=",$count,"\n";
1.66 +#print "CountZ=",$countz,"\n";
1.67 +#print "CountSrc=",$countsrc,"\n";
1.68 +
1.69 +foreach $entry (@cpps)
1.70 + {
1.71 + $uses=$sourceusers{$entry};
1.72 + print "File ",$entry," not referenced by any .MMP file\n" unless $uses;
1.73 + }
1.74 +
1.75 +parsebldinf();
1.76 +
1.77 +$i=0;
1.78 +foreach $entry (@mmps)
1.79 + {
1.80 + next if $mmpflags[$i++];
1.81 + print "\n",$entry,".MMP does not appear in BLD.INF\n";
1.82 + print "\t Source files:\n";
1.83 + $srclist=$sources{$entry};
1.84 + foreach $src (@$srclist)
1.85 + {
1.86 + print "\t",$src,"\n";
1.87 + }
1.88 + }
1.89 +end;
1.90 +
1.91 +sub ls
1.92 + {
1.93 + my $dir=@_[0];
1.94 + $dir =~ s/\//\\/;
1.95 +# print $dir,"\n";
1.96 + opendir(DIR,$dir);
1.97 + my @dir=readdir(DIR);
1.98 + closedir(DIR);
1.99 + my $entry;
1.100 + my $fullentry;
1.101 + foreach $entry (@dir)
1.102 + {
1.103 + $entry=~s/\//\\/;
1.104 + next if (($entry eq ".") or ($entry eq ".."));
1.105 + $fullentry=$dir.$entry;
1.106 + if (-d $fullentry)
1.107 + {
1.108 + ls($fullentry."\\");
1.109 + }
1.110 + else
1.111 + {
1.112 + push @cpps, uc($fullentry) if ($entry =~ /\S+\.cpp/isx);
1.113 + if ($entry =~ /(\S+)\.mmp/isx)
1.114 + {
1.115 + push @mmps, uc($1);
1.116 + parsemmp($fullentry,\%sources);
1.117 + }
1.118 +# print $fullentry,"\n";
1.119 + }
1.120 + }
1.121 + }
1.122 +
1.123 +sub parsemmp
1.124 + {
1.125 + my $mmpfile=@_[0];
1.126 + my $array=@_[1];
1.127 + my $project;
1.128 + my $subproject;
1.129 +# print "ParseMMP ",$mmpfile,"\n";
1.130 + open(MMP,$mmpfile);
1.131 + my @sources=();
1.132 + while(<MMP>)
1.133 + {
1.134 + if (/^PROJECT\s+(\S+)/isx)
1.135 + {
1.136 + $project=uc($1);
1.137 +# print "Project ",$project,"\n";
1.138 + }
1.139 + elsif (/^SUBPROJECT\s+(\S+)/isx)
1.140 + {
1.141 + $subproject=uc($1);
1.142 +# print "Subproject ",$subproject,"\n";
1.143 + }
1.144 + elsif (/^source\s*(.+)/isx)
1.145 + {
1.146 +# print $1;
1.147 + my $list=$1;
1.148 + while($list)
1.149 + {
1.150 + $list =~ /^(\S+)\s*(.*)/isx;
1.151 + push @sources, "\\".$project."\\".$subproject."\\".uc($1);
1.152 + $list=$2;
1.153 +# print "\t Source ",$1,"\n";
1.154 + }
1.155 + }
1.156 + }
1.157 + close(MMP);
1.158 + $mmpfile =~ /\S*\\(\S+)\.mmp/isx;
1.159 + $mmpfileshort=uc($1);
1.160 + $$array{$mmpfileshort}=\@sources;
1.161 + }
1.162 +
1.163 +sub parsebldinf
1.164 + {
1.165 + my $reachedmmps=0;
1.166 + open(BLDINF,"bld.inf");
1.167 + while (<BLDINF>)
1.168 + {
1.169 +# print;
1.170 + if ($reachedmmps==0)
1.171 + {
1.172 + $reachedmmps=1 if (/PRJ_MMPFILES|PRJ_TESTMMPFILES/isx);
1.173 + next;
1.174 + }
1.175 + /(\S+)\s*.*/isx;
1.176 + my $mmpfile=uc($1);
1.177 +# print "****************",$mmpfile,"\n";
1.178 + my $mmp;
1.179 + my $i=0;
1.180 + foreach $mmp (@mmps)
1.181 + {
1.182 + $mmpflags[$i]=1 if ($mmp eq $mmpfile);
1.183 + ++$i;
1.184 + }
1.185 + }
1.186 + close(BLDINF);
1.187 + }
1.188 +
1.189 +__END__
1.190 +:end