diff options
author | fanquake <fanquake@gmail.com> | 2020-03-24 12:37:57 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-03-26 11:39:34 +0800 |
commit | 1a4e9f32efcc5f6a74290446dc58784fd85c7b31 (patch) | |
tree | 7e0ee66bae96571446ed699d7b1ee75a32fe0541 | |
parent | 2e97d8001705214b6b915b61a2c9c34832b85323 (diff) |
scripts: add MACHO tests to test-security-check.py
-rwxr-xr-x | contrib/devtools/test-security-check.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/devtools/test-security-check.py b/contrib/devtools/test-security-check.py index 438d5f6bf0..d65e75f12d 100755 --- a/contrib/devtools/test-security-check.py +++ b/contrib/devtools/test-security-check.py @@ -54,6 +54,19 @@ class TestSecurityChecks(unittest.TestCase): self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase','-Wl,--no-high-entropy-va']), (1, executable+': failed HIGH_ENTROPY_VA')) self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase','-Wl,--high-entropy-va']), (0, '')) + def test_MACHO(self): + source = 'test1.c' + executable = 'test1' + cc = 'clang' + write_testcode(source) + + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace']), + (1, executable+': failed PIE NOUNDEFS')) + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie']), + (1, executable+': failed PIE')) + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-pie']), + (0, '')) + if __name__ == '__main__': unittest.main() |