firmware_WilcoDiagnosticsMode: Correcting diagnostics image path

cbfs_extract function expects absolute file path for the argument local_filename.
When this function is called from  cbfs_extract_diagnostics, file path is
incorrect and this results in consistent test failure. Function call
updated with proper file path.

BUG=b:171019377
TEST=Ran the test with modified scripts. Test is running & passing.

Change-Id: I3b9ce6d4fbfd498d3002ba837716ffb6819ece2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2494210
Tested-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Auto-Submit: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Reviewed-by: Greg Edelston <gredelston@google.com>
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Commit-Queue: Greg Edelston <gredelston@google.com>
diff --git a/client/cros/faft/utils/firmware_updater.py b/client/cros/faft/utils/firmware_updater.py
index 2283867..9402e17 100644
--- a/client/cros/faft/utils/firmware_updater.py
+++ b/client/cros/faft/utils/firmware_updater.py
@@ -330,13 +330,12 @@
         # Resign and flash the AP firmware back to the system
         self.cbfs_sign_and_flash()
 
-    def corrupt_diagnostics_image(self, local_filename):
+    def corrupt_diagnostics_image(self, local_path):
         """Corrupts a diagnostics image in the CBFS working directory.
 
-        @param local_filename: Filename for storing the diagnostics image in the
+        @param local_path: Filename for storing the diagnostics image in the
             CBFS working directory
         """
-        local_path = os.path.join(self._cbfs_work_path, local_filename)
 
         # Invert the last few bytes of the image. Note that cbfstool will
         # silently ignore bytes added after the end of the ELF, and it will
@@ -673,16 +672,16 @@
 
         return results
 
-    def cbfs_extract_diagnostics(self, diag_name, local_filename):
+    def cbfs_extract_diagnostics(self, diag_name, local_path):
         """Runs cbfstool to extract a diagnostics image.
 
         @param diag_name: Name of the diagnostics image in CBFS
-        @param local_filename: Filename for storing the diagnostics image in the
+        @param local_path: Filename for storing the diagnostics image in the
             CBFS working directory
         """
         return self.cbfs_extract(diag_name,
                                  '', ['RW_LEGACY'],
-                                 local_filename,
+                                 local_path,
                                  arch='x86')
 
     def cbfs_get_chip_hash(self, fw_name, hash_extension='.hash'):
@@ -785,17 +784,17 @@
         self.cbfs_truncate(regions)
         return True
 
-    def cbfs_replace_diagnostics(self, diag_name, local_filename):
+    def cbfs_replace_diagnostics(self, diag_name, local_path):
         """Runs cbfstool to replace a diagnostics image in the firmware image.
 
         @param diag_name: Name of the diagnostics image in CBFS
-        @param local_filename: Filename for storing the diagnostics image in the
+        @param local_path: Filename for storing the diagnostics image in the
             CBFS working directory
         """
         regions = ['RW_LEGACY']
         self.cbfs_expand(regions)
         self.cbfs_remove(diag_name, '', regions)
-        self.cbfs_add(diag_name, '', regions, local_filename=local_filename)
+        self.cbfs_add(diag_name, '', regions, local_path)
         self.cbfs_truncate(regions)
 
     def cbfs_sign_and_flash(self):
diff --git a/server/site_tests/firmware_WilcoDiagnosticsMode/firmware_WilcoDiagnosticsMode.py b/server/site_tests/firmware_WilcoDiagnosticsMode/firmware_WilcoDiagnosticsMode.py
index a43f015..f6aa33e 100644
--- a/server/site_tests/firmware_WilcoDiagnosticsMode/firmware_WilcoDiagnosticsMode.py
+++ b/server/site_tests/firmware_WilcoDiagnosticsMode/firmware_WilcoDiagnosticsMode.py
@@ -61,14 +61,14 @@
 
         logging.info('Extracting diagnostics')
         self.faft_client.updater.cbfs_extract_diagnostics(self.DIAG_CBFS_NAME,
-                local_filename)
+                diag_cbfs_path)
 
         logging.info('Corrupting diagnostics')
-        self.faft_client.updater.corrupt_diagnostics_image(local_filename)
+        self.faft_client.updater.corrupt_diagnostics_image(diag_cbfs_path)
 
         logging.info('Replacing diagnostics')
         self.faft_client.updater.cbfs_replace_diagnostics(self.DIAG_CBFS_NAME,
-                local_filename)
+                diag_cbfs_path)
 
         logging.info('Writing back BIOS')
         self.faft_client.bios.write_whole(bios_cbfs_path)