Milosz Wasilewski | ab48dca | 2017-03-30 18:54:46 +0100 | [diff] [blame] | 1 | import time |
| 2 | from common import ApkTestRunner |
| 3 | |
| 4 | |
| 5 | class 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 Liu | cb654e6 | 2018-08-15 19:47:06 +0800 | [diff] [blame] | 15 | find_start_btn = False |
| 16 | while not find_start_btn: |
Milosz Wasilewski | ab48dca | 2017-03-30 18:54:46 +0100 | [diff] [blame] | 17 | time.sleep(2) |
| 18 | self.dump_always() |
Yongqin Liu | cb654e6 | 2018-08-15 19:47:06 +0800 | [diff] [blame] | 19 | 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 Liu | db5f7c0 | 2020-07-24 14:59:53 +0800 | [diff] [blame^] | 20 | continue_btn = self.vc.findViewWithText(u'CONTINUE') |
Yongqin Liu | cb654e6 | 2018-08-15 19:47:06 +0800 | [diff] [blame] | 21 | 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 Liu | db5f7c0 | 2020-07-24 14:59:53 +0800 | [diff] [blame^] | 25 | elif continue_btn: |
| 26 | continue_btn.touch() |
Yongqin Liu | cb654e6 | 2018-08-15 19:47:06 +0800 | [diff] [blame] | 27 | 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 Wasilewski | ab48dca | 2017-03-30 18:54:46 +0100 | [diff] [blame] | 39 | |
| 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 Liu | cb654e6 | 2018-08-15 19:47:06 +0800 | [diff] [blame] | 50 | # using start_single_button to check if the test finished |
| 51 | test_finished = False |
| 52 | while not test_finished: |
Milosz Wasilewski | ab48dca | 2017-03-30 18:54:46 +0100 | [diff] [blame] | 53 | time.sleep(2) |
| 54 | self.dump_always() |
Yongqin Liu | cb654e6 | 2018-08-15 19:47:06 +0800 | [diff] [blame] | 55 | if self.vc.findViewById("com.greenecomputing.linpack:id/btnsingle"): |
| 56 | test_finished = True |
Milosz Wasilewski | ab48dca | 2017-03-30 18:54:46 +0100 | [diff] [blame] | 57 | |
| 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 |