Home | History | Annotate | Download | only in hardware_MemoryTotalSize
      1 # Copyright (c) 2010 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.
      4 
      5 import logging
      6 
      7 from autotest_lib.client.bin import test, utils
      8 from autotest_lib.client.common_lib import error
      9 
     10 class hardware_MemoryTotalSize(test.test):
     11     version = 1
     12 
     13     def run_once(self):
     14         # TODO(zmo@): this may not get total physical memory size on ARM
     15         #             or some x86 machines.
     16         mem_size = utils.memtotal()
     17         gb = mem_size / 1024.0 / 1024.0
     18         self.write_perf_keyval({"gb_memory_total": gb})
     19         logging.info("MemTotal: %.3f GB" % gb)
     20 
     21         # x86 and ARM SDRAM configurations differ significantly from each other.
     22         # Use a value specific to the architecture.
     23         # On x86, I see 1.85GiB (2GiB - reserved memory).
     24         # On ARM, I see 0.72GiB (1GiB - 256MiB carveout).
     25         cpuType = utils.get_cpu_arch()
     26         limit = 1.65
     27         if cpuType == "arm":
     28             limit = 0.65
     29 
     30         if gb <= limit:
     31             raise error.TestFail("total system memory size < %.3f GB" % limit);
     32