def test_compile_with_life(set_no_life, force_compilation, restart_naoqi, cpu_server):
    logs = log_viewer(ssh_tools.get_ip())
    cpu = RemoteCPUWatch(ssh_tools.get_ip())
    cpu.start_store('test_compile_with_life')
    cpu.start_display()
    s = Session()
    s.connect(ssh_tools.get_ip())
    dialog = s.service('ALDialog')
    print "======================================="
    print "     Compiling ..."
    print "=======================================\n"
    logs.dump_logs('test_compile_with_life')
    dialog._preloadMain()
    cpu.stop_store()
    cpu.stop_display()
    logs.dump_logs('test_compile_with_life')
    print "======================================="
    print "     Log Results:"
    print " | Load time = {} s".format(logs.get_load_time())
    print " | Main Dialog total compile time = {} s".format(logs.get_bundle_compile_time('welcome'))
    print " | Main Dialog model compile time = {} s".format(logs.get_model_compile_time('welcome'))
    print " | Main Dialog Japanese reco compile time = {} s".format(logs.get_reco_compile_time('welcome', 'Japanese'))
    print " | Main Dialog English reco compile time = {} s".format(logs.get_reco_compile_time('welcome', 'English'))
    print "=======================================\n"

    print "======================================="
    print "     CPU Results:"
    print " | Virtual Memory RSS difference  = {}".format(cpu.get_naoqiservice_VmRSS_diff())
    print " | Virtual Memory Size difference = {}".format(cpu.get_naoqiservice_VmSize_diff())
    print " | Maximum 1 minute load average  = {}".format(cpu.get_cpu_lavg1_max())
    print " | Average IO time                = {}".format( cpu.get_cpu_iotime_mean())
    print " | Total Majflt                   = {}".format(cpu.get_cpu_majflt_sum())
    print " | Average system time            = {}".format(cpu.get_naoqiservice_stime_mean())
    print " | Average user time              = {}".format(cpu.get_naoqiservice_utime_mean())
    print "=======================================\n"
예제 #2
0
def check_cloud_env():
    ses = Session()
    ses.connect(ssh_tools.get_ip())
    system = ses.service("ALSystem")
    version = system.version().split(".")
    if len(version) < 2:
        print version
        sys.exit("wrong version format")
    else:
        if int(version[0]) == 2:
            if int(version[1]) < 4:
                print """Check cloud environment fixture:
                    This script is not made for versions inferior to 2.4.
                    You need to manually set the environment to preproduction. Use Simon's script to do so
                    Once you've done that, remove check_cloud_env fixture from all tests"""
                sys.exit("Exiting program")
            if int(version[1]) > 4:
                alcloud = ses.service("_ALCloud")
            if int(version[1]) == 4:
                alcloud = ses.service("ALCloud")
        if int(version[0]) != 2:
            print """Check cloud environment fixture:
                  This script is made for naoqi version 2.0. You probably need to update it in order to make it work
                  for the version you are using"""
            sys.exit("Exiting program")


    if alcloud.getEnvironment() != "ppd":
        print "Your robot cloud configuration needs to be changed to a preproduction environment."

        #clean prod settings
        #ssh_tools.runcommand('rm -r .local')

        alcloud.setEnvironment("ppd")
        print "Please wait for naoqi to restart..."
        ssh_tools.nao_restart(life=False)

        ses = Session()
        ses.connect(ssh_tools.get_ip())
        if int(version[1]) > 4:
            alcloud = ses.service("_ALCloud")
        if int(version[1]) == 4:
            alcloud = ses.service("ALCloud")

        if alcloud.getEnvironment() == "ppd":
            print "Your configuration has been successfully changed"
        else:
            print "cloud configuration seems to have failed"
            sys.exit("Exiting program")
        return True
    else:
        return False
예제 #3
0
def test_compile_with_life(set_profile_Shopfor24, force_compilation, dialog, autonomous_life):
    logs = log_viewer(ssh_tools.get_ip())
    logs.watch_compile()
    with RemoteCPUWatch(ssh_tools.get_ip()) as cpu:
        cpu.start_store()
        autonomous_life.setState("solitary")
        cpu.start_store()
        while logs.get_compile_result() is None:
            time.sleep(3)

    print "======================================="
    print "     Result = " + str(logs.get_precompile_result())
    print "======================================="
