Ver código fonte

Print the SHA of files downloaded from GS

Bug: angleproject:4621
Change-Id: I85aefeeffa05712a63a62e9acef8df27b1933e34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2190862
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Yuly Novikov 5 anos atrás
pai
commit
64dab2dbab

+ 2 - 1
download_from_google_storage.py

@@ -284,7 +284,8 @@ def _downloader_worker_thread(thread_num, q, force, base_url,
       continue
       continue
     # Fetch the file.
     # Fetch the file.
     if verbose:
     if verbose:
-      out_q.put('%d> Downloading %s...' % (thread_num, output_filename))
+      out_q.put('%d> Downloading %s@%s...' %
+                (thread_num, output_filename, input_sha1_sum))
     try:
     try:
       if delete:
       if delete:
         os.remove(output_filename)  # Delete the file if it exists already.
         os.remove(output_filename)  # Delete the file if it exists already.

+ 6 - 8
tests/download_from_google_storage_unittest.py

@@ -262,13 +262,11 @@ class DownloadTests(unittest.TestCase):
             ('ls', input_filename)),
             ('ls', input_filename)),
         ('check_call',
         ('check_call',
             ('cp', input_filename, output_filename))]
             ('cp', input_filename, output_filename))]
+    sha1_hash = '7871c8e24da15bad8b0be2c36edc9dc77e37727f'
     if sys.platform != 'win32':
     if sys.platform != 'win32':
       expected_calls.append(
       expected_calls.append(
-          ('check_call',
-           ('stat',
-            'gs://sometesturl/7871c8e24da15bad8b0be2c36edc9dc77e37727f')))
-    expected_output = [
-        '0> Downloading %s...' % output_filename]
+          ('check_call', ('stat', 'gs://sometesturl/' + sha1_hash)))
+    expected_output = ['0> Downloading %s@%s...' % (output_filename, sha1_hash)]
     expected_ret_codes = []
     expected_ret_codes = []
     self.assertEqual(list(stdout_queue.queue), expected_output)
     self.assertEqual(list(stdout_queue.queue), expected_output)
     self.assertEqual(self.gsutil.history, expected_calls)
     self.assertEqual(self.gsutil.history, expected_calls)
@@ -313,8 +311,7 @@ class DownloadTests(unittest.TestCase):
           ('check_call',
           ('check_call',
            ('stat',
            ('stat',
             'gs://sometesturl/%s' % sha1_hash)))
             'gs://sometesturl/%s' % sha1_hash)))
-    expected_output = [
-        '0> Downloading %s...' % output_filename]
+    expected_output = ['0> Downloading %s@%s...' % (output_filename, sha1_hash)]
     expected_output.extend([
     expected_output.extend([
         '0> Extracting 3 entries from %s to %s' % (output_filename,
         '0> Extracting 3 entries from %s to %s' % (output_filename,
                                                    output_dirname)])
                                                    output_dirname)])
@@ -400,7 +397,8 @@ class DownloadTests(unittest.TestCase):
     self.assertTrue(q.empty())
     self.assertTrue(q.empty())
     msg = ('1> ERROR remote sha1 (%s) does not match expected sha1 (%s).' %
     msg = ('1> ERROR remote sha1 (%s) does not match expected sha1 (%s).' %
            ('8843d7f92416211de9ebb963ff4ce28125932878', sha1_hash))
            ('8843d7f92416211de9ebb963ff4ce28125932878', sha1_hash))
-    self.assertEqual(out_q.get(), '1> Downloading %s...' % output_filename)
+    self.assertEqual(out_q.get(),
+                     '1> Downloading %s@%s...' % (output_filename, sha1_hash))
     self.assertEqual(out_q.get(), msg)
     self.assertEqual(out_q.get(), msg)
     self.assertEqual(ret_codes.get(), (20, msg))
     self.assertEqual(ret_codes.get(), (20, msg))
     self.assertTrue(out_q.empty())
     self.assertTrue(out_q.empty())