Terminal/Shell Script execution of iOS UIAutomation in Xcode 6 - javascript

Has anyone been able to successfully launch a UIAutomation .js script with instruments from the Terminal and/or a shell script yet?
This is the script I was using on Xcode 5 that was working fine:
instruments \
-w "167dd71e05a29312fe46ea66ec68be837ffcd127" \
-t "/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate" \
"/Users/automationken/Library/Application Support/iPhone Simulator/7.1-64/Applications/7C2A685D-0CC9-40B4-A9B7-5C7C99DB93DC/something.app" \
-e UIARESULTSPATH "/Users/automationken/source/something/ios_UIA/automation_results" \
-e UIASCRIPT "/Users/automationken/source/something/ios_UIA/something.js"
Now I did notice that the automation template path has changed to:
"/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate"
And that the path of the new simulator is now:
~/Library/Developer/CoreSimulator/Devices/
But I can't find an equivalent .app file anywhere in the sub directories beyond that. Anybody know what I'm doing wrong?

Related

DroidEdit Termux integration

DroidEdit allows you to run commands if you have sl4a installed and the am command works wonderfully... I was wondering if there is a way to use am to launch an app with params .. specifically I want a command that will tell termux to run a command on a file that I specificy ... so far I found this snippet that launches the termux app .. now how do I get it to run node or webpack from npm as well?
am start --user 0 -n com.termux/com.termux.app.TermuxActivity

Ffmpeg gets aborted in an Electron sandboxed application

