(cc, source, executable, options)
| 29 | os.remove(executable) |
| 30 | |
| 31 | def call_security_check(cc, source, executable, options): |
| 32 | # This should behave the same as AC_TRY_LINK, so arrange well-known flags |
| 33 | # in the same order as autoconf would. |
| 34 | # |
| 35 | # See the definitions for ac_link in autoconf's lib/autoconf/c.m4 file for |
| 36 | # reference. |
| 37 | env_flags: List[str] = [] |
| 38 | for var in ['CFLAGS', 'CPPFLAGS', 'LDFLAGS']: |
| 39 | env_flags += filter(None, os.environ.get(var, '').split(' ')) |
| 40 | |
| 41 | subprocess.run([*cc,source,'-o',executable] + env_flags + options, check=True) |
| 42 | p = subprocess.run(['./contrib/devtools/security-check.py',executable], stdout=subprocess.PIPE, universal_newlines=True) |
| 43 | return (p.returncode, p.stdout.rstrip()) |
| 44 | |
| 45 | def get_arch(cc, source, executable): |
| 46 | subprocess.run([*cc, source, '-o', executable], check=True) |
no test coverage detected