blob: 9fba9bf4051b2d3de707b4ab7ebea12a60b058d8 [file] [log] [blame]
Milosz Wasilewskiab48dca2017-03-30 18:54:46 +01001import time
2from common import ApkTestRunner
3
4
5class ApkRunnerImpl(ApkTestRunner):
6 def __init__(self, config):
7 self.config = config
8 self.config['apk_file_name'] = "com.greenecomputing.linpack-1.apk"
9 self.config['apk_package'] = "com.greenecomputing.linpack"
10 self.config['activity'] = "com.greenecomputing.linpack/.Linpack"
11 super(ApkRunnerImpl, self).__init__(self.config)
12
13 def execute(self):
14 # single core test.
Yongqin Liucb654e62018-08-15 19:47:06 +080015 find_start_btn = False
16 while not find_start_btn:
Milosz Wasilewskiab48dca2017-03-30 18:54:46 +010017 time.sleep(2)
18 self.dump_always()
Yongqin Liucb654e62018-08-15 19:47:06 +080019 warn_msg = self.vc.findViewWithText(u'This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.')
Yongqin Liudb5f7c02020-07-24 14:59:53 +080020 continue_btn = self.vc.findViewWithText(u'CONTINUE')
Yongqin Liucb654e62018-08-15 19:47:06 +080021 if warn_msg:
22 self.logger.info("Older version warning popped up")
23 warning_ok_btn = self.vc.findViewWithTextOrRaise(u'OK')
24 warning_ok_btn.touch()
Yongqin Liudb5f7c02020-07-24 14:59:53 +080025 elif continue_btn:
26 continue_btn.touch()
Yongqin Liucb654e62018-08-15 19:47:06 +080027 else:
28 start_single_button = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/btnsingle")
29 start_single_button.touch()
30 find_start_btn = True
31
32 # using start_single_button to check if the test finished
33 test_finished = False
34 while not test_finished:
35 time.sleep(2)
36 self.dump_always()
37 if self.vc.findViewById("com.greenecomputing.linpack:id/btnsingle"):
38 test_finished = True
Milosz Wasilewskiab48dca2017-03-30 18:54:46 +010039
40 mflops_single_score = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txtmflops_result")
41 time_single_score = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txttime_result")
42 self.report_result('Linpack-MFLOPSSingleScore', 'pass', mflops_single_score.getText(), 'MFLOPS')
43 self.report_result('Linpack-TimeSingleScore', 'pass', time_single_score.getText(), 'seconds')
44
45 # Multi core test.
46 self.dump_always()
47 start_multi_button = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/btncalculate")
48 start_multi_button.touch()
49
Yongqin Liucb654e62018-08-15 19:47:06 +080050 # using start_single_button to check if the test finished
51 test_finished = False
52 while not test_finished:
Milosz Wasilewskiab48dca2017-03-30 18:54:46 +010053 time.sleep(2)
54 self.dump_always()
Yongqin Liucb654e62018-08-15 19:47:06 +080055 if self.vc.findViewById("com.greenecomputing.linpack:id/btnsingle"):
56 test_finished = True
Milosz Wasilewskiab48dca2017-03-30 18:54:46 +010057
58 mflops_multi_score = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txtmflops_result")
59 time_multi_score = self.vc.findViewByIdOrRaise("com.greenecomputing.linpack:id/txttime_result")
60 self.report_result('Linpack-MFLOPSMultiScore', 'pass', mflops_multi_score.getText(), 'MFLOPS')
61 self.report_result('Linpack-TimeMultiScore', 'pass', time_multi_score.getText(), 'seconds')
62
63 def parseResult(self):
64 pass