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:
commit
4e3ff06507
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python2
|
#!/usr/bin/env python
|
||||||
'''
|
'''
|
||||||
Perform basic ELF security checks on a series of executables.
|
Perform basic ELF security checks on a series of executables.
|
||||||
Exit status will be 0 if successful, and the program will be silent.
|
Exit status will be 0 if successful, and the program will be silent.
|
||||||
|
@ -6,6 +6,7 @@ Otherwise the exit status will be 1 and it will log which executables failed whi
|
||||||
Needs `readelf` (for ELF) and `objdump` (for PE).
|
Needs `readelf` (for ELF) and `objdump` (for PE).
|
||||||
'''
|
'''
|
||||||
from __future__ import division,print_function,unicode_literals
|
from __future__ import division,print_function,unicode_literals
|
||||||
|
import struct
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
@ -171,6 +172,8 @@ CHECKS = {
|
||||||
('DYNAMIC_BASE', check_PE_DYNAMIC_BASE),
|
('DYNAMIC_BASE', check_PE_DYNAMIC_BASE),
|
||||||
('HIGH_ENTROPY_VA', check_PE_HIGH_ENTROPY_VA),
|
('HIGH_ENTROPY_VA', check_PE_HIGH_ENTROPY_VA),
|
||||||
('NX', check_PE_NX)
|
('NX', check_PE_NX)
|
||||||
|
],
|
||||||
|
'MachO64': [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +184,8 @@ def identify_executable(executable):
|
||||||
return 'PE'
|
return 'PE'
|
||||||
elif magic.startswith(b'\x7fELF'):
|
elif magic.startswith(b'\x7fELF'):
|
||||||
return 'ELF'
|
return 'ELF'
|
||||||
|
elif struct.unpack('I', magic)[0] == 0xFEEDFACF:
|
||||||
|
return 'MachO64'
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python2
|
#!/usr/bin/env python
|
||||||
# Copyright (c) 2014 Wladimir J. van der Laan
|
# Copyright (c) 2014 Wladimir J. van der Laan
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python2
|
#!/usr/bin/env python2
|
||||||
'''
|
'''
|
||||||
Test script for security-check.py
|
Test script for security-check.py
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
# linearize-data.py: Construct a linear, no-fork version of the chain.
|
# linearize-data.py: Construct a linear, no-fork version of the chain.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
|
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python
|
||||||
# Copyright (c) 2014 Wladmir J. van der Laan
|
# Copyright (c) 2014 Wladimir J. van der Laan
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
from glob import glob
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -62,6 +63,13 @@ def check_security_hardening():
|
||||||
# PIE, RELRO, Canary, and NX are tested by make check-security.
|
# PIE, RELRO, Canary, and NX are tested by make check-security.
|
||||||
ret &= subprocess.call(['make', '-C', repofile('src'), 'check-security']) == 0
|
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/zcashd')
|
||||||
ret &= test_rpath_runpath('src/zcash-cli')
|
ret &= test_rpath_runpath('src/zcash-cli')
|
||||||
ret &= test_rpath_runpath('src/zcash-gtest')
|
ret &= test_rpath_runpath('src/zcash-gtest')
|
||||||
|
@ -79,11 +87,14 @@ def check_security_hardening():
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def ensure_no_dot_so_in_depends():
|
def ensure_no_dot_so_in_depends():
|
||||||
arch_dir = os.path.join(
|
depends_dir = os.path.join(REPOROOT, 'depends')
|
||||||
REPOROOT,
|
arch_dir = os.path.join(depends_dir, 'x86_64-unknown-linux-gnu')
|
||||||
'depends',
|
if not os.path.isdir(arch_dir):
|
||||||
'x86_64-unknown-linux-gnu',
|
# 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
|
exit_code = 0
|
||||||
|
|
||||||
|
@ -97,7 +108,7 @@ def ensure_no_dot_so_in_depends():
|
||||||
exit_code = 1
|
exit_code = 1
|
||||||
else:
|
else:
|
||||||
exit_code = 2
|
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 "Did you build the ./depends tree?"
|
||||||
print "Are you on a currently unsupported architecture?"
|
print "Are you on a currently unsupported architecture?"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python
|
||||||
# Copyright 2014 BitPay, Inc.
|
# Copyright 2014 BitPay, Inc.
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python
|
||||||
exeext="@EXEEXT@"
|
exeext="@EXEEXT@"
|
||||||
|
|
|
@ -581,7 +581,7 @@ TEST(wallet_tests, cached_witnesses_empty_chain) {
|
||||||
|
|
||||||
// Until #1302 is implemented, this should triggger an assertion
|
// Until #1302 is implemented, this should triggger an assertion
|
||||||
EXPECT_DEATH(wallet.DecrementNoteWitnesses(&index),
|
EXPECT_DEATH(wallet.DecrementNoteWitnesses(&index),
|
||||||
"Assertion `nWitnessCacheSize > 0' failed.");
|
".*nWitnessCacheSize > 0.*");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(wallet_tests, cached_witnesses_chain_tip) {
|
TEST(wallet_tests, cached_witnesses_chain_tip) {
|
||||||
|
|
Loading…
Reference in New Issue