Skip to content

Commit

Permalink
scripts: add MACHO tests to test-security-check.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fanquake committed Mar 26, 2020
1 parent 2e97d80 commit 1a4e9f3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions contrib/devtools/test-security-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ def test_64bit_PE(self):
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()

0 comments on commit 1a4e9f3

Please sign in to comment.