1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-29 17:00:58 +01:00

[Wilds] Stop writing temporary files for linter tests

Summary:
Ref T13209. See some discussion in T13209#241713.

There's a bug here where `0644` (a numeric literal written in octal) should be `'0644'` (a string literal). This caused the `TempFile` to fail to `unlink()` on Windows.

But with `ArcanistWorkingCopyPath` we don't have to write an actual file to disk at all, so just don't. Maybe we'll start doing this some of the time later on (e.g., to make it easier to test third-party linters which do not have a "read from stdin" mode), but ideally we shouldn't need to actually write to disk in order to test that linters work, at least in most cases.

Also fix the octal bug itself.

Test Plan: Under Windows, more tests pass and there's no more `unlink()` permissions error.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13209

Differential Revision: https://secure.phabricator.com/D19728
This commit is contained in:
epriestley 2018-10-02 10:47:00 -07:00
parent 0140a0e990
commit fa27ad761a

View file

@ -87,14 +87,8 @@ abstract class ArcanistLinterTestCase extends PhutilTestCase {
$caught_exception = false; $caught_exception = false;
try { try {
$tmp = new TempFile($basename); $mode = idx($config, 'mode', '0644');
Filesystem::writeFile($tmp, $data); $mode = octdec($mode);
$full_path = (string)$tmp;
$mode = idx($config, 'mode', 0644);
if ($mode) {
Filesystem::changePermissions($tmp, octdec($mode));
}
$path_name = idx($config, 'path', $basename); $path_name = idx($config, 'path', $basename);