Skip to content
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

Support Custom SimDeviceSets #41

Merged
merged 1 commit into from Oct 6, 2015
Merged

Support Custom SimDeviceSets #41

merged 1 commit into from Oct 6, 2015

Conversation

lawrencelomax
Copy link
Contributor

It's possible to change Simulator.app to use a different device set by passing -DeviceSetPath as an arg to the launched Simulator. This will be vastly preferable to using Prefixes to isolate simulators between processes.

cc @mmmulani @ExtremeMan

@mmmulani
Copy link
Contributor

mmmulani commented Oct 5, 2015

tests red?

@lawrencelomax
Copy link
Contributor Author

The test is failing on pre-Xcode 7. I've updated the tests to take this into account and skip in the Custom Device Set case.

We can get probably get this working for Xcode 6 by injecting and swizzling the Simulator app process (which we can't do for Xcode 7 because amfid). I am happy to do this later (if at all) for Xcode 6, if you agree?

@mmmulani
Copy link
Contributor

mmmulani commented Oct 5, 2015

ahh, this lgtm then

I'm happy to pass on Xcode 6 support as long as we can get as far back as iOS 7 running under Xcode 7. (which should be possible if we copy the simulator SDKs over)

@@ -48,7 +55,7 @@ - (instancetype)copyWithZone:(NSZone *)zone

- (NSUInteger)hash
{
return self.simulatorApplication.hash | self.namePrefix.hash | self.bucketID | self.options;
return self.simulatorApplication.hash | self.deviceSetPath.hash | self.namePrefix.hash | self.bucketID | self.options;

Choose a reason for hiding this comment

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

Interesting. I usually do [_ns_object_1 hash] ^ [_ns_object_2 hash].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

xor makes a lot more sense I think. Will do this everywhere for all the hashes we have.

Copy link

Choose a reason for hiding this comment

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

Actually [_ns_object_1 hash] ^ [_ns_object_2 hash] will always be zero if the two objects are equal. I wouldn't recommend that in general because someone could easily exploit that to slow things down (probably not in this specific case though). But multiply the second hash by an arbitrary factor before XORing and it becomes pretty good.

Doing plain [_ns_object_1 hash] | [_ns_object_2 hash] will skew things toward the higher numbers (because bits can never return to zero). So hashes will tend to clash more than using XOR, especially if you are ORing a lot of them.

@ExtremeMan
Copy link

Added some comments =) Feel free to ignore because they are mostly nits and I don't know what is preferred style here.

lawrencelomax added a commit that referenced this pull request Oct 6, 2015
@lawrencelomax lawrencelomax merged commit e797040 into master Oct 6, 2015
@lawrencelomax lawrencelomax deleted the custom-device-set branch October 6, 2015 15:10
plu added a commit to plu/FBSimulatorControl that referenced this pull request Feb 26, 2017
plu added a commit to plu/FBSimulatorControl that referenced this pull request Feb 26, 2017
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.

None yet

4 participants