1#!/usr/bin/env python2 2 3# Copyright 2011 Google Inc. All Rights Reserved. 4"""Test for crosperf.""" 5 6from __future__ import print_function 7 8import os 9import tempfile 10import unittest 11import crosperf 12from cros_utils.file_utils import FileUtils 13 14EXPERIMENT_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 32class 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 42if __name__ == '__main__': 43 FileUtils.Configure(True) 44 unittest.main() 45