Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: class-dump/src/Tests/doTests.py

Issue 7793008: Add the 3.3.3 sources for class-dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « class-dump/src/NSString-Extensions.m ('k') | class-dump/src/UnitTests/AllTests.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/usr/bin/python
2
3 from datetime import *
4 from subprocess import *
5 import glob
6 import os
7 import sys
8 import getopt
9
10 TESTDIR = "/tmp/cdt"
11 TESTDIR_OLD = TESTDIR + "/old"
12 TESTDIR_NEW = TESTDIR + "/new"
13 TESTDIR_NEW_32 = TESTDIR + "/new32"
14 TESTDIR_NEW_64 = TESTDIR + "/new64"
15
16 OLD_CD = os.path.expanduser("~/Unix/bin/class-dump-3.3.2")
17 #OLD_CD = "/bin/echo"
18 NEW_CD = os.path.expanduser("/Local/nygard/Products/Debug/class-dump")
19
20 # Must be a version that supports --list-arches
21 ARCH_CD = os.path.expanduser("/Local/nygard/Products/Debug/class-dump")
22
23 mac_frameworks = [
24 "/System/Library/Frameworks/*.framework",
25 "/System/Library/PrivateFrameworks/*.framework",
26 "/Developer/Library/Frameworks/*.framework",
27 "/Developer/Library/PrivateFrameworks/*.framework",
28 ]
29
30 mac_apps = [
31 "/Applications/*.app",
32 "/Applications/*/*.app",
33 "/Applications/Utilities/*.app",
34 "/Developer/Applications/*.app",
35 "/Developer/Applications/*/*.app",
36 "~/Applications/*.app",
37 "/System/Library/CoreServices/*.app",
38 ]
39
40 mac_bundles = [
41 "/System/Library/CoreServices/*.bundle",
42 ]
43
44 #mac_testapps = [
45 # "/Volumes/BigData/TestApplications/*.app",
46 #]
47
48 def resolve_sdk_root_alias(sdk_root="4.0"):
49 if sdk_root in ("3.2", "4.0", "4.1", ):
50 return "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" + sdk_root + ".sdk"
51 return sdk_root
52
53 def build_ios_paths(sdk_root):
54 iphone_frameworks = [
55 sdk_root + "/System/Library/Frameworks/*.framework",
56 sdk_root + "/System/Library/PrivateFrameworks/*.framework",
57 ]
58 iphone_apps = []
59 iphone_bundles = []
60 return dict(apps=iphone_apps, frameworks=iphone_frameworks, bundles=iphone_b undles)
61
62 def mkdir_ignore(dir):
63 try:
64 os.mkdir(dir)
65 except OSError as e:
66 pass
67
68 def printUsage():
69 print "doTests.py [--ios] [--sdk-root <path, 4.1, 4.0 or 3.2>]"
70 print
71
72 def main(argv):
73 try:
74 opts, args = getopt.getopt(argv, "", ["sdk-root=", "ios"])
75 except getopt.GetoptError:
76 printUsage()
77 sys.exit(2)
78
79 shouldTestIOs = False
80 sdk_root = None
81
82 for opt, arg in opts:
83 if opt in ("--ios",):
84 shouldTestIOs = True
85 if opt in ("--sdk-root",):
86 sdk_root = arg
87
88 sdk_root = resolve_sdk_root_alias(sdk_root)
89
90 if shouldTestIOs:
91 print "Testing on iOS targets"
92 sdict = build_ios_paths(sdk_root)
93 OLD_OPTS = []
94 NEW_OPTS = ["--sdk-root", sdk_root]
95 else:
96 print "Testing on Mac OS X targets"
97 if sdk_root:
98 print "Ignoring --sdk-root for macosx testing"
99 sdict = dict(apps=mac_apps, frameworks=mac_frameworks, bundles=mac_bundl es)
100 OLD_OPTS = []
101 NEW_OPTS = []
102
103 print "Starting tests at", datetime.today().ctime()
104 print
105 print "Old class-dump:", " ".join(Popen("ls -al " + OLD_CD, shell=True, stdo ut=PIPE).stdout.readlines()),
106 print "New class-dump:", " ".join(Popen("ls -al " + NEW_CD, shell=True, stdo ut=PIPE).stdout.readlines()),
107
108 apps = []
109 frameworks = []
110 bundles = []
111
112 for pattern in sdict["apps"]:
113 apps.extend(glob.glob(pattern))
114 for pattern in sdict["frameworks"]:
115 frameworks.extend(glob.glob(pattern))
116 for pattern in sdict["bundles"]:
117 bundles.extend(glob.glob(pattern))
118
119 print " Framework count:", len(frameworks)
120 print "Application count:", len(apps)
121 print " Bundle count:", len(bundles)
122 print " Total:", len(frameworks) + len(apps) + len(bundles)
123
124 mkdir_ignore(TESTDIR)
125 mkdir_ignore(TESTDIR_OLD)
126 mkdir_ignore(TESTDIR_NEW)
127
128 all = []
129 all.extend(frameworks)
130 all.extend(apps)
131 all.extend(bundles)
132
133 for path in all:
134 (base, ext) = os.path.splitext(os.path.basename(path))
135 ext = ext.lstrip(".")
136 print base, ext
137 proc = Popen([ARCH_CD, "--list-arches", path], shell=False, stdout=PIPE)
138 arches = proc.stdout.readline().rstrip().split(" ")
139 print arches
140 proc.stdout.readlines()
141 for arch in arches:
142 if arch == "none":
143 command = [OLD_CD, "-s", "-t", path]
144 command.extend(OLD_OPTS)
145 #print command
146 out = open("%s/%s-%s.txt" % (TESTDIR_OLD, base, ext), "w");
147 Popen(command, shell=False, stdout=out, stderr=out)
148 out.close()
149
150 command = [NEW_CD, "-s", "-t", path]
151 command.extend(NEW_OPTS)
152 #print command
153 out = open("%s/%s-%s.txt" % (TESTDIR_NEW, base, ext), "w");
154 Popen(command, shell=False, stdout=out, stderr=out)
155 out.close()
156 else:
157 print arch
158
159 command = [OLD_CD, "-s", "-t", "--arch", arch, path]
160 command.extend(OLD_OPTS)
161 #print command
162 out = open("%s/%s-%s-%s.txt" % (TESTDIR_OLD, base, arch, ext), " w");
163 Popen(command, shell=False, stdout=out, stderr=out)
164 out.close()
165
166 command = [NEW_CD, "-s", "-t", "--arch", arch, path]
167 command.extend(NEW_OPTS)
168 #print command
169 out = open("%s/%s-%s-%s.txt" % (TESTDIR_NEW, base, arch, ext), " w");
170 Popen(command, shell=False, stdout=out, stderr=out)
171 out.close()
172
173 print "Ended tests at", datetime.today().ctime()
174 Popen("opendiff %s %s" % (TESTDIR_OLD, TESTDIR_NEW), shell=True)
175
176 #----------------------------------------------------------------------
177 #
178 ## arch = none check for FWAVCPrivate.framework, KAdminClient, Kernel, Syndicati onUI
179 #
180 ## We can remove files that don't contain Objective-C runtime information.
181 ## Need to jump through some hoops because of the cursed spaces in filenames, gr r.
182 #foreach i (/tmp/cdt/{old,new}/*.txt)
183 # grep -q "This file does not contain" $i
184 # if [ $? -eq 0 ]; then
185 # rm $i
186 # fi
187 #end
188 #
189 ### Set up comparisons of new 32-bit vs. 64-bit output
190 ##foreach arch (ppc ppc7400 i386) do
191 ## foreach i ($TESTDIR_NEW/*-$arch-*) do
192 ## ln -s $i $TESTDIR_NEW_32
193 ## done
194 ##done
195 ##
196 ##foreach arch (ppc64 x86_64) do
197 ## foreach i ($TESTDIR_NEW/*-$arch-*) do
198 ## ln -s $i $TESTDIR_NEW_64
199 ## done
200 ##done
201 #
202 #echo "Ended tests at `date`"
203 #opendiff /tmp/cdt/old /tmp/cdt/new
204 #
205
206 if __name__ == "__main__":
207 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « class-dump/src/NSString-Extensions.m ('k') | class-dump/src/UnitTests/AllTests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698