Skip to content

Determine the Timezone directory to use at runtime on macOS. #1126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2017

Conversation

spevans
Copy link
Contributor

@spevans spevans commented Jul 22, 2017

  • The timezone directory changed on macOS 10.13 so get the os version
    at runtime and set the timezone directory dynamically. This allows
    the tests to be on 10.12 and 10.13

  • Added __InitTZStrings() for both Linux and macOS to work the same way as Windows.

Tested on Linux and 10.12 but not 10.13

@spevans
Copy link
Contributor Author

spevans commented Jul 24, 2017

/cc @ianpartridge @parkera Here is a possible solution to the TZDIR issue on macOS

}

// Timezone files moved in High Sierra(10.13)
if (major == 10 && minor >= 13) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If major ever changes, this is going to provide the wrong behaviour here, surely? Wouldn't it be better to use major == 10 && minor < 13 as the fallback condition, and then everything else as the new condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good catch, I will swap it round. Of course it will also break if the TZDIR is changed again - I was assuming any changes of that magnitude would be caught in the beta period :)

- The timezone directory changed on macOS 10.13 so get the os version
  at runtime and set the timezone directory dynamically. This allows
  the tests to be run on 10.12 and 10.13

- Added __InitTZStrings() for both Linux and macOS to work the same
  way as Windows.
@spevans spevans force-pushed the pr_macos_tzdir_fix branch from 1ae6f34 to 80acf1c Compare July 25, 2017 22:48
@spevans
Copy link
Contributor Author

spevans commented Jul 25, 2017

@alblue I swapped the test around.

@ianpartridge
Copy link
Contributor

I confirm this PR works for me, and the tests now run on Sierra. I don't have a High Sierra machine to test on, unfortunately.

The patch touches a fair amount of CFTimeZone.c including Windows-specific code so will need a careful review by @parkera.

@alblue
Copy link
Contributor

alblue commented Jul 26, 2017

@swift-ci please test

@spevans
Copy link
Contributor Author

spevans commented Jul 26, 2017

is there anyway to get the swift-ci bot to also test on macOS? Am I correct in thinking only Linux is tested?

@ianpartridge
Copy link
Contributor

AFAIK only Linux is tested by the CI. I agree it would be nice to run the tests on macOS too, I don't know what would be needed to make that happen.

@parkera
Copy link
Contributor

parkera commented Jul 26, 2017

We're talking to @shahmishal about getting macOS tests running here. I think it's important to get that started, probably after we wrap up this release.

@ianpartridge
Copy link
Contributor

Thanks @parkera. How does this PR look to you?

@parkera
Copy link
Contributor

parkera commented Jul 27, 2017

Looks good to me.

@ianpartridge
Copy link
Contributor

@swift-ci please test and merge

@swift-ci swift-ci merged commit c55741b into swiftlang:master Jul 28, 2017
@ianpartridge
Copy link
Contributor

Thanks for working on this @spevans 👍

@spevans spevans deleted the pr_macos_tzdir_fix branch August 9, 2017 06:37
@parkera
Copy link
Contributor

parkera commented Nov 27, 2017

@spevans can we re-apply this to master after the re-apply of the import?

@spevans
Copy link
Contributor Author

spevans commented Nov 27, 2017

There was also a 2nd PR to fix an off-by-one error that this one introduced. I will create a new PR that covers both and test it on 10.12 then that should solve it

@spevans spevans restored the pr_macos_tzdir_fix branch November 27, 2017 21:57
@spevans
Copy link
Contributor Author

spevans commented Nov 27, 2017

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants