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

Side by Side Diff: native_client_sdk/src/tools/lib/tests/get_shared_deps_test.py

Issue 237883002: Remove dependency of NaCl untarred toolchain from NaCl SDK Tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed alphabetized import order Created 6 years, 8 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 | « native_client_sdk/src/test_all.py ('k') | native_client_sdk/src/tools/tests/create_nmf_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 5
6 import os 6 import os
7 import shutil 7 import shutil
8 import subprocess 8 import subprocess
9 import sys 9 import sys
10 import tempfile 10 import tempfile
11 import unittest 11 import unittest
12 12
13 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 13 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
14 LIB_DIR = os.path.dirname(SCRIPT_DIR) 14 LIB_DIR = os.path.dirname(SCRIPT_DIR)
15 TOOLS_DIR = os.path.dirname(LIB_DIR) 15 TOOLS_DIR = os.path.dirname(LIB_DIR)
16 DATA_DIR = os.path.join(SCRIPT_DIR, 'data') 16 DATA_DIR = os.path.join(SCRIPT_DIR, 'data')
17 CHROME_SRC = os.path.dirname(os.path.dirname(os.path.dirname(TOOLS_DIR)))
18 17
19 sys.path.append(LIB_DIR) 18 sys.path.append(LIB_DIR)
20 sys.path.append(TOOLS_DIR) 19 sys.path.append(TOOLS_DIR)
21 20
22 import getos 21 import build_paths
23 import get_shared_deps 22 import get_shared_deps
24 23
24 TOOLCHAIN_OUT = os.path.join(build_paths.OUT_DIR, 'sdk_tests', 'toolchain')
25 NACL_X86_GLIBC_TOOLCHAIN = os.path.join(TOOLCHAIN_OUT, 'nacl_x86_glibc')
26
25 27
26 def StripDependencies(deps): 28 def StripDependencies(deps):
27 '''Strip the dirnames and version suffixes from 29 '''Strip the dirnames and version suffixes from
28 a list of nexe dependencies. 30 a list of nexe dependencies.
29 31
30 e.g: 32 e.g:
31 /path/to/libpthread.so.1a2d3fsa -> libpthread.so 33 /path/to/libpthread.so.1a2d3fsa -> libpthread.so
32 ''' 34 '''
33 names = [] 35 names = []
34 for name in deps: 36 for name in deps:
35 name = os.path.basename(name) 37 name = os.path.basename(name)
36 if '.so.' in name: 38 if '.so.' in name:
37 name = name.rsplit('.', 1)[0] 39 name = name.rsplit('.', 1)[0]
38 names.append(name) 40 names.append(name)
39 return names 41 return names
40 42
41 43
42 class TestGetNeeded(unittest.TestCase): 44 class TestGetNeeded(unittest.TestCase):
43 def setUp(self): 45 def setUp(self):
44 self.tempdir = None 46 self.tempdir = None
45 toolchain = os.path.join(CHROME_SRC, 'native_client', 'toolchain') 47 self.toolchain = NACL_X86_GLIBC_TOOLCHAIN
46 self.toolchain = os.path.join(toolchain, '%s_x86' % getos.GetPlatform(),
47 'nacl_x86_glibc')
48 self.objdump = os.path.join(self.toolchain, 'bin', 'i686-nacl-objdump') 48 self.objdump = os.path.join(self.toolchain, 'bin', 'i686-nacl-objdump')
49 if os.name == 'nt': 49 if os.name == 'nt':
50 self.objdump += '.exe' 50 self.objdump += '.exe'
51 self.Mktemp() 51 self.Mktemp()
52 self.dyn_nexe = self.createTestNexe('test_dynamic_x86_32.nexe', 'i686') 52 self.dyn_nexe = self.createTestNexe('test_dynamic_x86_32.nexe', 'i686')
53 self.dyn_deps = set(['libc.so', 'runnable-ld.so', 53 self.dyn_deps = set(['libc.so', 'runnable-ld.so',
54 'libgcc_s.so', 'libpthread.so']) 54 'libgcc_s.so', 'libpthread.so'])
55 55
56 def tearDown(self): 56 def tearDown(self):
57 if self.tempdir: 57 if self.tempdir:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 needed = get_shared_deps.GetNeeded([self.dyn_nexe], 128 needed = get_shared_deps.GetNeeded([self.dyn_nexe],
129 lib_path=lib_path, 129 lib_path=lib_path,
130 objdump=self.objdump) 130 objdump=self.objdump)
131 for arch in needed.itervalues(): 131 for arch in needed.itervalues():
132 self.assertEqual(arch, 'x86-32') 132 self.assertEqual(arch, 'x86-32')
133 133
134 134
135 if __name__ == '__main__': 135 if __name__ == '__main__':
136 unittest.main() 136 unittest.main()
OLDNEW
« no previous file with comments | « native_client_sdk/src/test_all.py ('k') | native_client_sdk/src/tools/tests/create_nmf_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698