Cleaned up
This commit is contained in:
parent
2922e3ba92
commit
54d5365907
|
@ -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
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue