1# Lint as: python2, python3 2# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5import time 6from autotest_lib.client.bin import test 7from autotest_lib.client.common_lib import error 8from autotest_lib.client.cros.graphics import graphics_utils 9 10 11class graphics_KernelMemory(graphics_utils.GraphicsTest): 12 """ 13 Reads from sysfs to determine kernel gem objects and memory info. 14 """ 15 version = 1 16 17 def initialize(self): 18 super(graphics_KernelMemory, self).initialize() 19 20 @graphics_utils.GraphicsTest.failure_report_decorator('graphics_KernelMemory') 21 def run_once(self): 22 # TODO(ihf): We want to give this test something well-defined to 23 # measure. For now that will be the CrOS login-screen memory use. 24 # We could also log into the machine using telemetry, but that is 25 # still flaky. So for now we, lame as we are, just sleep a bit. 26 time.sleep(10.0) 27 28 self._GSC.finalize() 29 # We should still be in the login screen and memory use > 0. 30 if self._GSC.get_memory_access_errors() > 0: 31 raise error.TestFail('Failed: Detected %d errors accessing graphics' 32 ' memory.' % self._GSC.get_memory_access_errors()) 33