Hackbench test: Applying missing fix

Applied missing fix from Eric Li that was supposed
to get in r4500, but it wasn't. Also, use
utils.open_write_close() on the test module.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: Eric Li <ericli@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@4576 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/hackbench/hackbench.py b/client/tests/hackbench/hackbench.py
index b2375ac..5861888 100644
--- a/client/tests/hackbench/hackbench.py
+++ b/client/tests/hackbench/hackbench.py
@@ -17,7 +17,11 @@
 
     def setup(self):
         os.chdir(self.srcdir)
-        utils.system('cc -lpthread hackbench.c -o hackbench')
+        if 'CC' in os.environ:
+          cc = '$CC'
+        else:
+          cc = 'cc'
+        utils.system('%s -lpthread hackbench.c -o hackbench' % cc)
 
 
     def initialize(self):
@@ -38,9 +42,7 @@
         self.results = raw_output
 
         path = os.path.join(self.resultsdir, 'raw_output_%s' % self.iteration)
-        raw_output_file = open(path, 'w')
-        raw_output_file.write(raw_output)
-        raw_output_file.close()
+        utils.open_write_close(path, raw_output)
 
 
     def postprocess_iteration(self):