test/init.sh, MANIFEST.in: fixes, cleanups

This commit is contained in:
The MMGen Project 2024-02-10 15:15:18 +00:00
commit 6f2925f797
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 31 additions and 14 deletions

View file

@ -1,4 +1,10 @@
include README.md LICENSE
include test/test-release.sh
include test/unit_tests_d/*.py
include mmgen_node_tools/data/*
include test/init.sh
include test/test-release.d/*.sh
include test/unit_tests_d/*.py
include test/cmdtest_py_d/*.py
include test/overlay/fakemods/mmgen_node_tools/*.py
include test/ref/*/*

View file

@ -193,7 +193,7 @@ class DataSource:
@property
def timeout(self):
return 5 if gcfg.test_suite else self.btc_ratelimit if cfg.btc_only else self.ratelimit
return 0 if gcfg.test_suite else self.btc_ratelimit if cfg.btc_only else self.ratelimit
def json_data_error_msg(self,json_text):
tor_captcha_msg = f"""
@ -265,7 +265,7 @@ class DataSource:
@property
def timeout(self):
return 5 if gcfg.test_suite else self.ratelimit
return 0 if gcfg.test_suite else self.ratelimit
@property
def symbols(self):

View file

@ -10,6 +10,7 @@
RED="\e[31;1m" GREEN="\e[32;1m" YELLOW="\e[33;1m" BLUE="\e[34;1m" RESET="\e[0m"
set -e
set -o errtrace
set -o functrace
@ -17,14 +18,19 @@ trap 'echo -e "${GREEN}Exiting at user request$RESET"; exit' INT
trap 'echo -e "${RED}Node Tools test suite initialization exited with error (line $BASH_LINENO) $RESET"' ERR
umask 0022
STDOUT_DEVNULL='>/dev/null'
STDERR_DEVNULL='2>/dev/null'
PROGNAME=$(basename $0)
while getopts h OPT
while getopts hv OPT
do
case "$OPT" in
h) printf " %-16s Initialize the MMGen Node Tools test suite\n" "${PROGNAME}:"
echo " USAGE: $PROGNAME"
echo " OPTIONS: '-h' Print this help message"
echo " -v Be more verbose"
exit ;;
v) VERBOSE=1 STDOUT_DEVNULL='' STDERR_DEVNULL='' ;;
*) exit ;;
esac
done
@ -41,7 +47,10 @@ check_mmgen_repo() {
}
build_mmgen_extmod() {
( cd $wallet_repo; python3 ./setup.py build_ext --inplace )
(
cd $wallet_repo
eval "python3 ./setup.py build_ext --inplace $STDOUT_DEVNULL $STDERR_DEVNULL"
)
}
create_dir_links() {
@ -49,14 +58,14 @@ create_dir_links() {
target="$wallet_repo/$link_name"
if [ -L $link_name ]; then
[ "$(realpath --relative-to=. $link_name 2>/dev/null)" == $target ] || {
echo "Removing broken symlink '$link_name'"
[ "$VERBOSE" ] && echo "Removing broken symlink '$link_name'"
rm $link_name
}
elif [ -e $link_name ]; then
die "'$link_name' is not a symbolic link. Please remove or relocate it and re-run this script"
fi
if [ ! -e $link_name ]; then
echo "Creating symlink: $link_name"
[ "$VERBOSE" ] && echo "Creating symlink: $link_name"
ln -s $target
fi
done
@ -87,32 +96,34 @@ create_test_links() {
fs="%-8s %-16s %s -> %s\n"
if [ $type == 'hard' ]; then
if [ -L $path ]; then
printf "$fs" "Deleting" "symbolic link:" $path $target
[ "$VERBOSE" ] && printf "$fs" "Deleting" "symbolic link:" $path $target
rm -rf $path
elif [ -e $path ]; then
if [ "$(stat --printf=%i $path)" -ne "$(stat --printf=%i $target)" ]; then
printf "$fs" "Deleting" "stale hard link:" $path "?"
[ "$VERBOSE" ] && printf "$fs" "Deleting" "stale hard link:" $path "?"
rm -rf $path
fi
fi
fi
if [ ! -e $path ]; then # link is either absent or a broken symlink
printf "$fs" "Creating" "$type link:" $path $target
[ "$VERBOSE" ] && printf "$fs" "Creating" "$type link:" $path $target
( cd "$(dirname $path)" && ln -f $symlink_arg $pfx$target )
fi
done <<<$paths
}
set -e
becho 'Initializing MMGen Node Tools Test Suite'
check_mmgen_repo || die "MMGen Wallet repository not found at $wallet_repo!"
build_mmgen_extmod
[ "$VERBOSE" ] && becho 'Creating links to mmgen-wallet repo'
create_dir_links
create_test_links
becho 'OK'
[ "$VERBOSE" ] && becho 'OK'
true