Title: [284398] trunk/Tools
Revision
284398
Author
jbed...@apple.com
Date
2021-10-18 13:51:23 -0700 (Mon, 18 Oct 2021)

Log Message

[run-api-tests] Use temporary symlink when listing tests
https://bugs.webkit.org/show_bug.cgi?id=230560

Reviewed by Dewei Zhu.

* Scripts/webkitpy/api_tests/manager.py:
(Manager._collect_tests): Copy binary when listing tests to make debuging easier.
* Scripts/webkitpy/common/system/filesystem.py:
(FileSystem.copyfile): Return copyfile result.
(FileSystem.copymode): Invoke shutil.copymode.
* Scripts/webkitpy/common/system/filesystem_mock.py:
(MockFileSystem.copymode):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (284397 => 284398)


--- trunk/Tools/ChangeLog	2021-10-18 20:50:56 UTC (rev 284397)
+++ trunk/Tools/ChangeLog	2021-10-18 20:51:23 UTC (rev 284398)
@@ -1,3 +1,18 @@
+2021-10-18  Jonathan Bedard  <jbed...@apple.com>
+
+        [run-api-tests] Use temporary symlink when listing tests
+        https://bugs.webkit.org/show_bug.cgi?id=230560
+
+        Reviewed by Dewei Zhu.
+
+        * Scripts/webkitpy/api_tests/manager.py:
+        (Manager._collect_tests): Copy binary when listing tests to make debuging easier.
+        * Scripts/webkitpy/common/system/filesystem.py:
+        (FileSystem.copyfile): Return copyfile result.
+        (FileSystem.copymode): Invoke shutil.copymode.
+        * Scripts/webkitpy/common/system/filesystem_mock.py:
+        (MockFileSystem.copymode):
+
 2021-10-18  Andres Gonzalez  <andresg...@apple.com>
 
         Set isolated tree mode to secondary AX thread in LayoutTests.

Modified: trunk/Tools/Scripts/webkitpy/api_tests/manager.py (284397 => 284398)


--- trunk/Tools/Scripts/webkitpy/api_tests/manager.py	2021-10-18 20:50:56 UTC (rev 284397)
+++ trunk/Tools/Scripts/webkitpy/api_tests/manager.py	2021-10-18 20:51:23 UTC (rev 284398)
@@ -105,14 +105,20 @@
         for canonicalized_binary, path in self._port.path_to_api_test_binaries().items():
             if canonicalized_binary not in specified_binaries:
                 continue
+
+            to_be_listed = self.host.filesystem.join(self.host.filesystem.dirname(path), 'ToBeListed')
             try:
+                self.host.filesystem.copyfile(path, to_be_listed)
+                self.host.filesystem.copymode(path, to_be_listed)
                 output = self.host.executive.run_command(
-                    Runner.command_for_port(self._port, [path, '--gtest_list_tests']),
+                    Runner.command_for_port(self._port, [to_be_listed, '--gtest_list_tests']),
                     env=self._port.environment_for_api_tests())
                 available_tests += Manager._test_list_from_output(output, '{}.'.format(canonicalized_binary))
             except ScriptError:
                 _log.error('Failed to list {} tests'.format(canonicalized_binary))
                 raise
+            finally:
+                self.host.filesystem.remove(to_be_listed)
 
         if len(args) == 0:
             return sorted(available_tests)

Modified: trunk/Tools/Scripts/webkitpy/common/system/filesystem.py (284397 => 284398)


--- trunk/Tools/Scripts/webkitpy/common/system/filesystem.py	2021-10-18 20:50:56 UTC (rev 284397)
+++ trunk/Tools/Scripts/webkitpy/common/system/filesystem.py	2021-10-18 20:51:23 UTC (rev 284398)
@@ -80,8 +80,11 @@
         return os.chdir(path)
 
     def copyfile(self, source, destination):
-        shutil.copyfile(source, destination)
+        return shutil.copyfile(source, destination)
 
+    def copymode(self, source, destination):
+        return shutil.copymode(source, destination)
+
     def dirname(self, path):
         return os.path.dirname(path)
 

Modified: trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py (284397 => 284398)


--- trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py	2021-10-18 20:50:56 UTC (rev 284397)
+++ trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py	2021-10-18 20:51:23 UTC (rev 284398)
@@ -115,6 +115,9 @@
         self.files[destination] = self.files[source]
         self.written_files[destination] = self.files[source]
 
+    def copymode(self, source, destination):
+        pass
+
     def dirname(self, path):
         return self._split(path)[0]
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to