Home | History | Annotate | Download | only in security_Libcontainer
      1 # Copyright 2017 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 from autotest_lib.client.bin import test, utils
      6 
      7 import os
      8 
      9 class security_Libcontainer(test.test):
     10     """Runs libcontainer unit tests in the device.
     11 
     12     This is useful since some features (like user namespacing) can only really
     13     be tested outside of a chroot environment.
     14     """
     15     version = 1
     16     executable = 'libcontainer_target_test'
     17 
     18 
     19     def setup(self):
     20         """Builds the binary for the device."""
     21         os.chdir(self.srcdir)
     22         utils.make()
     23 
     24 
     25     def run_once(self):
     26         """Runs the test on the device."""
     27         binpath = os.path.join(self.srcdir, self.executable)
     28         utils.system_output(binpath, retain_output=True)
     29