- Tools/ChangeLog +27 lines
Lines 1-3 Tools/ChangeLog_sec1
1
2016-03-31  Daniel Bates  <dabates@apple.com>
2
3
        run-webkit-tests fails to create user's cache directory when System Integrity Protection is enabled
4
        https://bugs.webkit.org/show_bug.cgi?id=156071
5
        <rdar://problem/25467827>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Fixes an issue where run-webkit-tests will fail to create the suffixed user's cache directory
10
        on non-Apple Internal machines with System Integrity Protection enabled because the OS only
11
        honors the suffix, specified by the environment variable DIRHELPER_USER_DIR_SUFFIX, in
12
        privileged processes. And python(1) does not have sufficient privileges. As a workaround for
13
        systems that have System Integrity Protection enabled we compute the path to the suffixed
14
        user's cache directory by hand.
15
16
        Additionally, fix an issue where the user's cache directory created by run-webkit-test was
17
        never deleted on cessation of the test run.
18
19
        * Scripts/webkitpy/port/driver.py:
20
        (Driver._start): Actually store the path to the user's cache directory in self._driver_user_cache_directory
21
        so that we can delete this directory on cessation of the test run.
22
        * Scripts/webkitpy/port/mac.py:
23
        (MacPort):
24
        (MacPort._path_to_user_cache_directory): Unset the environment variable DIRHELPER_USER_DIR_SUFFIX (if set),
25
        query the OS for the path to the user's cache directory and concatenate this path with the
26
        specified suffix.
27
1
2016-03-30  Dewei Zhu  <dewei_zhu@apple.com>
28
2016-03-30  Dewei Zhu  <dewei_zhu@apple.com>
2
29
3
        Extend animometer timeout for slow CPUs.
30
        Extend animometer timeout for slow CPUs.
- Tools/Scripts/webkitpy/port/driver.py -1 / +2 lines
Lines 350-356 class Driver(object): Tools/Scripts/webkitpy/port/driver.py_sec1
350
        self._driver_user_directory_suffix = os.path.basename(str(self._driver_tempdir))
350
        self._driver_user_directory_suffix = os.path.basename(str(self._driver_tempdir))
351
        user_cache_directory = self._port._path_to_user_cache_directory(self._driver_user_directory_suffix)
351
        user_cache_directory = self._port._path_to_user_cache_directory(self._driver_user_directory_suffix)
352
        if user_cache_directory:
352
        if user_cache_directory:
353
            self._driver_user_cache_directory = self._port._filesystem.maybe_make_directory(user_cache_directory)
353
            self._port._filesystem.maybe_make_directory(user_cache_directory)
354
            self._driver_user_cache_directory = user_cache_directory
354
        server_name = self._port.driver_name()
355
        server_name = self._port.driver_name()
355
        environment = self._port.setup_environ_for_server(server_name)
356
        environment = self._port.setup_environ_for_server(server_name)
356
        environment = self._setup_environ_for_driver(environment)
357
        environment = self._setup_environ_for_driver(environment)
- Tools/Scripts/webkitpy/port/mac.py -5 / +12 lines
Lines 118-129 class MacPort(ApplePort): Tools/Scripts/webkitpy/port/mac.py_sec1
118
        self._filesystem.rmtree(os.path.expanduser('~/Library/WebKit/' + self.driver_name()))
118
        self._filesystem.rmtree(os.path.expanduser('~/Library/WebKit/' + self.driver_name()))
119
119
120
    def _path_to_user_cache_directory(self, suffix=None):
120
    def _path_to_user_cache_directory(self, suffix=None):
121
        DIRHELPER_USER_DIR_SUFFIX = "DIRHELPER_USER_DIR_SUFFIX"
121
        DIRHELPER_USER_DIR_SUFFIX = 'DIRHELPER_USER_DIR_SUFFIX'
122
        CS_DARWIN_USER_CACHE_DIR = 65538
123
124
        # The environment variable DIRHELPER_USER_DIR_SUFFIX is only honored on systems with
125
        # System Integrity Protection disabled or with an Apple-Internal OS. To make this code
126
        # work for all system configurations we compute the path with respect to the suffix
127
        # by hand and temporarily unset the environment variable DIRHELPER_USER_DIR_SUFFIX (if set)
128
        # to avoid it influencing confstr() on systems that honor DIRHELPER_USER_DIR_SUFFIX.
122
        saved_suffix = None
129
        saved_suffix = None
123
        if suffix is not None:
130
        if DIRHELPER_USER_DIR_SUFFIX in os.environ:
124
            saved_suffix = os.environ.get(DIRHELPER_USER_DIR_SUFFIX)
131
            saved_suffix = os.environ[DIRHELPER_USER_DIR_SUFFIX]
125
            os.environ[DIRHELPER_USER_DIR_SUFFIX] = suffix
132
            del os.environ[DIRHELPER_USER_DIR_SUFFIX]
126
        result = os.confstr(65538)  # _CS_DARWIN_USER_CACHE_DIR
133
        result = os.path.join(os.confstr(CS_DARWIN_USER_CACHE_DIR), suffix or '')
127
        if saved_suffix is not None:
134
        if saved_suffix is not None:
128
            os.environ[DIRHELPER_USER_DIR_SUFFIX] = saved_suffix
135
            os.environ[DIRHELPER_USER_DIR_SUFFIX] = saved_suffix
129
        return result
136
        return result

Return to Bug 156071