Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions Supporting Files/CI/subliminal-test
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ print_usage_and_fail () {
subliminal-test (-project <project_path> | -workspace <workspace_path> | -prebuilt_app <app_path>)
( -sim_device <device_type> | -hw_id <udid> )
[-build_tool <tool_name>] [-scheme <scheme_name>] [-sdk <sdk>] [-replacement_bundle_id <id>] [--quiet_build]
[-sim_version <version>] [-timeout <timeout>] [-output <output_dir>]
[-sim_version <version>] [-timeout <timeout>] [-output <output_dir>] [-upload_crash_logs <upload_time>]
[-e <variable> <value>]

\`subliminal-test\` builds a scheme contained in an Xcode project or Xcode workspace,
Expand Down Expand Up @@ -134,6 +134,9 @@ Optional testing arguments:

Has no default value.

-upload_crash_logs <upload_time> If the app aborts during a test run, restart the app and idle for <upload_time>
to give the app an opportunity to upload crash logs.

--verbose_logging Enables UIAutomation's debug logs, which record every user interaction simulated
by the Automation instrument.

Expand Down Expand Up @@ -187,7 +190,7 @@ case $1 in
shift 1;;

# Set argument, wait for value
-project|-workspace|-prebuilt_app|-sim_device|-hw_id|-build_tool|-scheme|-configuration|-sdk|-replacement_bundle_id|-sim_version|-timeout|-output|-e)
-project|-workspace|-prebuilt_app|-sim_device|-hw_id|-build_tool|-scheme|-configuration|-sdk|-replacement_bundle_id|-sim_version|-timeout|-output|-upload_crash_logs|-e)
if [[ -n "$CURRENT_ARG" ]]; then
echo "Missing value for argument: $CURRENT_ARG"
print_usage_and_fail
Expand Down Expand Up @@ -673,5 +676,18 @@ if [[ -d "${OUTPUT}" ]]; then
mv "$RESULTS_DIR/Run 1" "$OUTPUT/Run Data"
fi

# If the app crashed, start it back up so that crash logs can be uploaded
if [ $TEST_STATUS -eq 1 ] && [[ -n "$UPLOAD_CRASH_LOGS" ]]; then
echo "\nStarting up app again to allow crash logs to upload..."

IDLE_SCRIPT=`mktemp /tmp/subliminal-test.idle_script.XXXXXX`
echo "UIATarget.localTarget().delay($UPLOAD_CRASH_LOGS);" > "$IDLE_SCRIPT"

DEVICE=`[[ -n "$HW_ID" ]] && echo "$HW_ID" || echo "$SIM_DEVICE - Simulator - iOS $SIM_VERSION"`
instruments -w "$DEVICE" -t Automation "$APP" -e UIASCRIPT "$IDLE_SCRIPT"

rm -rf "$IDLE_SCRIPT"
fi

echo "\n\nRun complete."
cleanup_and_exit $TEST_STATUS