Bug 248304 - [webkitpy] REGRESSION(250550@main): GitTest.test_rename_files & GitTest.test_create_patch_with_git_index
Summary: [webkitpy] REGRESSION(250550@main): GitTest.test_rename_files & GitTest.test_...
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-11-24 04:31 PST by Sam Sneddon [:gsnedders]
Modified: 2024-05-10 13:02 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Sneddon [:gsnedders] 2022-11-24 04:31:55 PST
As of commit 9fb799e7c5567af8bba18ec5c8be92e028d8d3ff (250550@main), bug 240256, we get:

____________________________________________________ GitTest.test_create_patch_with_git_index ____________________________________________________

self = <webkitpy.common.checkout.scm.scm_unittest.GitTest testMethod=test_create_patch_with_git_index>

    def test_create_patch_with_git_index(self):
        # First change. Committed.
        write_into_file_at_path('test_file_commit1', 'first cat')
        run_command(['git', 'add', 'test_file_commit1'])
        scm = self.tracking_scm
        scm.commit_locally_with_message('message')
    
        # Second change. Staged but not committed.
        write_into_file_at_path('test_file_commit1', 'second dog')
        run_command(['git', 'add', 'test_file_commit1'])
    
        # Third change. Not even staged.
        write_into_file_at_path('test_file_commit1', 'third unicorn')
    
>       patch = scm.create_patch(None, None, True)

common/checkout/scm/scm_unittest.py:1105: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
common/checkout/scm/git.py:378: in create_patch
    return self.run(command, decode_output=False, cwd=self.checkout_root)
common/checkout/scm/scm.py:73: in run
    return self._executive.run_command(args,
common/system/executive.py:445: in run_command
    (error_handler or self.default_error_handler)(script_error)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

error = ScriptError('Failed to run "[\'git\', \'format-patch\', \'--stdout\', \'--binary\', \'-O\', \'/Volumes/gsnedders/proje...-cached\']" exit_code: 128 cwd: /private/var/folders/9f/mkrrck9s5kjg6_vlds37v0g40000gn/T/tmpy7784jn_git_test_checkout')

    @staticmethod
    def default_error_handler(error):
>       raise error
E       webkitpy.common.system.executive.ScriptError: Failed to run "['git', 'format-patch', '--stdout', '--binary', '-O', '/Volumes/gsnedders/projects/Safari-LayoutTestFinder/OpenSource/Tools/Scripts/webkitpy/common/config/orderfile', '--cached']" exit_code: 128 cwd: /private/var/folders/9f/mkrrck9s5kjg6_vlds37v0g40000gn/T/tmpy7784jn_git_test_checkout

common/system/abstractexecutive.py:98: ScriptError
___________________________________________________________ GitTest.test_rename_files ____________________________________________________________

self = <webkitpy.common.checkout.scm.scm_unittest.GitTest testMethod=test_rename_files>

    def test_rename_files(self):
        scm = self.tracking_scm
    
        run_command(['git', 'mv', 'foo_file', 'bar_file'])
        scm.commit_locally_with_message('message')
    
        patch = scm.create_patch()
>       self.assertNotRegexpMatches(patch, b'rename from ')
E       AssertionError: Regex matched: b'rename from ' matches b'rename from ' in b'From ab3c2736e533b78eb094fb91ee26cf72560d0354 Mon Sep 17 00:00:00 2001\nFrom: scm_unittest <scm_unittest@example.com>\nDate: Thu, 24 Nov 2022 12:30:17 +0000\nSubject: [PATCH] message\n\n---\n foo_file => bar_file | 0\n 1 file changed, 0 insertions(+), 0 deletions(-)\n rename foo_file => bar_file (100%)\n\ndiff --git a/foo_file b/bar_file\nsimilarity index 100%\nrename from foo_file\nrename to bar_file\n-- \n2.37.1 (Apple Git-137.1)\n\n'

common/checkout/scm/scm_unittest.py:1191: AssertionError
Comment 1 Radar WebKit Bug Importer 2022-12-01 04:32:17 PST
<rdar://problem/102855556>
Comment 2 Jonathan Bedard 2024-04-05 16:49:59 PDT
I think this is the same bug reported in https://bugs.webkit.org/show_bug.cgi?id=268060, although I am unable to reproduce the issue.
Comment 3 Sam Sneddon [:gsnedders] 2024-04-06 15:49:07 PDT
This still repros; they were just gardened in 257437@main.

```
tox -e py39 -- -k 'test_create_patch_with_git_index or test_rename_files' --run-slow --runxfail common/checkout/scm 
py311: commands[0]> pytest -k 'test_create_patch_with_git_index or test_rename_files' --run-slow --runxfail common/checkout/scm
```

gives the same failures.
Comment 4 Jonathan Bedard 2024-05-10 13:02:42 PDT
I've started to take a look at this. We really need to unwind much of webkit-patch. There are a number of actions it owns which no longer make sense. I'm not sure if that unwinding will fix this. but it will likely fix a few other broken tests.