Skip to content

Commit 1a4e9f3

Browse files
committed
scripts: add MACHO tests to test-security-check.py
1 parent 2e97d80 commit 1a4e9f3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

contrib/devtools/test-security-check.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ def test_64bit_PE(self):
5454
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase','-Wl,--no-high-entropy-va']), (1, executable+': failed HIGH_ENTROPY_VA'))
5555
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase','-Wl,--high-entropy-va']), (0, ''))
5656

57+
def test_MACHO(self):
58+
source = 'test1.c'
59+
executable = 'test1'
60+
cc = 'clang'
61+
write_testcode(source)
62+
63+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie','-Wl,-flat_namespace']),
64+
(1, executable+': failed PIE NOUNDEFS'))
65+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-no_pie']),
66+
(1, executable+': failed PIE'))
67+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-pie']),
68+
(0, ''))
69+
5770
if __name__ == '__main__':
5871
unittest.main()
5972

0 commit comments

Comments
 (0)