~nuclearbob/ubuntu-test-cases/touch-trace-export-dev

« back to all changes in this revision

Viewing changes to scripts/reboot-and-wait

  • Committer: Max Brustkern
  • Date: 2014-10-06 21:01:14 UTC
  • mfrom: (187.1.126 touch)
  • Revision ID: max@canonical.com-20141006210114-dxf7s210oyokzwl4
Merged latest changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
import argparse
4
4
import logging
 
5
import os
 
6
import subprocess
5
7
import time
6
8
 
7
9
from phabletutils.device import AndroidBridge
8
10
 
 
11
EMULATOR = os.environ.get('USE_EMULATOR', '')
 
12
 
9
13
 
10
14
def _get_arg_parser():
11
15
    parser = argparse.ArgumentParser(
34
38
    return 1
35
39
 
36
40
 
 
41
def emulator_main(args):
 
42
    emulator = os.path.join(os.path.dirname(__file__), 'run-emulator')
 
43
    subprocess.check_call([emulator])
 
44
 
 
45
 
37
46
if __name__ == '__main__':
38
47
    logging.basicConfig(level=logging.INFO)
39
48
    logging.getLogger().name = 'reboot-and-wait'
40
49
    args = _get_arg_parser().parse_args()
41
 
    exit(main(args))
 
50
    if EMULATOR:
 
51
        logging.info('using emulator logic for reboot')
 
52
        exit(emulator_main(args))
 
53
    else:
 
54
        exit(main(args))