I have an Electron app, published on the Mac AppStore, and sandboxed.
I'm trying to add a new feature that will encode/decode videos on the fly so I can stream more video formats in an Electron context.
I'm using fluent-ffmpeg and a static exec of ffmpeg.
Everything works awesomely, I've uploaded the sandboxed app to Apple, and got rejected because ffmpeg is using by default a secure transport protocol which is using non-public API, this is what they've sent me with the rejection:
Your app uses or references the following non-public API(s):
'/System/Library/Frameworks/Security.framework/Versions/A/Security'
: SecIdentityCreate
Alright, after much investigation, it appears that I have to compile ffmpeg myself with a --disable-securetransport flag. Easy enough, I do it using the same config as the static build I've downloaded simply adding the new flag.
I manage to install every dependencies needed, except libxavs, no big deal I guess and simply remove its flag from the configure command:
./configure \
--cc=/usr/bin/clang \
--prefix=/opt/ffmpeg \
--extra-version=tessus \
--enable-avisynth \
--enable-fontconfig \
--enable-gpl \
--enable-libass \
--enable-libbluray \
--enable-libfreetype \
--enable-libgsm \
--enable-libmodplug \
--enable-libmp3lame \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libopus \
--enable-libsnappy \
--enable-libsoxr \
--enable-libspeex \
--enable-libtheora \
--enable-libvidstab \
--enable-libvo-amrwbenc \
--enable-libvorbis \
--enable-libvpx \
--enable-libwavpack \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-libzmq \
--enable-libzvbi \
--enable-version3 \
--pkg-config-flags=--static \
--disable-securetransport \
--disable-ffplay
With the new ffmpeg exec, everything still works as expected. But once I'm packaging, signing and sandboxing the app, ffmpeg stops working as soon as I try to launch it throwing this error:
An error occurred ffmpeg was killed with signal SIGABRT Error: ffmpeg was killed with signal SIGABRT
at ChildProcess.eval (webpack:///../node_modules/fluent-ffmpeg/lib/processor.js?:180:22)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
I've tried to remove the --disable-securetransport flag, see if it could have messed with something, same result.
I've tried to compile on a Linux machine, just to see if it could help, same thing.
As soon as I'm using my custom compiled exec it doesn't work in the sandbox, but when using the static one, everything is ok (after I xattr it, because it's quarantined and blocked in sandbox).
The only thing I've noticed that seems odd is that my custom compilation is only 20mo or so, when the static install I've downloaded is 43mo.
I'm really stuck with this.
So I finally was able to compile my static ffmpeg executable.
I've found my solution thanks to this answer.
Apparently, OSX has dynamic libraries located in /usr/local/bin which take precedence over everything else. So even if you try to compile your ffmpeg to be static, it won't work with these libraries on the way.
Once I've removed all those /usr/local/bin/*.dylib my build became fully static and worked perfectly in the sandbox.

Running Xcode from terminal cant open javascript script (Error: Instruments cannot open files in the “TextWrangler text document” format.")

I'm in the process of setting up our CI environment for one of our iOS projects. So far I have got Jenkins building and packaging the app from the command line. I have written a automation test in Instruments (Automation) and I want to fire this from the command line/terminal. I have followed the posts on here describing the way to do this (Start Instruments from the command line & Can the UI Automation instrument be run from the command line?) so I know this is possible.
Unfortunately, when I try this I get an alert with:
"The document “AutomatedTests.js” could not be opened. Instruments cannot open files in the “TextWrangler text document” format."
Here is the command i'm using:
/Applications/Xcode4.6.3.app/Contents/Applications/Instruments.app/Contents/MacOS/Instruments \
-t /Applications/Xcode4.6.3.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -a "/Users/[CI USERNAME]/workspace/[IOS APP FOLDER]/IOS/build/Debug-iphoneos/[IOS APP NAME].app" \
-e UIASCRIPT /Users/[CI USERNAME]/workspace/[IOS APP FOLDER]/IOS/[FOLDER CONTAINING TEST FILE]/AutomatedTests.js
https://github.com/bendyworks/bwoken
Try this instead of using xcode directly, might save you some time

Can I tap iPhone simulator back button with the help of script in UIAutomation Instruments? If yes, then how to do the same?

I want to close the application, kill it (its instance) from background and re-launch it again.
So is there any way to do this, directly or indirectly??
Start instruments from the command line, and write a system-level script to run it twice with two different scripts. When the first run finished, your app will be stopped, and relaunched, when you start the second run. Your system-level script should look like:
#!/bin/bash
instruments -t Template.tracetemplate -e UIASCRIPT script1.js
instruments -t Template.tracetemplate -e UIASCRIPT script2.js

Ubuntu 8.04 Hardy and node.js upstart script

I am trying to write an upstart script for my ubuntu machine, which is version 8.04 "Hardy". I have followed the instructions on this site: upstart for node.js but it seems like these instructions are for a current version of ubuntu.
I noticed that the /etc/init directory does not exist on my machine, first I tried putting the script in the /etc/init.d directory and then I created the /etc/init dir and placed it there.
I will post my upstart script below (which is basically the same as from the website above with some path changes), but when I run start jobname, I just get an error "start: Unknown job: jobname". So then I changed the script around to a slimmed down version, posted below, and still I get the same result.
For now, I am using the 'nohup' command to run my node server but I would like a more permanent solution.
Please, any help?
SCRIPT 1:
description "node.js chat server"
author "iandev ith3"
# used to be: start on startup
# until we found some mounts weren't ready yet while booting:
start on started mountall
stop on shutdown
# Automatically Respawn:
respawn
respawn limit 99 5
script
# Not sure why $HOME is needed, but we found that it is:
export HOME="/root"
exec /root/local/node/bin/node /home/ian/chat.js >> /var/log/node.log 2>&1
end script
post-start script
# optionally put a script here that will notifiy you node has (re)started
# /root/bin/hoptoad.sh "node.js has started!"
end script
SCRIPT 2:
description "node.js chat server"
author "iandev ith3"
script
exec /root/local/node/bin/node /home/ian/chat.js >> /var/log/node.log 2>&1
end script
Just use Forever. https://github.com/indexzero/forever
From looking at the website you provided I'd say that the /etc/init was just a typo and it should be /etc/init.d/. Some things you may want to check:
executable flag on your scripts. With most versions of Ubuntu executable files show up green when running 'ls' from the command line. If you want to check if your file is executable run 'ls -l /etc/init.d/YOUR_SCRIPT' from the command line. You will see something like this:
-rwxr-xr-x 1 root root 1342 2010-09-16 10:13 YOUR_SCRIPT
The x's mean that it is executable.
To set the executable flag if it is not set, run chmod u+x YOUR_SCRIPT
I'm pretty sure for older versions of ubuntu you need to have the script in /etc/rc.d/rc3.d or /etc/rc3.d. What linux does is run through rc0.d to rc5.d and execute every script in there. From what it looks like, ubuntu is moving away from this to something simpler so if you have rc directories you may need to edit your script a little.
Anyway I think i'm getting a little over complicated here. Check your executable flag and if you have rc directories and we'll move on from there.
May not be the best thing to start a process with sudo, but here's what I have setup on my local pc:
#!upstart
description "node.js server"
author "alessio"
start on startup
stop on shutdown
script
export HOME="/ubuntu"
exec sudo -u ubuntu /usr/bin/node /home/ubuntu/www/test.js 2>&1 >> /var/log/node.log
end script
Hope this helps.

Categories