sac
sac

Reputation: 910

Test Target to debug as root process

I have added a new test target in xcode. I want to test my unit test cases by running it as root since it involves creation of certain directories where root has permissions. But I find that it is disabled to select the process to run as root.Any help on how to test it with root permissions ? enter image description here

Upvotes: 4

Views: 1224

Answers (1)

Tim Myers
Tim Myers

Reputation: 51

I had this problem and managed to fix it by manually editing the corresponding *.xcscheme file.

Assuming you have the "Run" configuration set up to do this, you will see the following in the *.xcscheme file:

  <LaunchAction
  ...
  debugAsWhichUser = "root"
  ...>
      ...
  </LaunchAction>

Simply add the property manually to the TestAction section as well:

  <TestAction
  ...
  debugAsWhichUser = "root"
  ...>
      ...
  </TestAction>

After making this change, I simply restarted XCode, and now the disabled radio buttons show the correct value as seen here: Correct settings

Running verified for me that it all worked! * I should mention that this was on Version 8.1 (8B62), I have no reason to think this should vary by version but YMMV.

Upvotes: 5

Related Questions