Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: client/site_tests/hardware_SAT/hardware_SAT.py

Issue 2803016: Cutover to hardened toolchain by default (3 of 3). BUG=3981 TEST=unit,autotest (Closed) Base URL: ssh://git@chromiumos-git/autotest.git
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/deps/iotools/iotools.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging, os, re 5 import logging, os, re
6 6
7 from autotest_lib.client.bin import test, utils 7 from autotest_lib.client.bin import test, utils
8 from autotest_lib.client.common_lib import error 8 from autotest_lib.client.common_lib import error
9 9
10 class hardware_SAT(test.test): 10 class hardware_SAT(test.test):
11 version = 1 11 version = 1
12 12
13 def target_is_x86(self): 13 def target_is_x86_pie(self):
14 result = utils.system_output('${CC} -dumpmachine', retain_output=True, 14 result = utils.system_output('${CC} -dumpmachine', retain_output=True,
15 ignore_status=True) 15 ignore_status=True)
16 x86_pattern = re.compile(r"^i.86.*") 16 x86_pattern = re.compile(r"^i.86.*")
17 return x86_pattern.match(result) 17 if not x86_pattern.match(result):
18 return False
19 result = utils.system_output('${CC} -dumpspecs', retain_output=True,
20 ignore_status=True)
21 if result.find('!nopie:') == -1:
22 return False
23 return True
18 24
19 25
20 # http://code.google.com/p/stressapptest/ 26 # http://code.google.com/p/stressapptest/
21 def setup(self, tarball='stressapptest-1.0.3_autoconf.tar.gz'): 27 def setup(self, tarball='stressapptest-1.0.3_autoconf.tar.gz'):
22 # clean 28 # clean
23 if os.path.exists(self.srcdir): 29 if os.path.exists(self.srcdir):
24 utils.system('rm -rf %s' % self.srcdir) 30 utils.system('rm -rf %s' % self.srcdir)
25 31
26 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) 32 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
27 utils.extract_tarball_to_dir(tarball, self.srcdir) 33 utils.extract_tarball_to_dir(tarball, self.srcdir)
28 34
29 self.job.setup_dep(['libaio']) 35 self.job.setup_dep(['libaio'])
30 ldflags = '-L' + self.autodir + '/deps/libaio/lib' 36 ldflags = '-L' + self.autodir + '/deps/libaio/lib'
31 cflags = '-I' + self.autodir + '/deps/libaio/include' 37 cflags = '-I' + self.autodir + '/deps/libaio/include'
32 # Add paths to libaio files. 38 # Add paths to libaio files.
33 var_flags = 'LDFLAGS="' + ldflags + '"' 39 var_flags = 'LDFLAGS="' + ldflags + '"'
34 # TODO(fes): Remove this if there is a better way to detect that we are 40 if self.target_is_x86_pie():
35 # in a hardened build (or if this later properly picks up the -nopie
36 # flag from portage)
37 if os.path.exists('/etc/hardened') and self.target_is_x86():
38 var_flags += ' CXXFLAGS="-nopie ' + cflags + '"' 41 var_flags += ' CXXFLAGS="-nopie ' + cflags + '"'
39 var_flags += ' CFLAGS="-nopie ' + cflags + '"' 42 var_flags += ' CFLAGS="-nopie ' + cflags + '"'
40 else: 43 else:
41 var_flags += ' CXXFLAGS="' + cflags + '"' 44 var_flags += ' CXXFLAGS="' + cflags + '"'
42 var_flags += ' CFLAGS="' + cflags + '"' 45 var_flags += ' CFLAGS="' + cflags + '"'
43 var_flags += ' LIBS="-static -laio"' 46 var_flags += ' LIBS="-static -laio"'
44 47
45 os.chdir(self.srcdir) 48 os.chdir(self.srcdir)
46 # ./configure stores relevant path and environment variables. 49 # ./configure stores relevant path and environment variables.
47 utils.configure(configure=var_flags + ' ./configure') 50 utils.configure(configure=var_flags + ' ./configure')
(...skipping 28 matching lines...) Expand all
76 # or disk cache problems. Two threads ensure multiple 79 # or disk cache problems. Two threads ensure multiple
77 # outstanding transactions to the disk, if supported. 80 # outstanding transactions to the disk, if supported.
78 args += ' -f sat.diskthread.a' # disk thread 81 args += ' -f sat.diskthread.a' # disk thread
79 args += ' -f sat.diskthread.b' 82 args += ' -f sat.diskthread.b'
80 83
81 os.chdir(os.path.join(self.srcdir, 'src')) 84 os.chdir(os.path.join(self.srcdir, 'src'))
82 sat = utils.run('./stressapptest' + args) 85 sat = utils.run('./stressapptest' + args)
83 logging.debug(sat.stdout) 86 logging.debug(sat.stdout)
84 if not re.search('Status: PASS', sat.stdout): 87 if not re.search('Status: PASS', sat.stdout):
85 raise error.TestFail(sat.stdout) 88 raise error.TestFail(sat.stdout)
OLDNEW
« no previous file with comments | « client/deps/iotools/iotools.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698