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

Side by Side Diff: native_client_sdk/src/tools/tests/create_nmf_test.py

Issue 13106002: [NaCl SDK] A bunch of spelling fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix presubmit Created 7 years, 9 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 import os 5 import os
6 import shutil 6 import shutil
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 import tempfile 9 import tempfile
10 import unittest 10 import unittest
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 # static nexe should have exactly one needed file 132 # static nexe should have exactly one needed file
133 self.assertEqual(len(needed), 1) 133 self.assertEqual(len(needed), 1)
134 self.assertEqual(needed.keys()[0], nexe) 134 self.assertEqual(needed.keys()[0], nexe)
135 135
136 # arch of needed file should be x86-32 136 # arch of needed file should be x86-32
137 archfile = needed.values()[0] 137 archfile = needed.values()[0]
138 self.assertEqual(archfile.arch, 'x86-32') 138 self.assertEqual(archfile.arch, 'x86-32')
139 139
140 def StripDependencies(self, deps): 140 def StripDependencies(self, deps):
141 """Strip the dirnames and version suffixs from 141 """Strip the dirnames and version suffixes from
142 a list of nexe dependencies. 142 a list of nexe dependencies.
143 143
144 e.g: 144 e.g:
145 /path/to/libpthread.so.1a2d3fsa -> libpthread.so 145 /path/to/libpthread.so.1a2d3fsa -> libpthread.so
146 """ 146 """
147 names = [] 147 names = []
148 for name in deps: 148 for name in deps:
149 name = os.path.basename(name) 149 name = os.path.basename(name)
150 if '.so.' in name: 150 if '.so.' in name:
151 name = name.rsplit('.', 1)[0] 151 name = name.rsplit('.', 1)[0]
152 names.append(name) 152 names.append(name)
153 return names 153 return names
154 154
155 def testGetNeededDynamic(self): 155 def testGetNeededDynamic(self):
156 nmf = self.CreateNmfUtils() 156 nmf = self.CreateNmfUtils()
157 needed = nmf.GetNeeded() 157 needed = nmf.GetNeeded()
158 names = needed.keys() 158 names = needed.keys()
159 159
160 # this nexe has 5 dependancies 160 # this nexe has 5 dependencies
161 expected = set(self.dyn_deps) 161 expected = set(self.dyn_deps)
162 expected.add(os.path.basename(self.dyn_nexe)) 162 expected.add(os.path.basename(self.dyn_nexe))
163 163
164 basenames = set(self.StripDependencies(names)) 164 basenames = set(self.StripDependencies(names))
165 self.assertEqual(expected, basenames) 165 self.assertEqual(expected, basenames)
166 166
167 def testStageDependencies(self): 167 def testStageDependencies(self):
168 self.Mktemp() 168 self.Mktemp()
169 nmf = self.CreateNmfUtils() 169 nmf = self.CreateNmfUtils()
170 170
171 # Stage dependancies 171 # Stage dependencies
172 nmf.StageDependencies(self.tempdir) 172 nmf.StageDependencies(self.tempdir)
173 173
174 # Verify directory contents 174 # Verify directory contents
175 contents = set(os.listdir(self.tempdir)) 175 contents = set(os.listdir(self.tempdir))
176 expectedContents = set((os.path.basename(self.dyn_nexe), 'lib32')) 176 expectedContents = set((os.path.basename(self.dyn_nexe), 'lib32'))
177 self.assertEqual(contents, expectedContents) 177 self.assertEqual(contents, expectedContents)
178 178
179 contents = os.listdir(os.path.join(self.tempdir, 'lib32')) 179 contents = os.listdir(os.path.join(self.tempdir, 'lib32'))
180 contents = self.StripDependencies(contents) 180 contents = self.StripDependencies(contents)
181 contents = set(contents) 181 contents = set(contents)
182 expectedContents = self.dyn_deps 182 expectedContents = self.dyn_deps
183 self.assertEqual(contents, expectedContents) 183 self.assertEqual(contents, expectedContents)
184 184
185 185
186 if __name__ == '__main__': 186 if __name__ == '__main__':
187 unittest.main() 187 unittest.main()
OLDNEW
« no previous file with comments | « native_client_sdk/src/tools/oshelpers.py ('k') | native_client_sdk/src/tools/tests/getos_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698