Update some tests

This commit is contained in:
Duke Leto
2020-06-23 12:59:32 -04:00
parent f03a7b0e7e
commit 828fff6168
2 changed files with 18 additions and 15 deletions

View File

@@ -1,6 +1,8 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# Copyright (c) 2019-2020 Hush developers
# Released under the GPLv3
# #
# Execute all of the automated tests related to Zcash. # Execute all of the automated tests related to Hush
# #
import argparse import argparse
@@ -32,7 +34,7 @@ RE_FORTIFY_USED = re.compile('Binary compiled with FORTIFY_SOURCE support.*Yes')
def test_rpath_runpath(filename): def test_rpath_runpath(filename):
output = subprocess.check_output( output = subprocess.check_output(
[repofile('qa/zcash/checksec.sh'), '--file', repofile(filename)] [repofile('qa/hush/checksec.sh'), '--file', repofile(filename)]
) )
if RE_RPATH_RUNPATH.search(output): if RE_RPATH_RUNPATH.search(output):
print('PASS: %s has no RPATH or RUNPATH.' % filename) print('PASS: %s has no RPATH or RUNPATH.' % filename)
@@ -44,7 +46,7 @@ def test_rpath_runpath(filename):
def test_fortify_source(filename): def test_fortify_source(filename):
proc = subprocess.Popen( proc = subprocess.Popen(
[repofile('qa/zcash/checksec.sh'), '--fortify-file', repofile(filename)], [repofile('qa/hush/checksec.sh'), '--fortify-file', repofile(filename)],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
) )
line1 = proc.stdout.readline() line1 = proc.stdout.readline()
@@ -64,24 +66,24 @@ def check_security_hardening():
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 # The remaining checks are only for ELF binaries
# Assume that if zcashd is an ELF binary, they all are # Assume that if hushd is an ELF binary, they all are
with open(repofile('src/zcashd'), 'rb') as f: with open(repofile('src/hushd'), 'rb') as f:
magic = f.read(4) magic = f.read(4)
if not magic.startswith(b'\x7fELF'): if not magic.startswith(b'\x7fELF'):
return ret return ret
ret &= test_rpath_runpath('src/zcashd') ret &= test_rpath_runpath('src/hushd')
ret &= test_rpath_runpath('src/zcash-cli') ret &= test_rpath_runpath('src/hush-cli')
ret &= test_rpath_runpath('src/zcash-gtest') ret &= test_rpath_runpath('src/hush-gtest')
ret &= test_rpath_runpath('src/zcash-tx') ret &= test_rpath_runpath('src/hush-tx')
ret &= test_rpath_runpath('src/test/test_bitcoin') ret &= test_rpath_runpath('src/test/test_bitcoin')
# NOTE: checksec.sh does not reliably determine whether FORTIFY_SOURCE # NOTE: checksec.sh does not reliably determine whether FORTIFY_SOURCE
# is enabled for the entire binary. See issue #915. # is enabled for the entire binary. See issue #915.
ret &= test_fortify_source('src/zcashd') ret &= test_fortify_source('src/hushd')
ret &= test_fortify_source('src/zcash-cli') ret &= test_fortify_source('src/hush-cli')
ret &= test_fortify_source('src/zcash-gtest') ret &= test_fortify_source('src/hush-gtest')
ret &= test_fortify_source('src/zcash-tx') ret &= test_fortify_source('src/hush-tx')
ret &= test_fortify_source('src/test/test_bitcoin') ret &= test_fortify_source('src/test/test_bitcoin')
return ret return ret
@@ -144,7 +146,7 @@ STAGES = [
STAGE_COMMANDS = { STAGE_COMMANDS = {
'btest': [repofile('src/test/test_bitcoin'), '-p'], 'btest': [repofile('src/test/test_bitcoin'), '-p'],
'gtest': [repofile('src/zcash-gtest')], 'gtest': [repofile('src/komodo-gtest')],
'sec-hard': check_security_hardening, 'sec-hard': check_security_hardening,
'no-dot-so': ensure_no_dot_so_in_depends, 'no-dot-so': ensure_no_dot_so_in_depends,
'util-test': util_test, 'util-test': util_test,

View File

@@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
# Copyright (c) 2019 Hush developers # Copyright (c) 2019-2020 Hush developers
# Released under the GPLv3
# set working directory to the location of this script # set working directory to the location of this script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"