Author: Raphael Isemann
Date: 2020-02-05T13:24:06+01:00
New Revision: 8d8bd0d6548ed9d2482de341c1b0e53449e5c564

URL: 
https://github.com/llvm/llvm-project/commit/8d8bd0d6548ed9d2482de341c1b0e53449e5c564
DIFF: 
https://github.com/llvm/llvm-project/commit/8d8bd0d6548ed9d2482de341c1b0e53449e5c564.diff

LOG: [lldb] Make TestDataFormatterObjCCF.py pass outside California

Summary:
This test creates its dates with `NSDate dateWithNaturalLanguageString` which 
is deprecated and uses the current time zone of the machine to
interpret the input string. This causes that the created NSDate has a different 
value depending on the locale of the machine
and we hardcoded the value for California's time zone (PST) but the data 
formatter gives out the GMT value as a string.

This just replaces the use with the timezone-independent 
dateWithTimeIntervalSince1970 (which we also use in the rest of the test)
to make this pass independently of the time zone of the machine running the 
test.

Reviewers: mib

Reviewed By: mib

Subscribers: lldb-commits, JDevlieghere

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74038

Added: 
    

Modified: 
    
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCCF.py
    
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m

Removed: 
    


################################################################################
diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCCF.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCCF.py
index 5b82bb6528f3..38e8ae63838b 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCCF.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCCF.py
@@ -31,7 +31,7 @@ def test_coreframeworks_and_run_command(self):
         # check formatters for common Objective-C types
         expect_strings = [
             '(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 
hours, 5 minutes 7 seconds',
-            '(CFGregorianDate) cf_greg_date = @"4/11/1985 2:0:0"',
+            '(CFGregorianDate) cf_greg_date = @"4/10/1985 18:0:0"',
             '(CFRange) cf_range = location=4 length=4',
             '(NSPoint) ns_point = (x = 4, y = 4)',
             '(NSRange) ns_range = location=4, length=4',

diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
index aac729c74590..81ac2185314a 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
@@ -501,8 +501,8 @@ int main (int argc, const char * argv[])
            NSURL *nsurl2 = [NSURL URLWithString:@"page.html" 
relativeToURL:nsurl];
            NSURL *nsurl3 = [NSURL URLWithString:@"?whatever" 
relativeToURL:nsurl2];
     
-               NSDate *date1 = [NSDate dateWithNaturalLanguageString:@"6pm 
April 10, 1985"];
-               NSDate *date2 = [NSDate dateWithNaturalLanguageString:@"12am 
January 1, 2011"];
+               NSDate *date1 = [NSDate 
dateWithTimeIntervalSince1970:133890*60*60]; // 6pm April 10, 1985 GMT
+               NSDate *date2 = [NSDate 
dateWithTimeIntervalSince1970:14975*24*60*60]; // 12am January 1, 2011 GMT
                NSDate *date3 = [NSDate date];
                NSDate *date4 = [NSDate dateWithTimeIntervalSince1970:24*60*60];
     NSDate *date5 = [NSDate dateWithTimeIntervalSinceReferenceDate: 
floor([[NSDate date] timeIntervalSinceReferenceDate])];


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to