Commit graph

177 commits

Author SHA1 Message Date
08fc25d863
deterministic testing
Goal: for each test run to produce reproducible output, allowing us to check
for possible stochastic behavior in the scripts, as well as output-related
regressions (for example, garbage or improperly formatted output produced by a
bad format string) that might not be detected by the test scripts.

In practice, bugginess of the pexpect module and the non-deterministic behavior
of Bitcoin Core’s regtest implementation preclude completely identical output
from test run to test run, but the differences are small enough to result in an
easily reviewable diff.

Enable this feature by setting the MMGEN_TEST_SUITE_DETERMINISTIC environment
variable or running test/test-release.sh with the -D switch.

Examples:

    $ script -c 'test/test-release.sh -FDv quick' -O run1
    $ script -c 'test/test-release.sh -FDv quick' -O run2
    # (optionally remove control characters from output files)
    $ diff -u run1 run2 > diff

    $ export MMGEN_TEST_SUITE_DETERMINISTIC=1
    $ script -c 'test/test.py -ne main' -O run1
    $ script -c 'test/test.py -ne main' -O run2
    # (optionally remove control characters from output files)
    $ diff -u run1 run2 > diff
2021-10-03 17:40:03 +00:00
96a250b51d
test suite: run scripts from overlay tree
Rationale of this commit: to relocate some ugly test-related code from the MMGen
package tree to the test tree, as well as to enable deterministic testing
(implemented in the next commit).

The overlay tree is a symlinked mirror of the MMGen package dir with a few
monkey-patched modules.

The monkey-patching is conditional, so the modules are certain to get tested in
their unpatched state as well.
2021-10-03 17:40:02 +00:00
54d123fdc0
scripts/traceback_run.py -> scripts/exec_wrapper.py 2021-10-03 17:40:01 +00:00
ea5eedcff3
minor changes, whitespace 2021-10-02 17:54:11 +00:00
565dd6da62
scripts/traceback_run.py: improve color initialization code 2021-09-29 21:17:55 +00:00
906f0320d1
minor fixes and cleanups 2021-09-23 21:15:32 +00:00
9c5f4de936
scripts/create-token.py, test.py oneshot_warning; minor fixes 2021-09-05 18:40:44 +00:00
530571f610
scripts/create-token.py: cleanups, sanity checks 2021-09-04 18:34:09 +00:00
eaeeef97c0
test.py ethdev: update solc to v0.8.7, update precompiled contract data 2021-09-03 20:17:25 +00:00
4742255ad2
test.py ethdev, scripts/create-token.py: cleanups 2021-09-03 20:17:25 +00:00
bab1242817
minor fixes and cleanups 2021-07-29 14:20:44 +00:00
21ba2476eb
minor cleanups 2021-04-17 13:27:54 +00:00
cb7f38370b
Update copyright dates 2021-02-19 20:09:06 +03:00
c3f185e8b0
eliminate use of global vars g.proto, g.coin, g.rpc and others
This patch eliminates nearly all the global variables that changed during the
execution of scripts.  With a few minor exceptions, global vars are now used
only during initialization or reserved for cfg file / cmdline options and other
unchanging values.

The result is a code base that's much more maintainable and extensible and less
error-prone.  The autosigning code, which supports signing of transactions for
multiple protocols and networks, has been greatly simplified.

Doing away with globals required many changes throughout the code base, and
other related (and not so related) changes and cleanups were made along the
way, resulting in an enormous patch.

Additional code changes include:

    - tx.py: complete reorganization of TX classes and use of nesting

    - protocol.py: separation of Regtest and Testnet into distinct subclasses
      with separate address and transaction files and file extensions

    - new module help.py for the help notes, loaded on demand

    - addr.py: rewrite of the address file label parsing code

    - tx.py,tw.py: use of generators to create formatted text

User-visible changes include:

    - importing of addresses for tokens not yet in the user's tracking wallet
      is now performed with the `--token-addr` option instead of `--token`

Testing:

    Testing this patch requires a full run of the test suite as described on the
    Test-Suite wiki page.
2020-05-28 09:53:34 +00:00
9489b1cb2d
string formatting, whitespace, minor cleanups throughout 2020-05-26 14:53:44 +00:00
43432327c7
global change: init_coin() -> g.proto = init_proto() 2020-05-16 12:44:43 +00:00
da5742f667
various cleanups throughout 2020-04-12 15:02:52 +00:00
673b97b3b8
update copyright dates 2020-02-18 14:07:27 +00:00
d57631695a
test suite: move path fixup code to test/tests_header.py 2019-10-23 10:01:11 +00:00
6cf4fcc7e4
Use subprocess.run() throughout, related cleanups 2019-10-23 09:31:21 +00:00
23ae73d908
minor fixes and cleanups 2019-07-03 20:30:53 +03:00
4a2cc07ef1
relocate test-release.sh script to test directory 2019-04-19 17:37:32 +03:00
823e325c6c
[msys2]: enable color output, handle exceptions in main.py 2019-03-27 19:52:29 +03:00
4240393804
minor fixes 2019-03-26 16:02:10 +03:00
017ecef3bc
[opts]: separate code from text in opts_data
- When parsing opts, opts.init() now looks only at string values from
  opts_data.  Global variables are evaluated only when printing help text,
  after the variables are initialized
2019-03-26 15:59:37 +03:00
dcab10949e
Support MSWin via MSYS2
This is a work in progress.  Currently, basic operations for BTC and ETH are
supported.

The successor to the MinGW64 project, MSYS2 features package management via
`pacman` and support for Python 3:

    https://sourceforge.net/projects/msys2
    https://www.msys2.org
