In addition to low-level subsystems, the suite tests the overall operation of MMGen Wallet’s commands by running them interactively as a user would. Thus the test suite is useful not only for ensuring the MMGen Wallet system is correctly installed and working on your platform but also for demonstrating how it works.
BTC-only testing requires installation of Bitcoin Core and pycoin only, while altcoin testing requires additional helper programs and libraries, installation instructions for which are provided below. Non-standard RPC ports and data directories are always used, so there’s no need to stop any running nodes.
On Linux/x86_64 with a reasonably fast processor, the full suite should run in
under 20 minutes when invoked with the -F
option. Execution times on other
platforms may be much slower.
The test suite requires the /dev/loopX
devices to exist and be enabled. If
you’re running in an LXC container, note that only privileged containers allow
loop devices. You may enable them in the config file as follows:
lxc.cgroup2.devices.allow = b 7:0 rwm # /dev/loop0
lxc.cgroup2.devices.allow = b 7:1 rwm # /dev/loop1
lxc.cgroup2.devices.allow = b 7:2 rwm # /dev/loop2
Every time the container is started, you may need to create the files afresh:
# mknod /dev/loop0 b 7 0
# mknod /dev/loop1 b 7 1
# mknod /dev/loop2 b 7 2
Clone the Bitcoin Core repo somewhere on your system:
$ git clone https://github.com/bitcoin/bitcoin
Install the Bitcoin Core daemon (source) (binaries).
Point the test suite to your copy of the Bitcoin Core repo:
$ export CORE_REPO_ROOT=/path/to/bitcoin/core/repo
Install Pycoin:
# online install:
$ python3 -m pip install pycoin
# offline install:
$ python3 -m pip download pycoin # online
$ python3 -m pip install --no-build-isolation pycoin-*.tar.gz # offline
Install Pylint:
$ python3 -m pip install pylint
CD to the MMGen Wallet repository root and build without installing:
$ cd path/to/mmgen/repo
$ python3 setup.py build_ext --inplace
Run the following if upgrading from a previous version of MMGen:
$ test/cmdtest.py clean
Run the test suite in fast mode, skipping altcoin tests:
$ test/test-release.sh -FA
Complete the BTC-only installation steps above, without running the test.
Make sure the Bitcoin Cash Node, Litecoin and Monero daemons are installed on your system.
Install Parity, Geth and the ETH Python requirements, optionally the Solidity compiler, and the XMR Python requirements as described on the Altcoin-and-Forkcoin-Support page.
In addition, you must install the following helper programs and libraries (MSYS2
users can omit Zcash-Mini and leave out sudo
in commands):
The XMR test sets up a local SOCKS proxy to test transaction relaying. This requires the SSH daemon to be set up and running. On MSYS2 systems, SSHD is not configured by default, but it may be easily set up with the following steps:
Open PowerShell as administrator, and at the DOS prompt, execute:
system32> net user administrator /active:yes
system32> C:\\msys64\usr\bin\bash.exe --login
Now, at the MSYS2 prompt, cd to the MMGen Wallet repository root and run the setup script:
$ scripts/msys2-sshd-setup.sh
The daemon should now start automatically every time the system is booted. It may also be started and stopped manually at the DOS or MSYS2 prompt as follows (PowerShell must be running with admin privileges):
# net start msys2_sshd
# net stop msys2_sshd
$ python3 -m pip install pycryptodomex ipaddress varint
$ python3 -m pip install --no-deps monero
$ git clone https://github.com/10gic/vanitygen-plusplus
$ cd vanitygen-plusplus
$ git checkout -b vanitygen-plus e7858035d092 # rewind to fork commit
$ make keyconv # ‘mingw32-make.exe keyconv’ for MSYS2
$ sudo install --strip keyconv /usr/local/bin # ‘keyconv.exe’ for MSYS2
$ cd ..
$ sudo apt-get install golang # skip this if Go is already installed
$ git clone https://github.com/FiloSottile/zcash-mini
$ cd zcash-mini
$ go mod init zcash-mini
$ go mod tidy
$ go build -mod=mod # or just ’go build’
$ sudo install --strip ./zcash-mini /usr/local/bin
$ cd ..
On Arch Linux and ArchLinuxArm systems, the ‘ethkey’ utility is included in the OpenEthereum package:
$ pacman -S openethereum
For 64-bit Windows and Linux systems, ‘ethkey’ can be found in the zip archives distributed with this release.
For other systems (i.e. Debian/Ubuntu ARM), tests involving ‘ethkey’ are skipped.
The Monero test (test/test-release.sh xmr
) creates a private network and
mines coins, so is therefore non-deterministic and prone to random failures.
If you experience such a failure, just restart the test.
Now you can run the test suite for all coins:
$ test/test-release.sh -F
test/test-release.sh
is just a simple shell script that invokes the test
scripts with various options and arguments to ensure complete coverage of
MMGen Wallet’s functionality. Launch the script with the -t
option to view
the invocations without running them.
The test scripts themselves are all located in the test/
directory and bear
the .py
extension. They may be run individually if desired. Options and
arguments required by the tests are described in detail on their help screens.
High-level testing of the MMGen Wallet system is performed by test/cmdtest.py
,
which uses the pexpect
library to simulate interactive operation of MMGen
Wallet’s user commands. Running test/cmdtest.py
with the -e
option will
display the commands’ output on the screen as they’re being run.
Test | What it tests |
---|---|
test/colortest.py |
terminfo parsing; terminal colors |
test/gentest.py |
key/address generation - profiling and data validity |
test/hashfunc.py |
native SHA2 and Keccak implementations |
test/objtest.py |
MMGen data objects - creation and error handling |
test/objattrtest.py |
MMGen data objects - immutable attributes |
test/scrambletest.py |
HMAC scramble strings used in key/password derivation |
test/cmdtest.py |
overall operation of MMGen Wallet commands |
test/tooltest.py |
the mmgen-tool utility - overall operation |
test/tooltest2.py |
the mmgen-tool utility - data validity |
test/unit_tests.py |
low-level subsystems |