| Index: build/android/pylib/instrumentation/test_jar.py
|
| diff --git a/build/android/pylib/instrumentation/test_jar.py b/build/android/pylib/instrumentation/test_jar.py
|
| index c81258f8aebecf6f8f5846ee8a2c9d0b80169823..d83d00a150e3178f29f4818eb9610b133798520c 100644
|
| --- a/build/android/pylib/instrumentation/test_jar.py
|
| +++ b/build/android/pylib/instrumentation/test_jar.py
|
| @@ -23,7 +23,7 @@ sys.path.insert(0,
|
| import unittest_util # pylint: disable=F0401
|
|
|
| # If you change the cached output of proguard, increment this number
|
| -PICKLE_FORMAT_VERSION = 2
|
| +PICKLE_FORMAT_VERSION = 3
|
|
|
|
|
| class TestJar(object):
|
| @@ -55,6 +55,16 @@ class TestJar(object):
|
| if not self._GetCachedProguardData():
|
| self._GetProguardData()
|
|
|
| + @staticmethod
|
| + def _CalculateMd5(path):
|
| + # TODO(jbudorick): Move MD5sum calculations out of here and
|
| + # AndroidCommands to their own module.
|
| + out = cmd_helper.GetCmdOutput(
|
| + [os.path.join(constants.GetOutDirectory(),
|
| + 'md5sum_bin_host'),
|
| + path])
|
| + return out
|
| +
|
| def _GetCachedProguardData(self):
|
| if (os.path.exists(self._pickled_proguard_name) and
|
| (os.path.getmtime(self._pickled_proguard_name) >
|
| @@ -64,7 +74,9 @@ class TestJar(object):
|
| try:
|
| with open(self._pickled_proguard_name, 'r') as r:
|
| d = pickle.loads(r.read())
|
| - if d['VERSION'] == PICKLE_FORMAT_VERSION:
|
| + jar_md5 = self._CalculateMd5(self._jar_path)
|
| + if (d['JAR_MD5SUM'] == jar_md5 and
|
| + d['VERSION'] == PICKLE_FORMAT_VERSION):
|
| self._test_methods = d['TEST_METHODS']
|
| return True
|
| except:
|
| @@ -182,7 +194,8 @@ class TestJar(object):
|
|
|
| logging.info('Storing proguard output to %s', self._pickled_proguard_name)
|
| d = {'VERSION': PICKLE_FORMAT_VERSION,
|
| - 'TEST_METHODS': self._test_methods}
|
| + 'TEST_METHODS': self._test_methods,
|
| + 'JAR_MD5SUM': self._CalculateMd5(self._jar_path)}
|
| with open(self._pickled_proguard_name, 'w') as f:
|
| f.write(pickle.dumps(d))
|
|
|
|
|