[logging_CrashSender]: Don't hardcode autotest directory.
Not all platforms run autotest client code in /usr/local/autotest,
this updates crash_test.py so that it looks up the directory it
is running in on the DUT rather than hardcode in the path.
BUG=None.
TEST=test_that runs the test successfully on Moblab.
Change-Id: I1d512ffaec4e17079afb3e918ff7c364cb87a2fd
Reviewed-on: https://chromium-review.googlesource.com/213321
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
diff --git a/client/cros/crash_test.py b/client/cros/crash_test.py
index 77990b9..38c40fa 100644
--- a/client/cros/crash_test.py
+++ b/client/cros/crash_test.py
@@ -206,12 +206,13 @@
@param has_consent: True to indicate consent, False otherwise
"""
+ autotest_cros_dir = os.path.dirname(__file__)
if has_consent:
if os.path.isdir(constants.WHITELIST_DIR):
# Create policy file that enables metrics/consent.
- shutil.copy('/usr/local/autotest/cros/mock_metrics_on.policy',
+ shutil.copy('%s/mock_metrics_on.policy' % autotest_cros_dir,
constants.SIGNED_POLICY_FILE)
- shutil.copy('/usr/local/autotest/cros/mock_metrics_owner.key',
+ shutil.copy('%s/mock_metrics_owner.key' % autotest_cros_dir,
constants.OWNER_KEY_FILE)
# Create deprecated consent file. This is created *after* the
# policy file in order to avoid a race condition where chrome
@@ -227,9 +228,9 @@
else:
if os.path.isdir(constants.WHITELIST_DIR):
# Create policy file that disables metrics/consent.
- shutil.copy('/usr/local/autotest/cros/mock_metrics_off.policy',
+ shutil.copy('%s/mock_metrics_off.policy' % autotest_cros_dir,
constants.SIGNED_POLICY_FILE)
- shutil.copy('/usr/local/autotest/cros/mock_metrics_owner.key',
+ shutil.copy('%s/mock_metrics_owner.key' % autotest_cros_dir,
constants.OWNER_KEY_FILE)
# Remove deprecated consent file.
utils.system('rm -f "%s"' % (self._CONSENT_FILE))