Home | History | Annotate | Download | only in crosperf
      1 #!/usr/bin/env python2
      2 
      3 # Copyright 2011 Google Inc. All Rights Reserved.
      4 """Test for crosperf."""
      5 
      6 from __future__ import print_function
      7 
      8 import os
      9 import tempfile
     10 import unittest
     11 import crosperf
     12 from cros_utils.file_utils import FileUtils
     13 
     14 EXPERIMENT_FILE_1 = """
     15   board: x86-alex
     16   remote: chromeos-alex3
     17 
     18   benchmark: PageCycler {
     19     iterations: 3
     20   }
     21 
     22   image1 {
     23     chromeos_image: /usr/local/google/cros_image1.bin
     24   }
     25 
     26   image2 {
     27     chromeos_image: /usr/local/google/cros_image2.bin
     28   }
     29   """
     30 
     31 
     32 class CrosPerfTest(unittest.TestCase):
     33   """Class to test Crosperf."""
     34 
     35   def testDryRun(self):
     36     filehandle, filename = tempfile.mkstemp()
     37     os.write(filehandle, EXPERIMENT_FILE_1)
     38     crosperf.Main(['', filename, '--dry_run'])
     39     os.remove(filename)
     40 
     41 
     42 if __name__ == '__main__':
     43   FileUtils.Configure(True)
     44   unittest.main()
     45