Commit graph

24 commits

Author SHA1 Message Date
Hennadii Stepanov
a0473442d1
scripted-diff: Add __file__ argument to BitcoinTestFramework.init()
-BEGIN VERIFY SCRIPT-
sed -i -e 's/\s*().main\s*()/(__file__).main()/' $(git ls-files test/functional/*.py)
sed -i -e 's/def __init__(self)/def __init__(self, test_file)/' test/functional/test_framework/test_framework.py
-END VERIFY SCRIPT-
2024-07-16 22:06:47 +01:00
Matthew Zipkin
fd6a7d3a13
test: use sleepy wait-for-log in reindex readonly
Also rename the busy wait-for-log method to prevent recurrence
2024-04-30 14:14:50 -04:00
Sebastian Falbesoner
4c65ac96f8 test: detect OS consistently using platform.system() 2023-12-08 18:16:24 +01:00
MarcoFalke
44445ae8f1
test: Avoid intermittent failures in feature_init 2023-11-09 14:30:02 +01:00
L0la L33tz
5ab6419f38 test: randomized perturbing in feature_init 2023-10-08 17:25:56 +02:00
Fabian Jahr
64b80d5c5b test: simplify feature_init 2023-10-08 17:25:27 +02:00
Martin Zumsande
d27b9a2248 test: fix feature_init.py file perturbation
Simultaneously opening the file in read and write mode would
lead to opening of an empty file instead of perturbing the existing
file.
Also, revert to the previous state after each perturbation so that
each perturbation is applied in isolation.
2023-07-18 15:54:23 -04:00
furszy
04575106b2
scripted-diff: rename 'loadblk' thread name to 'initload'
The thread does not only load blocks, it loads the mempool and,
in a future commit, will start the indexes as well.

Also, renamed the 'ThreadImport' function to 'ImportBlocks'
And the 'm_load_block' class member to 'm_thread_load'.

-BEGIN VERIFY SCRIPT-

sed -i "s/ThreadImport/ImportBlocks/g" $(git grep -l ThreadImport -- ':!/doc/')
sed -i "s/loadblk/initload/g" $(git grep -l loadblk -- ':!/doc/release-notes/')
sed -i "s/m_load_block/m_thread_load/g" $(git grep -l m_load_block)

-END VERIFY SCRIPT-
2023-07-07 19:31:27 -03:00
fanquake
b11bd045e4
Merge bitcoin/bitcoin#26653: test, init: perturb file to ensure failure instead of only deleting them
c371cae07a test, init: perturb file to ensure failure instead of only deleting them (brunoerg)

Pull request description:

  In `feature_init.py` there is a TODO about perturbing the files instead of only testing by deleting them.
  ```py
              # TODO: at some point, we should test perturbing the files instead of removing
              # them, e.g.
              #
              # contents = target_file.read_bytes()
              # tweaked_contents = bytearray(contents)
              # tweaked_contents[50:250] = b'1' * 200
              # target_file.write_bytes(bytes(tweaked_contents))
              #
              # At the moment I can't get this to work (bitcoind loads successfully?) so
              # investigate doing this later.
  ```

  This PR adds it by writing into the file random bytes and checking whether it throws an error when starting.

ACKs for top commit:
  MarcoFalke:
    lgtm ACK c371cae07a

Tree-SHA512: d691eee60b91dd9d1b200588608f56b0a10dccd9761a75254b69e0ba5e5866cae14d2f90cb2bd7ec0f95b0617c2562cd33f20892ffd16355b6df770d3806a0ff
2023-05-05 14:13:03 +01:00
Hennadii Stepanov
306ccd4927
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-

Commits of previous years:
- 2021: f47dda2c58
- 2020: fa0074e2d8
- 2019: aaaaad6ac9
2022-12-24 23:49:50 +00:00
brunoerg
c371cae07a test, init: perturb file to ensure failure instead of only deleting them 2022-12-07 15:01:31 -03:00
MacroFake
555519d082
test: Remove wallet option from non-wallet tests
Review note: The changes are complete, because self.options.descriptors
is set to None in parse_args (test_framework.py).

A value of None implies -disablewallet, see the previous commit.

So if a call to add_wallet_options is missing, it will lead to a test
failure when the wallet is compiled in.
2022-11-10 17:19:13 +01:00
James O'Beirne
252abd1e8b init: add utxo snapshot detection
Add functionality for activating a snapshot-based chainstate if one is
detected on-disk.

Also cautiously initialize chainstate cache usages so that we don't
somehow blow past our cache allowances during initialization, then
rebalance at the end of init.

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2022-09-13 13:30:14 -04:00
MacroFake
fa74b63c01
test: Fix wait_for_debug_log UnicodeDecodeError 2022-06-07 20:54:37 +02:00
Martin Zumsande
bfcd60f5d5 test: activate all index types in feature_init.py 2022-01-31 21:21:39 +01:00
MarcoFalke
fa7b07571f
test: Fix feature_init intermittent issues 2022-01-31 10:10:25 +01:00
MarcoFalke
fa4595deb3
test: Remove random line number feature from feature_init.py
This is needed for the next commit.

Also, it doesn't really test anything novel. wait_for_debug_log is
inherently racy, so will randomly terminate at the exact point or later.
So the randomization is already sufficiently covered by the existing
test.
2022-01-31 10:09:11 +01:00
sogoagain
9d3e95d77c [bugfix] prevent UnicodeDecodeError errors when opening log file in feature_init.py
open log file as a raw byte stream in feature_init.py
(fixes #23989)
2022-01-12 02:06:15 +09:00
James O'Beirne
8904f17ea7
test: enable txindex in feature_init
Now that #23365 is merged.
2021-12-29 13:21:24 -05:00
James O'Beirne
93db6d8422
test: feature_init: retain debug.log and improve detection
This test sporadically fails due to the Python test missing log lines
for reasons that are poorly understood. The problem is made worse by the
fact that this test does not retain the log files from iteration to
iteration.

Change the test to do logline detection in a more robust manner (by
using `re.search` on the whole log content) in a way that is comparable
to the existing `assert_debug_log` utility, and retain all debug.log
content from case to case.
2021-12-29 13:04:36 -05:00
James O'Beirne
24fcf6e435
test: feature_init: tweak all .ldb files of a certain type
This part of the test sporadically fails on CI infrastructure. Instead
of perturbing a single .ldb file of each type, move all .ldb files of a
given type to ensure a bad startup.
2021-12-29 13:04:35 -05:00
seaona
618f4d2890 test: re-organized array according to order of logs and included 2 more interruption events 2021-12-15 16:17:54 +01:00
seaona
71115a5e23 test: include two more interruptions points 2021-12-15 13:32:32 +01:00
James O'Beirne
d9803f7a0a
test: add stress tests for initialization 2021-10-26 12:46:36 -04:00