UIAutomation : Failed to authorize rights with status: -60007 - iphone

So I am running UIAutomation on command line with
$ instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate
<path-to-your-app>/<appname>.app/ -e UIASCRIPT <path-to-your-js-test-file> -e
UIARESULTSPATH <path-to-results-folder>
This works fine and the simulator opens up, and the app runs, but gets stuck with this error.
Failed to authorize rights (0x2) with status: -60007
I believe it has something to do with the permissions.
How do I go about this ?

That's the answer I posted at Instruments via command line - jenkins
And here is even a blog post about Xcode command line authorization prompt error
I will explain it again here:
What I did was the following:
Mark jenkins user as admin (unfortunately it seems that there is no other way atm)
Go to /etc/authorization
search for key system.privilige.taskport
change value of allow-root to true
<key>system.privilege.taskport</key>
<dict>
<key>allow-root</key>
<false/> // change to -> <true>
<key>class</key>
<string>user</string>
<key>comment</key>
<string>Used by task_for_pid(...).
...
</dict>
Now I am being able to use jenkins to run my UIAutomation-Tests via Command Line Script
EDIT
To make jenkins recognize a successfull build, I have not a perfect solution but the following workaround:
...
echo "Run instruments simulator"
instruments -t "$ORDER_AUTOMATION_TEST_TEMPLATE_PATH" "$FILE_DEBUG_APP" -e UIASCRIPT "$ORDER_AUTOMATION_TESTSCRIPT_PATH" -e UIARESULTSPATH "$DIRECTORY_INSTRUMENTS_RESULT"
returnCode=0
if test -a "Run 1/Assertion failed.png"; then
echo "failed"
returnCode=1
else
echo "passed"
returnCode=0
fi
rm -fR "Run 1"
rm -fR "instrumentscli0.trace"
echo "Removing app dir"
echo "$FILE_APPLICATIONS"
rm -fR "$FILE_APPLICATIONS"
echo $returnCode
exit $returnCode
EDIT 2
Better way to check if automation test did run successfully:
# cleanup the tracefiles produced from instruments
rm -rf *.trace
##kill simulator afterwards
killall "iPhone Simulator"
##check if failures occured
# fail script if any failures have been generated
if [ `grep "<string>Error</string>" "$WORKSPACE/Automation Results/Run 1/Automation Results.plist" | wc -l` -gt 0 ]; then
echo 'Build Failed'
exit -1
else
echo 'Build Passed'
exit 0
fi

