Home | History | Annotate | Download | only in brillo_DiskSizeTest
      1 # Copyright 2015 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 common
      6 from autotest_lib.client.common_lib import error
      7 from autotest_lib.server import test
      8 
      9 
     10 _DEFAULT_PATH = '/data'
     11 _DEFAULT_MIN_SIZE = 64 * 1024
     12 
     13 
     14 class brillo_DiskSizeTest(test.test):
     15     """Verify that a Brillo device has its wifi properly configured."""
     16     version = 1
     17 
     18     def run_once(self, host=None, path=_DEFAULT_PATH,
     19                  min_size=_DEFAULT_MIN_SIZE):
     20         """Check that a given device is large enough.
     21 
     22         @param host: a host object representing the DUT.
     23         @param path: Path to device or a location within its mounted filesystem.
     24         @param min_size: Minimum device size in 1K blocks.
     25 
     26         @raise TestFail: The test failed.
     27         """
     28         try:
     29             df_output = host.run_output('df %s' % path).splitlines()
     30         except error.AutoservRunError:
     31             raise error.TestFail('Failed to run df')
     32 
     33         device, device_size = df_output[1].split()[0:2]
     34         if int(device_size) < int(min_size):
     35             raise error.TestFail(
     36                     'Size of device %s (%s) is less than required (%s)' %
     37                     (device, device_size, min_size))
     38