summaryrefslogtreecommitdiff
path: root/automated/android/apk-automation/linpack.py
blob: d71687fe3bf3ab830fb4e5e5de33175291942882 (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
50
51
52
53
54
import time
from common import ApkTestRunner


class ApkRunnerImpl(ApkTestRunner):
    def __init__(self, config):
        self.config = config
        self.config['apk_file_name'] = "com.greenecomputing.linpack-1.apk"
        self.config['apk_package'] = "com.greenecomputing.linpack"
        self.config['activity'] = "com.greenecomputing.linpack/.Linpack"
        super(ApkRunnerImpl, self).__init__(self.config)

    def execute(self):
        # single core test.
        time.sleep(2)
        self.dump_always()
        start_single_button = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/btnsingle")
        start_single_button.touch()

        time.sleep(2)
        self.dump_always()
        start_single_button = self.vc.findViewById("com.greenecomputing.linpack:id/btnsingle")

        while not start_single_button:
            time.sleep(2)
            self.dump_always()
            start_single_button = self.vc.findViewById("com.greenecomputing.linpack:id/btnsingle")

        mflops_single_score = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txtmflops_result")
        time_single_score = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txttime_result")
        self.report_result('Linpack-MFLOPSSingleScore', 'pass', mflops_single_score.getText(), 'MFLOPS')
        self.report_result('Linpack-TimeSingleScore', 'pass', time_single_score.getText(), 'seconds')

        # Multi core test.
        self.dump_always()
        start_multi_button = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/btncalculate")
        start_multi_button.touch()

        time.sleep(2)
        self.dump_always()
        start_single_button = self.vc.findViewById("com.greenecomputing.linpack:id/btnsingle")

        while not start_single_button:
            time.sleep(2)
            self.dump_always()
            start_single_button = self.vc.findViewById("com.greenecomputing.linpack:id/btnsingle")

        mflops_multi_score = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txtmflops_result")
        time_multi_score = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txttime_result")
        self.report_result('Linpack-MFLOPSMultiScore', 'pass', mflops_multi_score.getText(), 'MFLOPS')
        self.report_result('Linpack-TimeMultiScore', 'pass', time_multi_score.getText(), 'seconds')

    def parseResult(self):
        pass