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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/deps/iotools/iotools.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/site_tests/hardware_SAT/hardware_SAT.py
diff --git a/client/site_tests/hardware_SAT/hardware_SAT.py b/client/site_tests/hardware_SAT/hardware_SAT.py
index 16e150a0d69cb661de46a6f79c080b3c40350bb7..bcebaa5ca629b81a6cf04662d9e8187d4c5f22c2 100644
--- a/client/site_tests/hardware_SAT/hardware_SAT.py
+++ b/client/site_tests/hardware_SAT/hardware_SAT.py
@@ -10,11 +10,17 @@ from autotest_lib.client.common_lib import error
class hardware_SAT(test.test):
version = 1
- def target_is_x86(self):
+ def target_is_x86_pie(self):
result = utils.system_output('${CC} -dumpmachine', retain_output=True,
ignore_status=True)
x86_pattern = re.compile(r"^i.86.*")
- return x86_pattern.match(result)
+ if not x86_pattern.match(result):
+ return False
+ result = utils.system_output('${CC} -dumpspecs', retain_output=True,
+ ignore_status=True)
+ if result.find('!nopie:') == -1:
+ return False
+ return True
# http://code.google.com/p/stressapptest/
@@ -31,10 +37,7 @@ class hardware_SAT(test.test):
cflags = '-I' + self.autodir + '/deps/libaio/include'
# Add paths to libaio files.
var_flags = 'LDFLAGS="' + ldflags + '"'
- # TODO(fes): Remove this if there is a better way to detect that we are
- # in a hardened build (or if this later properly picks up the -nopie
- # flag from portage)
- if os.path.exists('/etc/hardened') and self.target_is_x86():
+ if self.target_is_x86_pie():
var_flags += ' CXXFLAGS="-nopie ' + cflags + '"'
var_flags += ' CFLAGS="-nopie ' + cflags + '"'
else:
« 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