Auto merge of #3320 - str4d:macos-tests, r=bitcartel

Fix MacOS tests

Includes code cherry-picked from upstream PR bitcoin/bitcoin#8270.
This commit is contained in:
Homu
2018-06-18 19:00:56 -07:00
10 changed files with 32 additions and 16 deletions

View File

@@ -4,6 +4,7 @@
#
import argparse
from glob import glob
import os
import re
import subprocess
@@ -62,6 +63,13 @@ def check_security_hardening():
# PIE, RELRO, Canary, and NX are tested by make check-security.
ret &= subprocess.call(['make', '-C', repofile('src'), 'check-security']) == 0
# The remaining checks are only for ELF binaries
# Assume that if zcashd is an ELF binary, they all are
with open(repofile('src/zcashd'), 'rb') as f:
magic = f.read(4)
if not magic.startswith(b'\x7fELF'):
return ret
ret &= test_rpath_runpath('src/zcashd')
ret &= test_rpath_runpath('src/zcash-cli')
ret &= test_rpath_runpath('src/zcash-gtest')
@@ -79,11 +87,14 @@ def check_security_hardening():
return ret
def ensure_no_dot_so_in_depends():
arch_dir = os.path.join(
REPOROOT,
'depends',
'x86_64-unknown-linux-gnu',
)
depends_dir = os.path.join(REPOROOT, 'depends')
arch_dir = os.path.join(depends_dir, 'x86_64-unknown-linux-gnu')
if not os.path.isdir(arch_dir):
# Not Linux, try MacOS
arch_dirs = glob(os.path.join(depends_dir, 'x86_64-apple-darwin*'))
if arch_dirs:
# Just try the first one; there will only be on in CI
arch_dir = arch_dirs[0]
exit_code = 0
@@ -97,7 +108,7 @@ def ensure_no_dot_so_in_depends():
exit_code = 1
else:
exit_code = 2
print "arch-specific build dir not present: {}".format(arch_dir)
print "arch-specific build dir not present"
print "Did you build the ./depends tree?"
print "Are you on a currently unsupported architecture?"