예제 #4
0
def NON_VALID_test_VALID_DIA_003_002(dialog_compile, reboot_no_life):
    s = Session()
    s.connect(ssh_tools.get_ip())
    autonomous_life = s.service("ALAutonomousLife")
    dialog = s.service("ALDialog")

    logs = log_viewer(ssh_tools.get_ip())
    logs.watch_precompile()

    autonomous_life.setState("solitary")
    while logs.get_precompile_result() is None:
        time.sleep(3)

    print "======================================="
    print "     Result = " + str(logs.get_precompile_result())
    print "======================================="
예제 #5
0
def force_compilation_old():
    s = Session()
    s.connect(ssh_tools.get_ip())
    dialog = s.service('ALDialog')
    #autonomous_life.setState("disabled")
    dialog.deleteSerializationFiles()
    dialog.resetAll()
    dialog._resetPreload()
예제 #6
0
def non_test_VALID_DIA_003_001(dialog_compile, restart_naoqi_no_life):                # Missing associate dummy profile fixture
    s = Session()
    s.connect(ssh_tools.get_ip())
    autonomous_life = s.service("ALAutonomousLife")
    dialog = s.service("ALDialog")

    logs = log_viewer(ssh_tools.get_ip())
    logs.watch_precompile()

    autonomous_life.setState("solitary")
    while logs.get_precompile_result() is None:
        time.sleep(3)
        #print "sleep"

    print "======================================="
    print "     Result = " + str(logs.get_precompile_result())
    print "======================================="
예제 #7
0
def test_toreplace_VALID_DIA_002_011(set_profile_B2C, force_compilation, dialog, autonomous_life):
    logs = log_viewer(ssh_tools.get_ip())
    logs.watch_precompile()
    y = dialog._runMain()
    while not (logs["reflex 1"] and logs["welcome 1"]):
        time.sleep(3)
    assert logs["reflex 1"] < NESTLE_BAYTRAIL_REFLEX_TIME
    assert logs["welcome 1"] < NESTLE_BAYTRAIL_WELCOME_TIME
예제 #8
0
def force_compilation(dialog, autonomous_life):
    from fabric.api import env, run
    #dialog.deleteSerializationFiles()
    env.user        = '******'
    env.password    = '******'
    env.host_string = ssh_tools.get_ip()
    run('rm -r /home/nao/.local/share/dialog/*')
#    run('rm /home/nao/.local/share/PackageManager/apps/run_dialog_dev/init/*.fcf')
    dialog._resetPreload()
예제 #9
0
def cpu_server(request):
    ip = ssh_tools.get_ip()
    kill_server(ip = ip)
    clean_server(ip = ip)
    deploy_server(ip = ip)
    run_server(ip = ip)
    def ending():
        kill_server(ip = ip)
        clean_server(ip = ip)
    request.addfinalizer(ending)
def non_compile_with_life_2(set_no_life, force_compilation, restart_naoqi, cpu_server):
    logs = log_viewer(ssh_tools.get_ip())
    logs.watch_compile()
    cpu = RemoteCPUWatch(ssh_tools.get_ip())
    cpu.start_store()
    cpu.start_display()
    print cpu.files
    s = Session()
    s.connect(ssh_tools.get_ip())
    dialog = s. service('ALDialog')
    dialog.runDialog()
    print 'Has run dialog'
    print "======================================="
    print "     Result = " + str(logs.get_compile_result())
    print "======================================="
    cpu.stop_store()
    cpu.stop_display()
    dialog.stopDialog()
    assert True
예제 #11
0
def life_off():
    s = Session()
    s.connect(ssh_tools.get_ip())
    alife = s.service('ALAutonomousLife')
    alife.setState ('disabled')
예제 #12
0
 def ending():
     s = Session()
     s.connect(ssh_tools.get_ip())
     preference_manager = s.service("ALPreferenceManager")
     preference_manager.setValue("com.aldebaran.debug", "DisableLifeAndDialog", 0)