⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284791 in webkit


Ignore:
Timestamp:
Oct 25, 2021, 10:40:11 AM (5 years ago)
Author:
Jonathan Bedard
Message:

[webkitscmpy] Log based tests fail in different timezones
https://bugs.webkit.org/show_bug.cgi?id=232197
<rdar://problem/84615646>

Reviewed by Dewei Zhu.

Tests based on git log need to be timezone aware.

  • Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
  • Scripts/libraries/webkitscmpy/webkitscmpy/test/log_unittest.py:
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r284786 r284791  
     12021-10-25  Jonathan Bedard  <jbedard@apple.com>
     2
     3        [webkitscmpy] Log based tests fail in different timezones
     4        https://bugs.webkit.org/show_bug.cgi?id=232197
     5        <rdar://problem/84615646>
     6
     7        Reviewed by Dewei Zhu.
     8
     9        Tests based on `git log` need to be timezone aware.
     10
     11        * Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
     12        * Scripts/libraries/webkitscmpy/webkitscmpy/test/log_unittest.py:
     13
    1142021-10-25  Wenson Hsieh  <wenson_hsieh@apple.com>
    215
  • trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py

    r281412 r284791  
    2222
    2323import os
     24import time
    2425
    2526from datetime import datetime
     
    318319                '''commit d8bce26fa65c6fc8f39c17927abb77f69fab82fc
    319320Author:     Jonathan Bedard <jbedard@apple.com>
    320 AuthorDate: Sat Oct 03 03:46:40 2020 +0000
     321AuthorDate: {time_a}
    321322Commit:     Jonathan Bedard <jbedard@apple.com>
    322 CommitDate: Sat Oct 03 03:46:40 2020 +0000
     323CommitDate: {time_a}
    323324
    324325    Patch Series
     
    327328commit bae5d1e90999d4f916a8a15810ccfa43f37a2fd6
    328329Author:     Jonathan Bedard <jbedard@apple.com>
    329 AuthorDate: Sat Oct 03 03:46:40 2020 +0000
     330AuthorDate: {time_a}
    330331Commit:     Jonathan Bedard <jbedard@apple.com>
    331 CommitDate: Sat Oct 03 03:46:40 2020 +0000
     332CommitDate: {time_a}
    332333
    333334    8th commit
     
    336337commit 1abe25b443e985f93b90d830e4a7e3731336af4d
    337338Author:     Jonathan Bedard <jbedard@apple.com>
    338 AuthorDate: Sat Oct 03 02:23:20 2020 +0000
     339AuthorDate: {time_b}
    339340Commit:     Jonathan Bedard <jbedard@apple.com>
    340 CommitDate: Sat Oct 03 02:23:20 2020 +0000
     341CommitDate: {time_b}
    341342
    342343    4th commit
    343344    git-svn-id: https://svn.example.org/repository/repository/trunk@4 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    344 '''
    345             )
     345'''.format(
     346                time_a=datetime.utcfromtimestamp(1601668000 + time.timezone).strftime('%a %b %d %H:%M:%S %Y +0000'),
     347                time_b=datetime.utcfromtimestamp(1601663000 + time.timezone).strftime('%a %b %d %H:%M:%S %Y +0000'),
     348            ))
    346349
    347350    def test_branch_log(self):
     
    353356                '''commit 790725a6d79e28db2ecdde29548d2262c0bd059d
    354357Author:     Jonathan Bedard <jbedard@apple.com>
    355 AuthorDate: Sat Oct 03 03:30:00 2020 +0000
     358AuthorDate: {time_a}
    356359Commit:     Jonathan Bedard <jbedard@apple.com>
    357 CommitDate: Sat Oct 03 03:30:00 2020 +0000
     360CommitDate: {time_a}
    358361
    359362    7th commit
     
    362365commit 3cd32e352410565bb543821fbf856a6d3caad1c4
    363366Author:     Jonathan Bedard <jbedard@apple.com>
    364 AuthorDate: Sat Oct 03 02:40:00 2020 +0000
     367AuthorDate: {time_b}
    365368Commit:     Jonathan Bedard <jbedard@apple.com>
    366 CommitDate: Sat Oct 03 02:40:00 2020 +0000
     369CommitDate: {time_b}
    367370
    368371    5th commit
     
    373376commit a30ce8494bf1ac2807a69844f726be4a9843ca55
    374377Author:     Jonathan Bedard <jbedard@apple.com>
    375 AuthorDate: Sat Oct 03 02:06:40 2020 +0000
     378AuthorDate: {time_c}
    376379Commit:     Jonathan Bedard <jbedard@apple.com>
    377 CommitDate: Sat Oct 03 02:06:40 2020 +0000
     380CommitDate: {time_c}
    378381
    379382    3rd commit
    380383    git-svn-id: https://svn.example.org/repository/repository/trunk@3 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    381 '''
    382             )
     384'''.format(
     385                time_a=datetime.utcfromtimestamp(1601667000 + time.timezone).strftime('%a %b %d %H:%M:%S %Y +0000'),
     386                time_b=datetime.utcfromtimestamp(1601664000 + time.timezone).strftime('%a %b %d %H:%M:%S %Y +0000'),
     387                time_c=datetime.utcfromtimestamp(1601662000 + time.timezone).strftime('%a %b %d %H:%M:%S %Y +0000'),
     388            ))
    383389
    384390    def test_cache(self):
  • trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/log_unittest.py

    r280864 r284791  
    2222
    2323import os
     24import time
    2425import sys
     26
     27from datetime import datetime
    2528
    2629from webkitcorepy import OutputCapture, Terminal, testing
     
    4851            '''commit 5@main (d8bce26fa65c6fc8f39c17927abb77f69fab82fc)
    4952Author: Jonathan Bedard <jbedard@apple.com>
    50 Date:   Sat Oct 03 03:46:40 2020 +0000
     53Date:   {}
    5154
    5255    Patch Series
     
    5457commit 4@main (bae5d1e90999d4f916a8a15810ccfa43f37a2fd6)
    5558Author: Jonathan Bedard <jbedard@apple.com>
    56 Date:   Sat Oct 03 03:46:40 2020 +0000
     59Date:   {}
    5760
    5861    8th commit
     
    6063commit 3@main (1abe25b443e985f93b90d830e4a7e3731336af4d)
    6164Author: Jonathan Bedard <jbedard@apple.com>
    62 Date:   Sat Oct 03 02:23:20 2020 +0000
     65Date:   {}
    6366
    6467    4th commit
     
    6669commit 2@main (fff83bb2d9171b4d9196e977eb0508fd57e7a08d)
    6770Author: Jonathan Bedard <jbedard@apple.com>
    68 Date:   Sat Oct 03 01:50:00 2020 +0000
     71Date:   {}
    6972
    7073    2nd commit
     
    7275commit 1@main (9b8311f25a77ba14923d9d5a6532103f54abefcb)
    7376Author: Jonathan Bedard <jbedard@apple.com>
    74 Date:   Sat Oct 03 01:33:20 2020 +0000
     77Date:   {}
    7578
    7679    1st commit
    77 ''',
     80'''.format(*reversed([
     81                datetime.utcfromtimestamp(commit.timestamp + time.timezone).strftime('%a %b %d %H:%M:%S %Y +0000')
     82                for commit in mocks.local.Git(self.path).commits['main']
     83            ])),
    7884        )
    7985
     
    8995                '''commit 5@main (d8bce26fa65c6fc8f39c17927abb77f69fab82fc, r9)
    9096Author: Jonathan Bedard <jbedard@apple.com>
    91 Date:   Sat Oct 03 03:46:40 2020 +0000
     97Date:   {}
    9298
    9399    Patch Series
     
    96102commit 4@main (bae5d1e90999d4f916a8a15810ccfa43f37a2fd6, r8)
    97103Author: Jonathan Bedard <jbedard@apple.com>
    98 Date:   Sat Oct 03 03:46:40 2020 +0000
     104Date:   {}
    99105
    100106    8th commit
     
    103109commit 3@main (1abe25b443e985f93b90d830e4a7e3731336af4d, r4)
    104110Author: Jonathan Bedard <jbedard@apple.com>
    105 Date:   Sat Oct 03 02:23:20 2020 +0000
     111Date:   {}
    106112
    107113    4th commit
     
    110116commit 2@main (fff83bb2d9171b4d9196e977eb0508fd57e7a08d, r2)
    111117Author: Jonathan Bedard <jbedard@apple.com>
    112 Date:   Sat Oct 03 01:50:00 2020 +0000
     118Date:   {}
    113119
    114120    2nd commit
     
    117123commit 1@main (9b8311f25a77ba14923d9d5a6532103f54abefcb, r1)
    118124Author: Jonathan Bedard <jbedard@apple.com>
    119 Date:   Sat Oct 03 01:33:20 2020 +0000
     125Date:   {}
    120126
    121127    1st commit
    122128    git-svn-id: https://svn.example.org/repository/repository/trunk@1 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    123 ''',
     129'''.format(*reversed([
     130                    datetime.utcfromtimestamp(commit.timestamp + time.timezone).strftime('%a %b %d %H:%M:%S %Y +0000')
     131                    for commit in mocks.local.Git(self.path).commits['main']
     132                ])),
    124133            )
    125134
     
    131140            ))
    132141
    133             self.maxDiff = None
    134142            self.assertEqual(
    135143                captured.stdout.getvalue(),
    136144                '''commit r9 (d8bce26fa65c6fc8f39c17927abb77f69fab82fc, 5@main)
    137145Author: Jonathan Bedard <jbedard@apple.com>
    138 Date:   Sat Oct 03 03:46:40 2020 +0000
     146Date:   {}
    139147
    140148    Patch Series
     
    143151commit r8 (bae5d1e90999d4f916a8a15810ccfa43f37a2fd6, 4@main)
    144152Author: Jonathan Bedard <jbedard@apple.com>
    145 Date:   Sat Oct 03 03:46:40 2020 +0000
     153Date:   {}
    146154
    147155    8th commit
     
    150158commit r4 (1abe25b443e985f93b90d830e4a7e3731336af4d, 3@main)
    151159Author: Jonathan Bedard <jbedard@apple.com>
    152 Date:   Sat Oct 03 02:23:20 2020 +0000
     160Date:   {}
    153161
    154162    4th commit
     
    157165commit r2 (fff83bb2d9171b4d9196e977eb0508fd57e7a08d, 2@main)
    158166Author: Jonathan Bedard <jbedard@apple.com>
    159 Date:   Sat Oct 03 01:50:00 2020 +0000
     167Date:   {}
    160168
    161169    2nd commit
     
    164172commit r1 (9b8311f25a77ba14923d9d5a6532103f54abefcb, 1@main)
    165173Author: Jonathan Bedard <jbedard@apple.com>
    166 Date:   Sat Oct 03 01:33:20 2020 +0000
     174Date:   {}
    167175
    168176    1st commit
    169177    git-svn-id: https://svn.example.org/repository/repository/trunk@1 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    170 ''',
     178'''.format(*reversed([
     179                    datetime.utcfromtimestamp(commit.timestamp + time.timezone).strftime('%a %b %d %H:%M:%S %Y +0000')
     180                    for commit in mocks.local.Git(self.path).commits['main']
     181                ])),
    171182            )
    172183
Note: See TracChangeset for help on using the changeset viewer.