This can help on Mavericks and Yosemite: (based on Alexander's answer)
$ security authorizationdb write system.privilege.taskport allow

Related

how to fix the issue "Makefrag:68: recipe for target 'simv-freechips.rocketchip.system-DefaultConfig' failed"

I am trying to build rocketchip & vsim for the same as described here
But I am stuck at vsim run while doing below:
koushik#koushik-Presario-CQ43-Notebook-PC:~/riscv_ks/rocket-chip/vsim$ make -j2 run
mkdir -p ./output
cd . && \
rm -rf csrc && \
vcs -full64 -notice -line +lint=all,noVCDE,noONGS,noUI -error=PCWM-L -timescale=1ns/10ps -quiet +rad +v2k +vcs+lic+wait +vc+list -CC "-I/include" -CC "-I/home/koushik/riscvtools/include" -CC "-std=c++11" -CC "-Wl,-rpath,/home/koushik/riscvtools/lib" /home/koushik/riscvtools/lib/libfesvr.so -sverilog +incdir+/home/koushik/riscv_ks/rocket-chip/vsim/generated-src +define+CLOCK_PERIOD=1.0 /home/koushik/riscv_ks/rocket-chip/vsim/generated-src/freechips.rocketchip.system.DefaultConfig.v /home/koushik/riscv_ks/rocket-chip/vsim/generated-src/freechips.rocketchip.system.DefaultConfig.behav_srams.v /home/koushik/riscv_ks/rocket-chip/src/main/resources/vsrc/TestDriver.v /home/koushik/riscv_ks/rocket-chip/src/main/resources/vsrc/SimDTM.v /home/koushik/riscv_ks/rocket-chip/src/main/resources/vsrc/SimJTAG.v /home/koushik/riscv_ks/rocket-chip/src/main/resources/vsrc/plusarg_reader.v /home/koushik/riscv_ks/rocket-chip/src/main/resources/vsrc/ClockDivider2.v /home/koushik/riscv_ks/rocket-chip/src/main/resources/vsrc/ClockDivider3.v /home/koushik/riscv_ks/rocket-chip/src/main/resources/vsrc/AsyncResetReg.v /home/koushik/riscv_ks/rocket-chip/src/main/resources/vsrc/EICG_wrapper.v /home/koushik/riscv_ks/rocket-chip/src/main/resources/csrc/SimDTM.cc /home/koushik/riscv_ks/rocket-chip/src/main/resources/csrc/SimJTAG.cc /home/koushik/riscv_ks/rocket-chip/src/main/resources/csrc/remote_bitbang.cc +define+PRINTF_COND=TestDriver.printf_cond +define+STOP_COND=!TestDriver.reset +define+RANDOMIZE_MEM_INIT +define+RANDOMIZE_REG_INIT +define+RANDOMIZE_GARBAGE_ASSIGN +define+RANDOMIZE_INVALID_ASSIGN +define+RANDOMIZE_DELAY=2 +libext+.v -o ./simv-freechips.rocketchip.system-DefaultConfig \
-debug_pp \
ln -fs /home/koushik/riscvtools/riscv64-unknown-elf/share/riscv-tests/isa/rv64um-v-mul output/rv64um-v-mul
/bin/bash: line 2: vcs: command not found
Makefrag:68: recipe for target 'simv-freechips.rocketchip.system-DefaultConfig' failed
make: *** [simv-freechips.rocketchip.system-DefaultConfig] Error 127
make: *** Waiting for unfinished jobs....
You don't have VCS installed so its failing to find the command that runs it.
Try "make verilog", this should created the default configuration of rocket-chip.
or if you want to create one of the other canned configurations in Config.scala then you can use "make CONFIG=TinyConfig verilog" where TinyConfig can be replaced with any of the canned configurations.
Thanks,
Ciaran

Xcode AFNetworking - Command /bin/sh with exit code 1

When I run my project I get this error, i can't understand the problem...
Showing Recent Issues
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/leo/Library/Developer/Xcode/DerivedData/Clubber-ghdadinxjzgblkgllmrradwnzqcv/Build/Intermediates.noindex/Clubber.build/Debug-iphoneos/Clubber.build/Script-6032B42DA46117C50C8623CC.sh
cd /Users/leo/Documents/Progetti/iOS/Clubber
/bin/sh -c /Users/leo/Library/Developer/Xcode/DerivedData/Clubber-ghdadinxjzgblkgllmrradwnzqcv/Build/Intermediates.noindex/Clubber.build/Debug-iphoneos/Clubber.build/Script-6032B42DA46117C50C8623CC.sh
mkdir -p /Users/leo/Library/Developer/Xcode/DerivedData/Clubber-ghdadinxjzgblkgllmrradwnzqcv/Build/Products/Debug-iphoneos/Clubber.app/Frameworks
rsync --delete -av --filter P .*.?????? --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/leo/Library/Developer/Xcode/DerivedData/Clubber-ghdadinxjzgblkgllmrradwnzqcv/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework" "/Users/leo/Library/Developer/Xcode/DerivedData/Clubber-ghdadinxjzgblkgllmrradwnzqcv/Build/Products/Debug-iphoneos/Clubber.app/Frameworks"
building file list ... done
AFNetworking.framework/
AFNetworking.framework/AFNetworking
AFNetworking.framework/Info.plist
sent 1305423 bytes received 70 bytes 2610986.00 bytes/sec
total size is 1305025 speedup is 1.00
Stripped /Users/leo/Library/Developer/Xcode/DerivedData/Clubber-ghdadinxjzgblkgllmrradwnzqcv/Build/Products/Debug-iphoneos/Clubber.app/Frameworks/AFNetworking.framework/AFNetworking of architectures: armv7
Code Signing /Users/leo/Library/Developer/Xcode/DerivedData/Clubber-ghdadinxjzgblkgllmrradwnzqcv/Build/Products/Debug-iphoneos/Clubber.app/Frameworks/AFNetworking.framework with Identity iPhone Developer: cana.46#live.it (U698V62S44)
/usr/bin/codesign --force --sign 17E36AAB0AE20D9A471180DEC67D5500DF962DC0 --preserve-metadata=identifier,entitlements '/Users/leo/Library/Developer/Xcode/DerivedData/Clubber-ghdadinxjzgblkgllmrradwnzqcv/Build/Products/Debug-iphoneos/Clubber.app/Frameworks/AFNetworking.framework'
/Users/leo/Library/Developer/Xcode/DerivedData/Clubber-ghdadinxjzgblkgllmrradwnzqcv/Build/Products/Debug-iphoneos/Clubber.app/Frameworks/AFNetworking.framework: unknown error -1=ffffffffffffffff
Command /bin/sh failed with exit code 1
I tried to:
Clean my project
Delete derived data
Reinstall my pods
Set Build Active architetture only to NO in my POD Project
I also tried to read a lot of related posts but nothing... -.-
This problem is driving me crazy, someone can help me?
This is because you might have not check the "run the script only when installing"
go to the project build folder
Select Targets
Select Build Phases tab
Open Run Script drop-down option
Select Run script only when installing checkbox
And then clean your project (cmd+shift+k) and build your project.
i found this solution, for some reasons my login keychan wasn't still valid, this works for me : Getting this error command /usr/bin/codesign failed with exit code 1 with xcode 9.1?

Bluemix: cf push using DEA instead of DIEGO architecture

When deploying an application into dedicated Bluemix it uses DEA architecture by default. How can I force it to use DIEGO architecture instead?
You have to use more steps. Deploy without start, switch to diego, start.
cf push APPLICATION_NAME --no-start
cf disable-diego APPLICATION_NAME
cf start APPLICATION_NAME
Ref Deploying Apps
I built a bash exec to do this, which will use your existing manifest.yml file and pack all of this into a single request. The contents of the bash exec follow:
#!/bin/bash
filename="manifest.yml"
if [ -e $filename ];
then
echo "using manifest.yml file in this directory"
else
echo "no manifest.yml file found. exiting"
exit -2
fi
shopt -s nocasematch
string='name:'
targetName=""
echo "Retrieving name from manifest file"
while read -r line
do
name="$line"
variable=${name%%:*}
if [[ $variable == *"name"* ]]
then
inBound=${name#*:}
targetName="$(echo -e "${inBound}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
fi
done < "$filename"
if [ "$targetName" == "" ];
then
echo "Could not find name of application in manifest.yml file. Cancelling build."
echo "application name is identified by the 'name: ' term in the manifest.yml file"
exit -1
else
echo "starting cf push for $targetName"
cf push --no-start
echo "cf enable-diego $targetName"
cf enable-diego $targetName
echo "cf start $targetName"
cf start $targetName
exit 0
fi
Just put this code into your editor as a new file and then make the file executable. I keep a copy of this exec in each of my repos in the root directory. After doing a copy-paste and executing this exec, you may get the following error:
/bin/bash^M: bad interpreter: No such file or directory
If you do, just run the dos2unix command and it will 'fix up' the line endings to match your os.

Where do I find alias arguments in fastlane?

In a fastlane project that I am taking over everything is run by command line (e.g. not fastfile). In this project (using fastlane 1.7) there are aliases used for arguments. Where would I go to find out what each of the aliases map to as far as fastlane commands? For example:
def build(Myapp, skip_profile)
if skip_profile || download_provisioning_profiles(MyApp)
build_cmd = "gym -a -r -s #{MyApp.name} -o ./build -n #{MyApp.ipa_name} --use_legacy_build_api"
system(build_cmd)
else
puts "Was unable to install provisioning profiles"
exit 1
end
end
Looking at this I am pretty sure that -o is the output but where would I look to find out explicitly what -a and -r and -s and -o are?
Run
fastlane gym --help
to get a list of all available options for the gym tool.

How to run script in Solaris after boot once

I looking for the right way to run shell script first boot Solaris.
I need to run resize command, there is a my script
#!/bin/sh -ux
echo "#!/bin/sh -ux" > /etc/rc3.d/S90scale
echo "/sbin/zpool set autoexpand=on rpool" >> /etc/rc3.d/S90scale
echo "/sbin/zpool online -e rpool c1d0" >> /etc/rc3.d/S90scale
echo "rm /etc/rc3.d/S90scale" >> /etc/rc3.d/S90scale
echo "/sbin/shutdown -y -i6 -g0" >> /etc/rc3.d/S90scale
chmod a+x /etc/rc3.d/S90scale
actually script working properly, but unfortunately resize do not work. When I do the same things from user session everything just fine.
What exactly I doing wrong?
Your method is not the "right" one to run a script once after boot as it uses the legacy approach. The correct way would be to create an smf service that runs once. However, it does work anyway with Solaris 10 and 11 as the rc scripts while deprecated are still processed so I won't elaborate more about smf.
The main issue is you don't check for errors and whatever happens, it remove the script and reboot preventing any analysis to occur.
I would suggest to modify your script to log what is happening in a file and quit on error:
#!/bin/ksh
cat > /etc/rc3.d/S90scale <<%EOF%
exec > /var/tmp/S90scale.log 2>&1 # logs everything to file
set -xe # show commands and exits on error
/sbin/zpool set autoexpand=on rpool
/sbin/zpool online -e rpool c1d0
mv /etc/rc3.d/S90scale /etc/rc3.d/_S90scale
/sbin/shutdown -y -i6 -g0
%EOF%
chmod a+x /etc/rc3.d/S90scale
After the next reboot complete, you should have a look to the /var/tmp/S90scale.log file and possibly see an error message there.