Deprecate --mozc_root_dir option in run_android_test.py
That option has never been used.
This is just an internal clean-up. No behavior change in production is intended.
BUG=none
TEST=compile
git-svn-id: https://mozc.googlecode.com/svn/trunk@436 a6090854-d499-a067-5803-1114d4e51264
Tsuyoshi Matsuzaki authored 9 years ago
Yohei Yukawa committed 9 years ago
37 | 37 | |
38 | 38 | __author__ = "hidehiko" |
39 | 39 | |
40 | from build_tools.test_tools import gtest_report | |
41 | from build_tools import android_util | |
42 | 40 | import errno |
43 | 41 | import logging |
44 | 42 | import multiprocessing |
45 | 43 | import optparse |
46 | 44 | import os |
47 | 45 | import subprocess |
48 | import sys | |
49 | 46 | import time |
50 | 47 | from xml.etree import cElementTree as ElementTree |
48 | from build_tools import android_util | |
49 | from build_tools.test_tools import gtest_report | |
51 | 50 | |
52 | 51 | |
53 | 52 | def FindTestBinaries(test_dir): |
68 | 67 | def ParseArgs(): |
69 | 68 | """Parses command line options and returns them.""" |
70 | 69 | parser = optparse.OptionParser() |
71 | # Assume the parent directory is the Mozc root directory. | |
72 | program_dir = os.path.dirname(sys.argv[0]) | |
73 | parent_dir = os.path.join(*os.path.split(program_dir)[:-1]) or '..' | |
74 | 70 | parser.add_option('--run_java_test', dest='run_java_test', default=False, |
75 | 71 | action='store_true', |
76 | 72 | help='Runs JUnit tests. [JAVA] options are used.') |
91 | 87 | default='org.mozc.android.inputmethod.japanese', |
92 | 88 | help='[JAVA] Testee project\'s package name. ' |
93 | 89 | 'This is used to find test reporting XML file.') |
94 | parser.add_option('--mozc_root_dir', dest='mozc_root_dir', default=parent_dir, | |
95 | help='[NATIVE] The root directory of Mozc project') | |
96 | 90 | parser.add_option('--remote_dir', dest='remote_dir', |
97 | 91 | default='/sdcard/mozctest', |
98 | 92 | help='[NATIVE] Working directory on ' |
111 | 105 | help='[JAVA][NATIVE] ABI of built test executables.') |
112 | 106 | parser.add_option('--mozc_dictionary_data_file', |
113 | 107 | dest='mozc_dictionary_data_file', default=None, |
114 | help='[NATIVE] The relative path from mozc_root_dir to ' | |
115 | 'the system.dictionary file.') | |
108 | help='[NATIVE] Path to system.dictionary file.') | |
116 | 109 | parser.add_option('--mozc_connection_data_file', |
117 | 110 | dest='mozc_connection_data_file', default=None, |
118 | help='[NATIVE] The relative path from mozc_root_dir to ' | |
119 | 'the connection.data file.') | |
111 | help='[NATIVE] Path to connection.data file.') | |
120 | 112 | parser.add_option('--mozc_connection_text_data_file', |
121 | 113 | dest='mozc_connection_text_data_file', default=None, |
122 | help='[NATIVE] The relative path from mozc_root_dir to ' | |
123 | 'the connection_single_column.txt file.') | |
114 | help='[NATIVE] Path to connection_single_column.txt file.') | |
124 | 115 | parser.add_option('--mozc_test_connection_data_file', |
125 | 116 | dest='mozc_test_connection_data_file', default=None, |
126 | help='[NATIVE] The relative path from mozc_root_dir to ' | |
127 | 'the test_connection.data file.') | |
117 | help='[NATIVE] Path to test_connection.data file.') | |
128 | 118 | parser.add_option('--mozc_test_connection_text_data_file', |
129 | 119 | dest='mozc_test_connection_text_data_file', default=None, |
130 | help='[NATIVE] The relative path from mozc_root_dir to ' | |
131 | 'the connection_single_column.txt file.') | |
120 | help='[NATIVE] Path to connection_single_column.txt file.') | |
132 | 121 | parser.add_option('--mozc_data_dir', |
133 | 122 | dest='mozc_data_dir', default=None, |
134 | help='[NATIVE] The relative path from mozc_root_dir to ' | |
135 | 'the data directory.') | |
123 | help='[NATIVE] Path to data directory.') | |
136 | 124 | parser.add_option('--output_report_dir', dest='output_report_dir', |
137 | 125 | default=None, |
138 | 126 | help='[JAVA][NATIVE] Path to output gtest ' |
287 | 275 | if remote_report_path: |
288 | 276 | self._RunCommand('rm', remote_report_path) |
289 | 277 | |
290 | def SetUpTest(self, device, mount_point, host_dir, remote_dir, | |
278 | def SetUpTest(self, device, mount_point, remote_dir, | |
291 | 279 | dictionary_data, connection_data, connection_text_data, |
292 | 280 | test_connection_data, test_connection_text_data, |
293 | 281 | mozc_data_dir): |
303 | 291 | # data is set at jni loading time, but it is necessary to somehow |
304 | 292 | # set the data in native tests. So, copy the dictionary data to the |
305 | 293 | # emulator. |
306 | self.CopyFile(host_path=os.path.join(host_dir, dictionary_data), | |
294 | self.CopyFile(host_path=dictionary_data, | |
307 | 295 | remote_path=os.path.join(remote_dir, |
308 | 296 | 'embedded_data', 'dictionary_data'), |
309 | 297 | operation='push') |
310 | self.CopyFile(host_path=os.path.join(host_dir, connection_data), | |
298 | self.CopyFile(host_path=connection_data, | |
311 | 299 | remote_path=os.path.join(remote_dir, |
312 | 300 | 'embedded_data', 'connection_data'), |
313 | 301 | operation='push') |
314 | self.CopyFile(host_path=os.path.join(host_dir, connection_text_data), | |
302 | self.CopyFile(host_path=connection_text_data, | |
315 | 303 | remote_path=os.path.join(remote_dir, |
316 | 304 | 'data_manager', 'android', |
317 | 305 | 'connection_single_column.txt'), |
318 | 306 | operation='push') |
319 | self.CopyFile(host_path=os.path.join(host_dir, test_connection_data), | |
307 | self.CopyFile(host_path=test_connection_data, | |
320 | 308 | remote_path=os.path.join(remote_dir, |
321 | 309 | 'data_manager', 'testing', |
322 | 310 | 'connection_data.data'), |
323 | 311 | operation='push') |
324 | self.CopyFile(host_path=os.path.join(host_dir, test_connection_text_data), | |
312 | self.CopyFile(host_path=test_connection_text_data, | |
325 | 313 | remote_path=os.path.join(remote_dir, |
326 | 314 | 'data_manager', 'testing', |
327 | 315 | 'connection_single_column.txt'), |
330 | 318 | # We want only test data and they are in mozc_data_dir/data. |
331 | 319 | # TODO(matsuzakit): Split generated .h files and test data |
332 | 320 | # into separate directories. |
333 | self.CopyFile(host_path=os.path.join(host_dir, mozc_data_dir, 'data'), | |
321 | self.CopyFile(host_path=os.path.join(mozc_data_dir, 'data'), | |
334 | 322 | remote_path=os.path.join(remote_dir, 'data'), |
335 | 323 | operation='push') |
336 | 324 | |
349 | 337 | try: |
350 | 338 | error_messages = [] |
351 | 339 | self.SetUpTest(options.remote_device, options.remote_mount_point, |
352 | options.mozc_root_dir, options.remote_dir, | |
340 | options.remote_dir, | |
353 | 341 | options.mozc_dictionary_data_file, |
354 | 342 | options.mozc_connection_data_file, |
355 | 343 | options.mozc_connection_text_data_file, |