crosperf: Fix index incrementing

Increment a file index when copying multiple files.
This fixes the issue when multiple perf.data files are copied from
the system_health.memory_desktop benchmark with profiling.

BUG=None
TEST=crosperf with system_health.memory_desktop and profiling enabled.

Change-Id: I7d00ec23a4fa595d6cd0df8fcc8b64cf7181f5dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2622963
Tested-by: Denis Nikitin <denik@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py
index c5c8594..3342f93 100644
--- a/crosperf/results_cache.py
+++ b/crosperf/results_cache.py
@@ -129,6 +129,7 @@
       ret = self.ce.CopyFiles(file_to_copy, dest_file, recursive=False)
       if ret:
         raise IOError('Could not copy results file: %s' % file_to_copy)
+      file_index += 1
 
   def CopyResultsTo(self, dest_dir):
     self.CopyFilesTo(dest_dir, self.results_file)
diff --git a/crosperf/results_cache_unittest.py b/crosperf/results_cache_unittest.py
index 91ceed2..e2730e5 100755
--- a/crosperf/results_cache_unittest.py
+++ b/crosperf/results_cache_unittest.py
@@ -523,8 +523,8 @@
     second_args = mock_copyfiles.call_args_list[1][0]
     third_args = mock_copyfiles.call_args_list[2][0]
     self.assertEqual(first_args, ('src_file_1', '/tmp/test/src_file_1.0'))
-    self.assertEqual(second_args, ('src_file_2', '/tmp/test/src_file_2.0'))
-    self.assertEqual(third_args, ('src_file_3', '/tmp/test/src_file_3.0'))
+    self.assertEqual(second_args, ('src_file_2', '/tmp/test/src_file_2.1'))
+    self.assertEqual(third_args, ('src_file_3', '/tmp/test/src_file_3.2'))
 
     mock_runcmd.reset_mock()
     mock_copyfiles.reset_mock()