Skip to content

Commit bf9b03d

Browse files
committed
Merge #13094: tests: Add test for 64-bit Windows PE, modify 32-bit test results
ab3f4dd tests: Add test for 64-bit PE, modify 32-bit test results (Chun Kuan Lee) Pull request description: 9a75d29 change the error result from `PIE` to `DYNAMIC_BASE`. And there are no test for 64-bit, so I made one Tree-SHA512: 9d5643dadf4d9fc34ea32d94655bfb98eec2f7bc2820b4b0f525d5acf1cd22f3acf38bf8904dda4f50fd9ca5a5e56d566a392e6f804eea6e50e03cba40048621
2 parents 5778d44 + ab3f4dd commit bf9b03d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

contrib/devtools/test-security-check.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,28 @@ def test_ELF(self):
4343
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE']),
4444
(0, ''))
4545

46-
def test_PE(self):
46+
def test_32bit_PE(self):
4747
source = 'test1.c'
4848
executable = 'test1.exe'
4949
cc = 'i686-w64-mingw32-gcc'
5050
write_testcode(source)
5151

5252
self.assertEqual(call_security_check(cc, source, executable, []),
53-
(1, executable+': failed PIE NX'))
53+
(1, executable+': failed DYNAMIC_BASE NX'))
5454
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat']),
55-
(1, executable+': failed PIE'))
55+
(1, executable+': failed DYNAMIC_BASE'))
5656
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase']),
5757
(0, ''))
58+
def test_64bit_PE(self):
59+
source = 'test1.c'
60+
executable = 'test1.exe'
61+
cc = 'x86_64-w64-mingw32-gcc'
62+
write_testcode(source)
63+
64+
self.assertEqual(call_security_check(cc, source, executable, []), (1, executable+': failed DYNAMIC_BASE NX\n'+executable+': warning HIGH_ENTROPY_VA'))
65+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat']), (1, executable+': failed DYNAMIC_BASE\n'+executable+': warning HIGH_ENTROPY_VA'))
66+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase']), (0, executable+': warning HIGH_ENTROPY_VA'))
67+
self.assertEqual(call_security_check(cc, source, executable, ['-Wl,--nxcompat','-Wl,--dynamicbase','-Wl,--high-entropy-va']), (0, ''))
5868

5969
if __name__ == '__main__':
6070
unittest.main()

0 commit comments

Comments
 (0)