| Index: client/site_tests/realtimecomm_GTalkPlayground/realtimecomm_GTalkPlayground.py
|
| diff --git a/client/site_tests/realtimecomm_GTalkPlayground/realtimecomm_GTalkPlayground.py b/client/site_tests/realtimecomm_GTalkPlayground/realtimecomm_GTalkPlayground.py
|
| index ee0e7b02f82bda09c37e761bd643e10db859e5fb..f7874c5005e3567d250d01f25388ce2c93deacc6 100755
|
| --- a/client/site_tests/realtimecomm_GTalkPlayground/realtimecomm_GTalkPlayground.py
|
| +++ b/client/site_tests/realtimecomm_GTalkPlayground/realtimecomm_GTalkPlayground.py
|
| @@ -16,60 +16,26 @@ class realtimecomm_GTalkPlayground(test.test):
|
| dep = 'realtimecomm_playground'
|
|
|
| def setup(self):
|
| - self.job.setup_dep(['realtimecomm_playground'])
|
| -
|
| - def run_cleanup(self, testdone=False):
|
| - utils.run('pkill chrome', ignore_status=True)
|
| - time.sleep(10)
|
| - utils.run('pkill GoogleTalkPlugin', ignore_status=True)
|
| - time.sleep(10)
|
| - utils.run('rm -f /tmp/tmp.log', ignore_status=True)
|
| - if testdone:
|
| - utils.run('rm -rf %s' % self.playground)
|
| - # Delete previous browser state if any
|
| - shutil.rmtree('/home/chronos/.config/chromium', ignore_errors=True)
|
| - shutil.rmtree('/home/chronos/.config/google-chrome', ignore_errors=True)
|
| -
|
| -
|
| - def run_setup(self):
|
| - if os.path.exists(self.playground):
|
| - shutil.rmtree(self.playground)
|
| - shutil.copytree(os.path.join(self.dep_dir, 'src'), self.playground)
|
| - utils.run('chown chronos %s -R' % self.playground)
|
| - src_opt = os.path.join(self.bindir, 'options')
|
| - des_path= '/home/chronos/.Google/'
|
| - opt_path= os.path.join(des_path, 'Google Talk Plugin')
|
| - des_opt = os.path.join(opt_path, 'options')
|
| - utils.run('mkdir -p \'%s\'' % opt_path)
|
| - utils.run('cp -f %s \'%s\'' % (src_opt, des_opt))
|
| - utils.run('chown chronos \'%s\' -R' % des_path)
|
| - utils.run('chmod o+r+w \'%s\'' % des_opt)
|
| + self.job.setup_dep([self.dep])
|
|
|
|
|
| def run_verification(self):
|
| # TODO(zhurun): Add more checking and perf data collection.
|
| if not os.path.exists('/tmp/tmp.log'):
|
| raise error.TestFail('GTalk log file not exist!')
|
| - try:
|
| - log = open(r'/tmp/tmp.log')
|
| - try:
|
| - content = log.read()
|
| - if not "Found V4L2 capture" in content:
|
| - raise error.TestFail('V4L2 not found!')
|
| - if not "video state, recv=1 send=1" in content:
|
| - raise error.TestFail('Error in Video send/recv!')
|
| - if not "voice state, recv=1 send=1" in content:
|
| - raise error.TestFail('Error in Audio send/recv!')
|
| - if not "Decoded framerate" in content:
|
| - raise error.TestFail('Error in Video upstream!')
|
| - if not "Rendered framerate" in content:
|
| - raise error.TestFail('Error in Video downstream!')
|
| - # Get framerate
|
| - self.get_framerate(content)
|
| - finally:
|
| - log.close()
|
| - except IOError:
|
| - raise error.TestFail('Error in reading GTalk log file!')
|
| + content = utils.read_file('/tmp/tmp.log')
|
| + if not "Found V4L2 capture" in content:
|
| + raise error.TestFail('V4L2 not found!')
|
| + if not "video state, recv=1 send=1" in content:
|
| + raise error.TestFail('Error in Video send/recv!')
|
| + if not "voice state, recv=1 send=1" in content:
|
| + raise error.TestFail('Error in Audio send/recv!')
|
| + if not "Decoded framerate" in content:
|
| + raise error.TestFail('Error in Video upstream!')
|
| + if not "Rendered framerate" in content:
|
| + raise error.TestFail('Error in Video downstream!')
|
| + # Get framerate
|
| + self.get_framerate(content)
|
|
|
|
|
| def get_framerate(self, log):
|
| @@ -105,8 +71,9 @@ class realtimecomm_GTalkPlayground(test.test):
|
| import pgutil
|
|
|
| self.performance_results = {}
|
| - self.run_cleanup()
|
| - self.run_setup()
|
| + pgutil.cleanup_playground(self.playground)
|
| + pgutil.setup_playground(os.path.join(self.dep_dir, 'src'),
|
| + self.playground, os.path.join(self.bindir, 'options'))
|
|
|
| # Launch Playground
|
| path = os.path.join(self.playground,
|
| @@ -127,9 +94,11 @@ class realtimecomm_GTalkPlayground(test.test):
|
| time.sleep(WARMUP_TIME)
|
| gtalk_s = pgutil.get_utime_stime(pgutil.get_pids('GoogleTalkPlugin'))
|
| chrome_s = pgutil.get_utime_stime(pgutil.get_pids('chrome/chrome'))
|
| + pulse_s = pgutil.get_utime_stime(pgutil.get_pids('pulseaudio'))
|
| time.sleep(SLEEP_DURATION)
|
| gtalk_e = pgutil.get_utime_stime(pgutil.get_pids('GoogleTalkPlugin'))
|
| chrome_e = pgutil.get_utime_stime(pgutil.get_pids('chrome/chrome'))
|
| + pulse_e = pgutil.get_utime_stime(pgutil.get_pids('pulseaudio'))
|
|
|
| self.performance_results['ctime_gtalk'] = \
|
| pgutil.get_cpu_usage(SLEEP_DURATION, gtalk_e[0] - gtalk_s[0])
|
| @@ -139,12 +108,16 @@ class realtimecomm_GTalkPlayground(test.test):
|
| pgutil.get_cpu_usage(SLEEP_DURATION, chrome_e[0] - chrome_s[0])
|
| self.performance_results['stime_chrome'] = \
|
| pgutil.get_cpu_usage(SLEEP_DURATION, chrome_e[1] - chrome_s[1])
|
| + self.performance_results['ctime_pulse'] = \
|
| + pgutil.get_cpu_usage(SLEEP_DURATION, pulse_e[0] - pulse_s[0])
|
| + self.performance_results['stime_pulse'] = \
|
| + pgutil.get_cpu_usage(SLEEP_DURATION, pulse_e[1] - pulse_s[1])
|
|
|
| # Verify log
|
| try:
|
| self.run_verification()
|
| finally:
|
| - self.run_cleanup(True)
|
| + pgutil.cleanup_playground(self.playground, True)
|
|
|
| # Report perf
|
| self.write_perf_keyval(self.performance_results)
|
|
|