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