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: |