summaryrefslogtreecommitdiff
path: root/linpack/vc.py
blob: 3e854564454684b8d1e4773269a934474bee9bb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import re
import sys
import os
import time
from subprocess import call

from com.dtmilano.android.viewclient import ViewClient, ViewNotFoundException

parent_dir = os.path.realpath(os.path.dirname(__file__))
f_output_result="%s/../common/output-test-result.sh" % parent_dir

kwargs1 = {'verbose': False, 'ignoresecuredevice': False}
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
kwargs2 = {'startviewserver': True, 'forceviewserveruse': False, 'autodump': False, 'ignoreuiautomatorkilled': True, 'compresseddump': False}
vc = ViewClient(device, serialno, **kwargs2)

time.sleep(2)
vc.dump(window='-1')
start_single_button = vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/btnsingle")
start_single_button.touch()
time.sleep(2)
vc.dump(window='-1')
start_single_button = vc.findViewById("com.greenecomputing.linpack:id/btnsingle")
while not start_single_button:
    time.sleep(2)
    vc.dump(window='-1')
    start_single_button = vc.findViewById("com.greenecomputing.linpack:id/btnsingle")

mflops_single_score = vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txtmflops_result")
time_single_score = vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txttime_result")

call([f_output_result, 'Linpack_MFLOPSSingleScore', 'pass', mflops_single_score.getText(), 'MFLOPS'])
call([f_output_result, 'Linpack_TimeSingleScore', 'pass', time_single_score.getText(), 'seconds'])

start_multi_button = vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/btncalculate")
start_multi_button.touch()
time.sleep(2)
vc.dump(window='-1')
start_single_button = vc.findViewById("com.greenecomputing.linpack:id/btnsingle")
while not start_single_button:
    time.sleep(2)
    vc.dump(window='-1')
    start_single_button = vc.findViewById("com.greenecomputing.linpack:id/btnsingle")

mflops_multi_score = vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txtmflops_result")
time_multi_score = vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txttime_result")

call([f_output_result, 'Linpack_MFLOPSMultiScore', 'pass', mflops_multi_score.getText(), 'MFLOPS'])
call([f_output_result, 'Linpack_TimeMultiScore', 'pass', time_multi_score.getText(), 'seconds'])