Changeset 216777 in webkit


Ignore:
Timestamp:
May 12, 2017 1:09:25 PM (7 years ago)
Author:
beidson@apple.com
Message:

REGRESSION (r216711): API test WKWebView.ClearAppCache is failing.
https://bugs.webkit.org/show_bug.cgi?id=172030

Unreviewed - Test gardening, in effect...

This failure is only being seen by the bots.

I believe this test is utterly broken in the first place; when it checks the .wal file's
size that is not actually an indicator that the records were deleted.

But that isn't what's coming up as failure on the bots.

This patch is an attempt to:
1 - More forcefully clear the Website data directory of leftovers before the test starts.
2 - Give an earlier indication of the failure that the bots are seeing, to possibly reveal more.

  • TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm:

(defaultWebsiteDataDirectory):
(defaultApplicationCacheDirectory):
(TEST):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r216776 r216777  
     12017-05-12  Brady Eidson  <beidson@apple.com>
     2
     3        REGRESSION (r216711): API test WKWebView.ClearAppCache is failing.
     4        https://bugs.webkit.org/show_bug.cgi?id=172030
     5
     6        Unreviewed - Test gardening, in effect...
     7
     8        This failure is only being seen by the bots.
     9       
     10        I believe this test is utterly broken in the first place; when it checks the .wal file's
     11        size that is not actually an indicator that the records were deleted.
     12       
     13        But that isn't what's coming up as failure on the bots.
     14       
     15        This patch is an attempt to:
     16        1 - More forcefully clear the Website data directory of leftovers before the test starts.
     17        2 - Give an earlier indication of the failure that the bots are seeing, to possibly reveal more.
     18
     19        * TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm:
     20        (defaultWebsiteDataDirectory):
     21        (defaultApplicationCacheDirectory):
     22        (TEST):
     23
    1242017-05-12  Jonathan Bedard  <jbedard@apple.com>
    225
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm

    r210093 r216777  
    108108}
    109109
     110NSString *defaultWebsiteDataDirectory()
     111{
     112#if PLATFORM(IOS)
     113    return nil;
     114#else
     115    return @"~/Library/Caches/TestWebKitAPI/WebKit";
     116#endif
     117}
     118
    110119NSString *defaultApplicationCacheDirectory()
    111120{
     
    114123    return [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches/com.apple.WebAppCache"];
    115124#else
    116     return @"~/Library/Caches/TestWebKitAPI/WebKit/OfflineWebApplicationCache";
     125    return [defaultWebsiteDataDirectory() stringByAppendingString:@"/OfflineWebApplicationCache"];
    117126#endif
    118127}
     
    127136    NSURL *shmResourceURL = [[NSBundle mainBundle] URLForResource:@"ApplicationCache" withExtension:@"db-shm" subdirectory:@"TestWebKitAPI.resources"];
    128137    NSURL *walResourceURL = [[NSBundle mainBundle] URLForResource:@"ApplicationCache" withExtension:@"db-wal" subdirectory:@"TestWebKitAPI.resources"];
    129    
     138
     139    // Clean up any website data files left from any previous test run.
     140    if (auto *websiteDataDirectory = defaultWebsiteDataDirectory()) {
     141        NSURL *websiteDataURL = [NSURL fileURLWithPath:[websiteDataDirectory stringByExpandingTildeInPath]];
     142        [[NSFileManager defaultManager] removeItemAtURL:websiteDataURL error:nil];
     143    }
     144
    130145    NSURL *targetURL = [NSURL fileURLWithPath:[defaultApplicationCacheDirectory() stringByExpandingTildeInPath]];
    131146    [[NSFileManager defaultManager] createDirectoryAtURL:targetURL withIntermediateDirectories:YES attributes:nil error:nil];
    132    
     147
    133148    NSURL *dbTargetURL = [targetURL URLByAppendingPathComponent:@"ApplicationCache.db"];
    134149    NSURL *walTargetURL = [targetURL URLByAppendingPathComponent:@"ApplicationCache.db-wal"];
    135150    NSURL *shmTargetURL = [targetURL URLByAppendingPathComponent:@"ApplicationCache.db-shm"];
    136151
    137     // Clean up any files that may have been left from this test failing before.
    138     [[NSFileManager defaultManager] removeItemAtURL:dbTargetURL error:nil];
    139     [[NSFileManager defaultManager] removeItemAtURL:walTargetURL error:nil];
    140     [[NSFileManager defaultManager] removeItemAtURL:shmTargetURL error:nil];
    141152    EXPECT_EQ(fileSize(dbTargetURL), -1);
    142153    EXPECT_EQ(fileSize(walTargetURL), -1);
    143154    EXPECT_EQ(fileSize(shmTargetURL), -1);
    144    
     155
    145156    // Copy the resources from the bundle to ~/Library/...
    146157    [[NSFileManager defaultManager] copyItemAtURL:dbResourceURL toURL:dbTargetURL error:nil];
     
    157168    [[WKWebsiteDataStore defaultDataStore] fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] completionHandler:^(NSArray<WKWebsiteDataRecord *> *websiteDataRecords)
    158169    {
    159         EXPECT_GT(websiteDataRecords.count, 0ul);
     170        EXPECT_EQ(websiteDataRecords.count, 1ul);
    160171        originalWebsiteDataRecordCount = websiteDataRecords.count;
    161172        readyToContinue = true;
Note: See TracChangeset for help on using the changeset viewer.