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

Add --script-file-path to run a user script #290

Merged
merged 3 commits into from Oct 25, 2018

Conversation

Projects
None yet
2 participants
@loufranco
Copy link
Contributor

loufranco commented Oct 24, 2018

This adds a way to run a script after a simulator is booted, but before tests are run. One reason to use this is to install certificates to integrate with mitmproxy (per #194)

@bayareabear bayareabear requested a review from oliverhu Oct 24, 2018

@@ -141,6 +141,8 @@ typedef NS_OPTIONS(NSUInteger, BPOptionType) {
"Directory where simulator screenshots for failed ui tests will be stored"},
{362, "simulator-preferences-file", BP_MASTER | BP_SLAVE, NO, NO, required_argument, NULL, BP_VALUE | BP_PATH, "simulatorPreferencesFile",
"A .GlobalPreferences.plist simulator preferences file to be copied to any newly created simulators before booting"},
{363, "script-file-path", BP_MASTER | BP_SLAVE, NO, NO, required_argument, NULL, BP_VALUE | BP_PATH, "scriptFilePath",

This comment has been minimized.

@oliverhu

oliverhu Oct 24, 2018

Contributor

just script-file

@@ -0,0 +1,5 @@
#!/bin/sh

# This is a script to test --script-file-path

This comment has been minimized.

@oliverhu

oliverhu Oct 24, 2018

Contributor

rename to test-script.sh

XCTAssert(exitCode2 == BPExitStatusSimulatorDeleted);
XCTAssertEqualObjects(self.config.deleteSimUDID, bp2.test_simulatorUDID);

XCTAssertFalse([[NSFileManager defaultManager] fileExistsAtPath:testFile]);

This comment has been minimized.

@oliverhu

oliverhu Oct 24, 2018

Contributor

please also delete the testfile after this test finishes

@@ -718,6 +720,18 @@ - (BOOL)validateConfigWithError:(NSError *__autoreleasing *)err {
}
}

if (self.scriptFilePath) {
if ([[NSFileManager defaultManager] fileExistsAtPath:self.scriptFilePath isDirectory:&isdir]) {
if (isdir) {

This comment has been minimized.

@oliverhu

oliverhu Oct 24, 2018

Contributor

Also make sure this file is executable

Various updates from code review
- rename script-file-path option to script-file
- rename script.sh file to test-script.sh
- if test file is not removed by sim delete, remove in test
- check to see if the script is executable
@loufranco

This comment has been minimized.

Copy link
Contributor

loufranco commented Oct 25, 2018

@oliverhu all comments addressed in latest commit

@oliverhu oliverhu merged commit d449fa1 into linkedin:master Oct 25, 2018

1 check passed

ci/circleci Your tests passed on CircleCI!
Details
@oliverhu

This comment has been minimized.

Copy link
Contributor

oliverhu commented Oct 25, 2018

LGTM, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment