Got some fatalErrors when running TestFoundation target

Hi guys, I want to contribute to swift-corelibs-foundation, but I met some
problems when testing my code. I got some fatalErrors ( e.g. in
test_gettingDatesOnGregorianCalendar(), TimeZone(identifier: "UTC") returns
a nil before being unwrapped). Do you have the same problems?

I'm using Xcode 9 beta and have tried
both swift-DEVELOPMENT-SNAPSHOT-2017-06-19-a-osx
and swift-4.0-DEVELOPMENT-SNAPSHOT-2017-06-12-a-osx (which swift snapshot
should I use btw?).

The issue looks to be the TZDIR (Time zoneinfo directory) has changed between 10.12 and 10.13

On 10.12 (Sierra), /usr/include/tzfile.h defines:
$ grep TZDIR /usr/include/tzfile.h
#ifndef TZDIR
#define TZDIR "/usr/share/zoneinfo" /* Time zone object file directory */
#endif /* !defined TZDIR */

But when compiling with the beta its defined as:

$ grep TZDIR /Applications/Xcode-beta.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/tzfile.h
#ifndef TZDIR
#define TZDIR "/var/db/timezone/zoneinfo" /* Time zone object file directory */
#endif /* !defined TZDIR */

Which fails to since its pointing in the wrong place. A quick workaround is to just hardcode the TZDIR in CoreFoundation//NumberDate.subproj/CFTimeZone.c. A better workaround is maybe find out which os version the test is running on and set it dynamically.

ยทยทยท

On 20 Jun 2017, at 04:23, Zhu Shengqi via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:

Hi guys, I want to contribute to swift-corelibs-foundation, but I met some problems when testing my code. I got some fatalErrors ( e.g. in test_gettingDatesOnGregorianCalendar(), TimeZone(identifier: "UTC") returns a nil before being unwrapped). Do you have the same problems?

I'm using Xcode 9 beta and have tried both swift-DEVELOPMENT-SNAPSHOT-2017-06-19-a-osx and swift-4.0-DEVELOPMENT-SNAPSHOT-2017-06-12-a-osx (which swift snapshot should I use btw?).

_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev