diff --git a/genymotion/geny_start.sh b/genymotion/geny_start.sh index 5e0671d..46ecb95 100755 --- a/genymotion/geny_start.sh +++ b/genymotion/geny_start.sh @@ -10,17 +10,19 @@ if [ ! -f "$GENY_TEMPLATE" ]; then exit 1 fi -contents=$(cat $GENY_TEMPLATE) getAbort() { - echo "ABORT SIGNAL detected! Stopping all created emulators..." - for row in $(echo "${contents}" | jq -r '.[] | @base64'); do - get_value() { - echo ${row} | base64 --decode | jq -r ${1} - } - - gmtool --cloud admin stopdisposable $(get_value '.device') - done - echo "Done" + if [ "$GENYMOTION" = true ]; then + contents=$(cat $GENY_TEMPLATE) + echo "ABORT SIGNAL detected! Stopping all created emulators..." + for row in $(echo "${contents}" | jq -r '.[] | @base64'); do + get_value() { + echo ${row} | base64 --decode | jq -r ${1} + } + + gmtool --cloud admin stopdisposable $(get_value '.device') + done + echo "Done" + fi } trap 'getAbort; exit' EXIT diff --git a/src/app.py b/src/app.py index 3d33868..f309876 100644 --- a/src/app.py +++ b/src/app.py @@ -190,13 +190,17 @@ def run(): prepare_avd(device, avd_name) logger.info('Run emulator...') + dp_size = os.getenv('DATAPARTITION', '550m') + with open("/root/android_emulator/config.ini", "a") as cfg: + cfg.write('\ndisk.dataPartition.size={dp}'.format(dp=dp_size)) cmd = 'emulator -avd {name} -gpu off -verbose'.format(name=avd_name) - subprocess.Popen(cmd.split()) - appium = convert_str_to_bool(str(os.getenv('APPIUM', False))) if appium: + subprocess.Popen(cmd.split()) logger.info('Run appium server...') appium_run(avd_name) + else: + result = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE).communicate() if __name__ == '__main__': run() diff --git a/src/appium.sh b/src/appium.sh index 9a8bab3..2278c70 100644 --- a/src/appium.sh +++ b/src/appium.sh @@ -4,9 +4,9 @@ if [ -z "$GENY_TEMPLATE" ]; then GENY_TEMPLATE="/root/tmp/devices.json" fi -contents=$(cat $GENY_TEMPLATE) - function prepare_geny_cloud() { + contents=$(cat $GENY_TEMPLATE) + # Register gmtool config username="${USER}" password="${PASS}" gmtool license register "${LICENSE}" @@ -49,10 +49,10 @@ function run_appium() { $CMD } -if [[ $REAL_DEVICE = true ]]; then +if [ "$REAL_DEVICE" = true ]; then echo "Using real device" run_appium -elif [[ $GENYMOTION = true ]]; then +elif [ "$GENYMOTION" = true ]; then echo "Using Genymotion" prepare_geny_cloud run_appium diff --git a/src/record.sh b/src/record.sh index d63a087..1f2f485 100644 --- a/src/record.sh +++ b/src/record.sh @@ -16,12 +16,12 @@ function auto_record() { echo "Auto record: $AUTO_RECORD" sleep 6 - while [ $AUTO_RECORD == true ]; do + while [ "$AUTO_RECORD" = true ]; do # Check if there is test running no_test=true while $no_test; do task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value') - if [ "$task" == "" ] || [ "$task" == "[]" ]; then + if [ "$task" = "" ] || [ "$task" = "[]" ]; then sleep .5 else start & @@ -30,9 +30,9 @@ function auto_record() { done # Check if test is finished - while [ $no_test == false ]; do + while [ $no_test = false ]; do task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value') - if [ "$task" == "" ] || [ "$task" == "[]" ]; then + if [ "$task" = "" ] || [ "$task" = "[]" ]; then stop no_test=true else