Cleaned up
This commit is contained in:
parent
2922e3ba92
commit
54d5365907
|
@ -10,17 +10,19 @@ if [ ! -f "$GENY_TEMPLATE" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
contents=$(cat $GENY_TEMPLATE)
|
|
||||||
getAbort() {
|
getAbort() {
|
||||||
echo "ABORT SIGNAL detected! Stopping all created emulators..."
|
if [ "$GENYMOTION" = true ]; then
|
||||||
for row in $(echo "${contents}" | jq -r '.[] | @base64'); do
|
contents=$(cat $GENY_TEMPLATE)
|
||||||
get_value() {
|
echo "ABORT SIGNAL detected! Stopping all created emulators..."
|
||||||
echo ${row} | base64 --decode | jq -r ${1}
|
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"
|
gmtool --cloud admin stopdisposable $(get_value '.device')
|
||||||
|
done
|
||||||
|
echo "Done"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
trap 'getAbort; exit' EXIT
|
trap 'getAbort; exit' EXIT
|
||||||
|
|
||||||
|
|
|
@ -190,13 +190,17 @@ def run():
|
||||||
prepare_avd(device, avd_name)
|
prepare_avd(device, avd_name)
|
||||||
|
|
||||||
logger.info('Run emulator...')
|
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)
|
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)))
|
appium = convert_str_to_bool(str(os.getenv('APPIUM', False)))
|
||||||
if appium:
|
if appium:
|
||||||
|
subprocess.Popen(cmd.split())
|
||||||
logger.info('Run appium server...')
|
logger.info('Run appium server...')
|
||||||
appium_run(avd_name)
|
appium_run(avd_name)
|
||||||
|
else:
|
||||||
|
result = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE).communicate()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
run()
|
run()
|
||||||
|
|
|
@ -4,9 +4,9 @@ if [ -z "$GENY_TEMPLATE" ]; then
|
||||||
GENY_TEMPLATE="/root/tmp/devices.json"
|
GENY_TEMPLATE="/root/tmp/devices.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
contents=$(cat $GENY_TEMPLATE)
|
|
||||||
|
|
||||||
function prepare_geny_cloud() {
|
function prepare_geny_cloud() {
|
||||||
|
contents=$(cat $GENY_TEMPLATE)
|
||||||
|
|
||||||
# Register
|
# Register
|
||||||
gmtool config username="${USER}" password="${PASS}"
|
gmtool config username="${USER}" password="${PASS}"
|
||||||
gmtool license register "${LICENSE}"
|
gmtool license register "${LICENSE}"
|
||||||
|
@ -49,10 +49,10 @@ function run_appium() {
|
||||||
$CMD
|
$CMD
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $REAL_DEVICE = true ]]; then
|
if [ "$REAL_DEVICE" = true ]; then
|
||||||
echo "Using real device"
|
echo "Using real device"
|
||||||
run_appium
|
run_appium
|
||||||
elif [[ $GENYMOTION = true ]]; then
|
elif [ "$GENYMOTION" = true ]; then
|
||||||
echo "Using Genymotion"
|
echo "Using Genymotion"
|
||||||
prepare_geny_cloud
|
prepare_geny_cloud
|
||||||
run_appium
|
run_appium
|
||||||
|
|
|
@ -16,12 +16,12 @@ function auto_record() {
|
||||||
echo "Auto record: $AUTO_RECORD"
|
echo "Auto record: $AUTO_RECORD"
|
||||||
sleep 6
|
sleep 6
|
||||||
|
|
||||||
while [ $AUTO_RECORD == true ]; do
|
while [ "$AUTO_RECORD" = true ]; do
|
||||||
# Check if there is test running
|
# Check if there is test running
|
||||||
no_test=true
|
no_test=true
|
||||||
while $no_test; do
|
while $no_test; do
|
||||||
task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value')
|
task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value')
|
||||||
if [ "$task" == "" ] || [ "$task" == "[]" ]; then
|
if [ "$task" = "" ] || [ "$task" = "[]" ]; then
|
||||||
sleep .5
|
sleep .5
|
||||||
else
|
else
|
||||||
start &
|
start &
|
||||||
|
@ -30,9 +30,9 @@ function auto_record() {
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check if test is finished
|
# 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')
|
task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value')
|
||||||
if [ "$task" == "" ] || [ "$task" == "[]" ]; then
|
if [ "$task" = "" ] || [ "$task" = "[]" ]; then
|
||||||
stop
|
stop
|
||||||
no_test=true
|
no_test=true
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue