servo: create unique names during scp

BUG=chromium:1034037
TEST=run on bobba

Change-Id: Ie2dbdc79d73dd2a4d14d3ab5e81bc76a48a40bb0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1967856
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Dana Goyette <dgoyette@chromium.org>
Commit-Queue: Mary Ruthven <mruthven@chromium.org>
diff --git a/server/cros/servo/servo.py b/server/cros/servo/servo.py
index a2da497..1be3fed 100644
--- a/server/cros/servo/servo.py
+++ b/server/cros/servo/servo.py
@@ -8,8 +8,10 @@
 import ast
 import logging
 import os
+import random
 import re
 import socket
+import string
 import time
 import xmlrpclib
 
@@ -975,14 +977,19 @@
         When programming a firmware image on the DUT, the image must be
         located on the host to which the servo device is connected. Sometimes
         servo is controlled by a remote host, in this case the image needs to
-        be transferred to the remote host.
+        be transferred to the remote host. This adds a random extension to
+        prevent multiple tests from copying a image to the same location on
+        the remote host.
 
         @param image_path: a string, name of the firmware image file to be
                transferred.
         @return: a string, full path name of the copied file on the remote.
         """
-
-        dest_path = os.path.join('/tmp', os.path.basename(image_path))
+        name = os.path.basename(image_path)
+        ext = ''.join([random.choice(string.ascii_letters) for i in xrange(10)])
+        remote_name = name + '.' + ext
+        dest_path = os.path.join('/tmp', remote_name)
+        logging.info('Copying %s to %s', name, dest_path)
         self._servo_host.send_file(image_path, dest_path)
         return dest_path