Browse Source

add run_tests.sh

run_tests.sh

run_tests.sh

run_tests.sh, remove duplicate from install.sh

add uninstall first to install.sh, check virtualenv sourced in tests

fix install.sh skip, don't install docs with openssl

remove openssl files before (re)installing, fail on JM install package failure
master
fivepiece 8 years ago
parent
commit
69d274f021
  1. 25
      install.sh
  2. 49
      test/run_tests.sh

25
install.sh

@ -1,9 +1,5 @@
#!/bin/bash #!/bin/bash
# jm_source="$PWD/.."
# jm_root="${jm_source}/jmvenv"
# jm_deps="${jm_source}/deps"
gpg_verify_key () gpg_verify_key ()
{ {
gpg --keyid-format long <"$1" | grep "$2" gpg --keyid-format long <"$1" | grep "$2"
@ -46,6 +42,7 @@ check_skip_build ()
read -p "Directory ${1} exists. Remove and recreate? (y/n) " q read -p "Directory ${1} exists. Remove and recreate? (y/n) " q
if [[ "${q}" =~ Y|y ]]; then if [[ "${q}" =~ Y|y ]]; then
rm -rf "./${1}" rm -rf "./${1}"
mkdir -p "./${1}"
return 1 return 1
else else
echo "skipping ${1}..." echo "skipping ${1}..."
@ -60,7 +57,8 @@ venv_setup ()
if check_skip_build 'jmvenv'; then if check_skip_build 'jmvenv'; then
return 0 return 0
fi fi
virtualenv -p python2 jmvenv rm -rf "${jm_source}/deps"
virtualenv -p python2 "${jm_source}/jmvenv"
} }
openssl_get () openssl_get ()
@ -75,6 +73,14 @@ openssl_build ()
{ {
./config shared --prefix="${jm_root}" ./config shared --prefix="${jm_root}"
make -j make -j
rm -rf "${jm_root}/ssl" \
"${jm_root}/lib/engines" \
"${jm_root}/lib/pkgconfig/openssl.pc" \
"${jm_root}/lib/pkgconfig/libssl.pc" \
"${jm_root}/lib/pkgconfig/libcrypto.pc" \
"${jm_root}/include/openssl" \
"${jm_root}/bin/c_rehash" \
"${jm_root}/bin/openssl"
if ! make test; then if ! make test; then
return 1 return 1
fi fi
@ -111,7 +117,7 @@ openssl_install ()
fi fi
pushd "${openssl_version}" pushd "${openssl_version}"
if openssl_build; then if openssl_build; then
make install make install_sw
else else
return 1 return 1
fi fi
@ -151,6 +157,7 @@ libffi_build ()
{ {
./autogen.sh ./autogen.sh
./configure --disable-docs --enable-shared --prefix="${jm_root}" ./configure --disable-docs --enable-shared --prefix="${jm_root}"
make uninstall
make -j make -j
if ! make check; then if ! make check; then
return 1 return 1
@ -199,6 +206,7 @@ libsodium_build ()
{ {
./autogen.sh ./autogen.sh
./configure --enable-shared --prefix="${jm_root}" ./configure --enable-shared --prefix="${jm_root}"
make uninstall
make -j make -j
if ! make check; then if ! make check; then
return 1 return 1
@ -244,7 +252,7 @@ joinmarket_install ()
jm_pkgs=( 'jmbase' 'jmdaemon' 'jmbitcoin' 'jmclient' ) jm_pkgs=( 'jmbase' 'jmdaemon' 'jmbitcoin' 'jmclient' )
for pkg in ${jm_pkgs[@]}; do for pkg in ${jm_pkgs[@]}; do
pushd "${pkg}" pushd "${pkg}"
pip install . pip install . || return 1
popd popd
done done
} }
@ -277,10 +285,13 @@ main ()
fi fi
if ! libsodium_install; then if ! libsodium_install; then
echo "Libsodium was not built. Exiting." echo "Libsodium was not built. Exiting."
return 1
fi fi
popd popd
if ! joinmarket_install; then if ! joinmarket_install; then
echo "Joinmarket was not installed. Exiting." echo "Joinmarket was not installed. Exiting."
deactivate
return 1
fi fi
deactivate deactivate
echo "Joinmarket successfully installed echo "Joinmarket successfully installed

49
test/run_tests.sh

@ -0,0 +1,49 @@
#!/bin/bash
run_jm_tests ()
{
if [[ -z "${VIRTUAL_ENV}" ]]; then
echo "Source JM virtualenv before running tests:
\`source ./jmvenv/bin/activate\`"
return 1
fi
jm_source="${VIRTUAL_ENV}/.."
pushd "${jm_source}"
git clone git://github.com/Joinmarket-Org/miniircd.git
if ! pip install -r ./requirements-dev.txt; then
echo "Packages in 'requirements-dev.txt' could not be installed. Exiting."
return 1
fi
if [[ ! -L ./joinmarket.cfg && -e ./joinmarket.cfg ]]; then
mv ./joinmarket.cfg ./joinmarket.cfg.bak
echo "file 'joinmarket.cfg' moved to 'joinmarket.cfg.bak'"
fi
for dir in '/dev/shm' '/tmp' "${jm_source}/test"; do
if [[ -d "${dir}" && -r "${dir}" ]]; then
jm_test_datadir="${dir}/jm_test_home/.bitcoin"
break
fi
done
if [[ -z "${jm_test_datadir}" ]]; then
echo "No candidate directory for test files. Exiting."
return 1
fi
unlink ./joinmarket.cfg
ln -s ./test/regtest_joinmarket.cfg ./joinmarket.cfg
orig_umask="$(umask -p)"
umask 077
rm -rf "${jm_test_datadir}"
mkdir -p "${jm_test_datadir}"
cp -f ./test/bitcoin.conf "${jm_test_datadir}/bitcoin.conf"
${orig_umask}
echo "datadir=${jm_test_datadir}" >> "${jm_test_datadir}/bitcoin.conf"
python -m py.test --cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html --btcpwd=123456abcdef --btcconf=${jm_test_datadir}/bitcoin.conf --btcuser=bitcoinrpc --nirc=2 --ignore jmclient/test/test_wallets.py --ignore test/test_segwit.py
unlink ./joinmarket.cfg
if read bitcoind_pid <"${jm_test_datadir}/bitcoind.pid"; then
pkill -15 ${bitcoind_pid} || pkill -9 ${bitcoind_pid}
fi
rm -rf "${jm_test_datadir}"
}
run_jm_tests
Loading…
Cancel
Save