(self)
| 27 | |
| 28 | class TestSecurityChecks(unittest.TestCase): |
| 29 | def test_ELF(self): |
| 30 | source = 'test1.c' |
| 31 | executable = 'test1' |
| 32 | cc = 'gcc' |
| 33 | write_testcode(source) |
| 34 | |
| 35 | self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-zexecstack','-fno-stack-protector','-Wl,-znorelro','-no-pie','-fno-PIE']), |
| 36 | (1, executable+': failed PIE NX RELRO Canary')) |
| 37 | self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fno-stack-protector','-Wl,-znorelro','-no-pie','-fno-PIE']), |
| 38 | (1, executable+': failed PIE RELRO Canary')) |
| 39 | self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-znorelro','-no-pie','-fno-PIE']), |
| 40 | (1, executable+': failed PIE RELRO')) |
| 41 | self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-znorelro','-pie','-fPIE']), |
| 42 | (1, executable+': failed RELRO')) |
| 43 | self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE']), |
| 44 | (0, '')) |
| 45 | |
| 46 | def test_32bit_PE(self): |
| 47 | source = 'test1.c' |
nothing calls this directly
no test coverage detected