2019-03-25 13:07:04 +03:00
66d0f76635
Eliminate dependencies on all ethereum packages except py_ecc
The rationale for this patch is similar to that of commit a7126ed:

- Many packages were imported for the sake of just a few trivial conversion
  functions.  These functions have been copied into the local pyethereum.utils.

- rlp has been locally copied and its import statements modified to import
  the locally-copied functions.  Unneeded classes and functions have been
  removed.

- As a result, dependencies on the following external packages have been
  eliminated:

  + rlp
  + eth-hash
  + eth-utils
  + eth-typing
  + toolz
  + cytoolz
  + setuptools
2019-03-25 12:38:49 +03:00
a7126ede03
Remove dependencies on pysha3 and ethereum modules
- pysha3: Monero and Ethereum use the old pre-SHA3 version of the keccak
  hash function, which is not supported by hashlib.sha3.

  The pysha3 package supports the function but is not portable.

  Therefore, use the pure-Python implementation mmgen.keccak as a fallback,
  making the pysha3 package optional.

  Use of mmgen.keccak may be forced with --use-internal-keccak-module

  mmgen.keccak was ported from the Python 2 implementation at
  https://github.com/ctz/keccak

- ethereum (pyethereum): Installation of this package presents numerous
  problems due to poor maintenance and many superfluous dependencies.

  Therefore, use stripped-down and modified local versions of
  ethereum.transactions and ethereum.utils as fallbacks, making the ethereum
  package optional.

  The local pyethereum.utils uses mmgen.keccak as a fallback for pysha3's
  keccak implementation.
2019-03-23 17:21:34 +03:00
281e1f3ffb
minor fixes 2019-03-22 14:32:22 +03:00
f7b59022a4
silent -> quiet file opens + minor fixes 2019-03-20 20:10:46 +03:00
785582e30d
MMGenTxInput, MMGenTxOutput: make 'amt' attribute a property
- type checking 'amt' at runtime eliminates the need to reload tx module
  when g.proto changes
2019-03-19 15:04:18 +03:00
a8e140f6ea
Add unit_tests.py to test-release.sh; minor fixes 2019-03-19 10:44:37 +03:00
634fb2e444
py3port: use dictionary comprehensions where applicable 2019-03-16 20:45:44 +03:00
ae77cb4a51
remove scripts/tx-v1-to-v3.py 2019-03-16 20:41:02 +03:00
2b6dc95970
rewrite SHA2 implementation, support SHA512; update tests accordingly
- Note: the sha2 module is used by MMGen solely for generating Zcash
  addresses and viewkeys
2019-03-15 12:09:38 +03:00
0879e53e74
tooltest2.py - add BTC test vectors
tooltest.py  - bugfixes, remove some commands covered in tooltest2.py
mmgen-tool   - bugfixes, cleanups, rename some commands, change some command
               options
			 - all commands taking binary input can now receive it from file
			   or stdin

+ numerous minor fixes throughout
2019-03-06 23:58:59 +03:00
91410dd96c
test.py: refactor, modularize, cleanup code, make fully OO
- test groups are now separate classes in separate modules
- test data and code is loaded on an as-needed basis
- new TestSuiteRunner and CmdGroupMgr classes
- simplified invocation: if arguments are omitted, all default tests relevant
  for given network and option are run.  The following set of invocations
  provides nearly complete coverage of MMGen's core functionality:

    test/test.py
    test/test.py --segwit-random
    test/test.py --bech32

    test/test.py --coin=ltc
    test/test.py --coin=ltc --segwit-random
    test/test.py --coin=ltc --bech32

    test/test.py --coin=bch
    test/test.py --coin=eth
    test/test.py --coin=etc
2019-03-02 21:27:53 +03:00
b61d516acd
test-release.sh: change option names, alter behavior of '-f' (speedup) option 2019-02-28 13:57:35 +03:00
6a90340671
minor changes 2019-02-28 13:51:27 +03:00
7ac23b6bf3
create new uninstall script 2019-02-28 13:38:52 +03:00
729a547c7d
tool.py, main_tool.py: major rewrite, cleanup
- group tool commands into classes
- add docstrings to command classes and methods
- annotate command method args
- generate call signatures + help and usage screens on the fly

- API changes:
  - listaddresses,twview: new 'age_fmt' option replaces 'show_days' and 'show_age'
  - addrfile_chksum and friends: 'mmtype' option removed

- tooltest.py, tooltest2.py and test.py have been updated accordingly
2019-02-22 23:23:06 +03:00
26ba8baa97
test-release.sh, tooltest.py, tooltest2.py: minor changes, exception handling 2019-02-19 17:53:21 +03:00
514c1100ee Update copyright dates 2019-02-12 21:35:12 +03:00
8c1df23332 py3port: 'test.py autosign_live' - test device insertion/removal + LED 2019-02-12 13:41:27 +03:00
bbdefce0a2 py3port: minor fixes 2019-02-12 13:38:22 +03:00
44c529ae8d py3port: test-release.sh: add autosign_minimal test, --buf-keypress option 2019-02-10 22:26:22 +03:00
80564f6efd py3port: allow solc v0.5.1 or v0.5.3, update ethdev test vectors accordingly 2019-02-10 22:25:03 +03:00
fb07b089be py3port: ERC20: support/require Solidity compiler version 0.5.3 2019-02-06 14:05:37 +03:00
c2675c15ed
py3port: headers 2018-11-17 23:34:04 +03:00
0482594e7a
py3port: traceback_run fixes 2018-11-15 15:57:31 +03:00