Age | Commit message (Collapse) | Author |
|
unused includes in tests
|
|
|
|
|
|
There was some test coverage previously, but it was limited and didn't test
conflicting and negated arguments.
|
|
Remove testcase generating code from util_SettingsMerge so it can be reused in
new tests.
The hash value expected in util_SettingsMerge changes as a result of this, but
only because the testcases are generated in a different order, not because any
cases are added or removed. It is possible to verify this with:
SETTINGS_MERGE_TEST_OUT=new.txt test/test_bitcoin --run_test=util_tests/util_SettingsMerge
git checkout HEAD~1
make test/test_bitcoin
SETTINGS_MERGE_TEST_OUT=old.txt test/test_bitcoin --run_test=util_tests/util_SettingsMerge
diff -u <(sort old.txt) <(sort new.txt)
The new output is a little more readable, with simpler testcases sorted first.
|
|
Followup to #15869. Treat "-wallet" as the network-specific argument in test
instead of "-server", to make test output clearer and be more consistent with
bitcoind. Update embedded hash to match changed output from this.
|
|
|
|
0aef39d067 Silence "Test case [...] did not check any assertions" warnings when running "test_bitcoin --log_level=test_suite" (practicalswift)
5fd73c8694 Avoid repeated log messages in tests by connecting to signal handlers (ThreadSafeMessageBox, etc.) only once (practicalswift)
e502c3c515 tests: Reduce noise level in test_bitcoin output (practicalswift)
Pull request description:
Reduce noise level in `test_bitcoin` output.
Context: When working on the non-determinism issues in the unit tests (see #15296) I got a bit tired of the amount of noise in the `test_bitcoin` output :-)
Before:
```
$ src/test/test_bitcoin --log_level=test_suite 2>&1 | grep -vE '(Entering|Leaving)' | uniq -c
1 Running 341 test cases...
1 Test case blockencodings_tests/TransactionsRequestDeserializationOverflowTest did not check any assertions
1 CheckSplitTorReplyLine(PROTOCOLINFO PIVERSION)
1 CheckSplitTorReplyLine(AUTH METHODS=COOKIE,SAFECOOKIE COOKIEFILE="/home/x/.tor/control_auth_cookie")
1 CheckSplitTorReplyLine(AUTH METHODS=NULL)
1 CheckSplitTorReplyLine(AUTH METHODS=HASHEDPASSWORD)
1 CheckSplitTorReplyLine(VERSION Tor="0.2.9.8 (git-a0df013ea241b026)")
1 CheckSplitTorReplyLine(AUTHCHALLENGE SERVERHASH=aaaa SERVERNONCE=bbbb)
1 CheckSplitTorReplyLine(COMMAND)
1 CheckSplitTorReplyLine(COMMAND SOME ARGS)
1 CheckSplitTorReplyLine(COMMAND ARGS)
1 CheckSplitTorReplyLine(COMMAND EVEN+more ARGS)
1 CheckParseTorReplyMapping(METHODS=COOKIE,SAFECOOKIE COOKIEFILE="/home/x/.tor/control_auth_cookie")
1 CheckParseTorReplyMapping(METHODS=NULL)
1 CheckParseTorReplyMapping(METHODS=HASHEDPASSWORD)
1 CheckParseTorReplyMapping(Tor="0.2.9.8 (git-a0df013ea241b026)")
1 CheckParseTorReplyMapping(SERVERHASH=aaaa SERVERNONCE=bbbb)
1 CheckParseTorReplyMapping(ServiceID=exampleonion1234)
1 CheckParseTorReplyMapping(PrivateKey=RSA1024:BLOB)
1 CheckParseTorReplyMapping(ClientAuth=bob:BLOB)
1 CheckParseTorReplyMapping(Foo=Bar=Baz Spam=Eggs)
1 CheckParseTorReplyMapping(Foo="Bar=Baz")
1 CheckParseTorReplyMapping(Foo="Bar Baz")
1 CheckParseTorReplyMapping(Foo="Bar\ Baz")
1 CheckParseTorReplyMapping(Foo="Bar\Baz")
1 CheckParseTorReplyMapping(Foo="Bar\@Baz")
1 CheckParseTorReplyMapping(Foo="Bar\"Baz" Spam="\"Eggs\"")
1 CheckParseTorReplyMapping(Foo="Bar\\Baz")
1 CheckParseTorReplyMapping(Foo="Bar\nBaz\t" Spam="\rEggs" Octals="\1a\11\17\18\81\377\378\400\2222" Final=Check)
1 CheckParseTorReplyMapping(Valid=Mapping Escaped="Escape\\")
1 CheckParseTorReplyMapping(Valid=Mapping Bare="Escape\")
1 CheckParseTorReplyMapping(OneOctal="OneEnd\1" TwoOctal="TwoEnd\11")
1 CheckParseTorReplyMapping(Null="\0")
1 CheckParseTorReplyMapping(SOME=args,here MORE optional=arguments here)
1 CheckParseTorReplyMapping(ARGS)
1 CheckParseTorReplyMapping(MORE ARGS)
1 CheckParseTorReplyMapping(MORE ARGS)
1 CheckParseTorReplyMapping(EVEN more=ARGS)
1 CheckParseTorReplyMapping(EVEN+more ARGS)
1 Test case util_tests/util_criticalsection did not check any assertions
1 Testing known outcomes
326 Error: Specified -walletdir "/tmp/test_bitcoin/1553850209_943311758/tempdir/path_does_not_exist" does not exist
327 Error: Specified -walletdir "/tmp/test_bitcoin/1553850209_643733972/tempdir/not_a_directory.dat" is not a directory
328 Error: Specified -walletdir "wallets" is a relative path
1
1 *** No errors detected
```
After:
```
$ src/test/test_bitcoin --log_level=test_suite 2>&1 | grep -vE '(Entering|Leaving)' | uniq -c
1 Running 341 test cases...
1 Error: Specified -walletdir "/tmp/test_bitcoin/1553850026_943311758/tempdir/path_does_not_exist" does not exist
1 Error: Specified -walletdir "/tmp/test_bitcoin/1553850026_643733972/tempdir/not_a_directory.dat" is not a directory
1 Error: Specified -walletdir "wallets" is a relative path
1
1 *** No errors detected
```
ACKs for commit 0aef39:
MarcoFalke:
utACK 0aef39d0678ec2f26633028d44eea0ba0087e7c0
Tree-SHA512: 9cc22f64aa5c875861bae6533d18675ad978c623f053754deef6a8e271ea70bda3f72fb4ec5c8fd19b841757f21380639051d5f5b44301b9d2464b57655e9c05
|
|
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./src/bench/
./contrib/devtools/copyright_header.py update ./src/test/
-END VERIFY SCRIPT-
|
|
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended -e 's/test_bitcoin\.(h|cpp)/setup_common.\1/g' $(git grep -l test_bitcoin)
git mv ./src/test/test_bitcoin.h ./src/test/setup_common.h
git mv ./src/test/test_bitcoin.cpp ./src/test/setup_common.cpp
sed -i -e 's/BITCOIN_TEST_TEST_BITCOIN_H/BITCOIN_TEST_SETUP_COMMON_H/g' ./src/test/setup_common.h
-END VERIFY SCRIPT-
|
|
"test_bitcoin --log_level=test_suite"
|
|
Problem:
- Nothing uses the `fspaces` argument to `HexStr()` besides unit
tests. This argument results in extra complexity and a small
performance decrease within the function for branch evalulation.
Solution:
- Remove unused `fspaces` option.
|
|
1. Fix lack of warning by collecting all section names by moving
m_config_sections.clear() to ArgsManager::ReadConfigFiles().
2. Add info(file name, line number) to warning message.
3. Add a test code to confirm this situation.
3. Do clear() in ReadConfigString().
|
|
Co-authored-by: Suhas Daftuar <sdaftuar@gmail.com>
|
|
Unfortunately, `std::string` elements are (bare) chars. As these
are the most likely type to be passed to these functions, make them use
char instead of unsigned char. This avoids some casts.
|
|
|
|
|
|
-BEGIN VERIFY SCRIPT-
mkdir -p src/util
git mv src/util.h src/util/system.h
git mv src/util.cpp src/util/system.cpp
git mv src/utilmemory.h src/util/memory.h
git mv src/utilmoneystr.h src/util/moneystr.h
git mv src/utilmoneystr.cpp src/util/moneystr.cpp
git mv src/utilstrencodings.h src/util/strencodings.h
git mv src/utilstrencodings.cpp src/util/strencodings.cpp
git mv src/utiltime.h src/util/time.h
git mv src/utiltime.cpp src/util/time.cpp
sed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
sed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h
sed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
sed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
sed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h
sed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
sed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am
sed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
sed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
sed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am
sed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh
sed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh
sed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
sed -i 's/src\\utilstrencodings\.cpp/src\\util\\strencodings\.cpp/' build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj
-END VERIFY SCRIPT-
|
|
unnecessary copying of objects in range declarations.
f34c8c466a0e514edac2e8683127b4176ad5d321 Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. (practicalswift)
Pull request description:
Make objects in range declarations immutable by default.
Rationale:
* Immutable objects are easier to reason about.
* Prevents accidental or hard-to-notice change of value.
Tree-SHA512: cad69d35f0cf8a938b848e65dd537c621d96fe3369be306b65ef0cd1baf6cc0a9f28bc230e1e383d810c555a6743d08cb6b2b0bd51856d4611f537a12e5abb8b
|
|
This commit implements custom equivalents for the C and C++ `tolower` and `toupper` Standard Library functions.
In addition it implements a utility function to capitalize the first letter of a string.
|
|
copying of objects in range declarations.
|
|
|
|
This is a squashed commit that squashes the following commits:
This commit removes the `boost/algorithm/string/predicate.hpp` dependenc
from the project by replacing the function calls to `boost::algorithm::starts_with`
`boost::algorithm::ends_with` and `all` with respectively C++11'
`std::basic_string::front`, `std::basic_string::back`, `std::all_of` function calls
This commit replaces `boost::algorithm::is_digit` with a locale independent isdigi
function, because the use of the standard library's `isdigit` and `std::isdigit
functions is discoraged in the developer notes
|
|
|
|
If an unknown option is given via either the command line args or
the conf file, throw an error and exit
Update tests for ArgsManager knowing args
Ignore unknown options in the config file for bitcoin-cli
Fix tests and bitcoin-cli to match actual options used
|
|
159c32d1f1 Add assertion to guide static analyzers. Clang Static Analyzer needs this guidance. (practicalswift)
fd447a6efe Fix dead stores. Values were stored but never read. Limit scope. (practicalswift)
Pull request description:
Fix Clang Static Analyzer warnings reported by @kallewoof in #12961:
* Fix dead stores. Values were stored but never read.
* Add assertion to guide static analyzers. See #12961 for details.
Tree-SHA512: 83dbec821f45217637316bee978e7543f2d2caeb7f7b0b3aec107fede0fff8baa756da8f6b761ae0d38537740839ac9752f6689109c38a4b05c0c041aaa3a1fb
|
|
|
|
c25321f Add config changes to release notes (Anthony Towns)
5e3cbe0 [tests] Unit tests for -testnet/-regtest in [test]/[regtest] sections (Anthony Towns)
005ad26 ArgsManager: special handling for -regtest and -testnet (Anthony Towns)
608415d [tests] Unit tests for network-specific config entries (Anthony Towns)
68797e2 ArgsManager: Warn when ignoring network-specific config setting (Anthony Towns)
d1fc4d9 ArgsManager: limit some options to only apply on mainnet when in default section (Anthony Towns)
8a9817d [tests] Use regtest section in functional tests configs (Anthony Towns)
30f9407 [tests] Unit tests for config file sections (Anthony Towns)
95eb66d ArgsManager: support config file sections (Anthony Towns)
4d34fcc ArgsManager: drop m_negated_args (Anthony Towns)
3673ca3 ArgsManager: keep command line and config file arguments separate (Anthony Towns)
Pull request description:
The weekly meeting on [2017-12-07](http://www.erisian.com.au/meetbot/bitcoin-core-dev/2017/bitcoin-core-dev.2017-12-07-19.00.log.html) discussed allowing options to bitcoin to have some sensitivity to what network is in use. @theuni suggested having sections in the config file:
<cfields> an alternative to that would be sections in a config file. and on the
cmdline they'd look like namespaces. so, [testnet] port=5. or -testnet::port=5.
This approach is (more or less) supported by `boost::program_options::detail::config_file_iterator` -- when it sees a `[testnet]` section with `port=5`, it will treat that the same as "testnet.port=5". So `[testnet] port=5` (or `testnet.port=5` without the section header) in bitcoin.conf and `-testnet.port=5` on the command line.
The other aspect to this question is possibly limiting some options so that there is no possibility of accidental cross-contamination across networks. For example, if you're using a particular wallet.dat on mainnet, you may not want to accidentally use the same wallet on testnet and risk reusing keys.
I've set this up so that the `-addnode` and `-wallet` options are `NETWORK_ONLY`, so that if you have a bitcoin.conf:
wallet=/secret/wallet.dat
upnp=1
and you run `bitcoind -testnet` or `bitcoind -regtest`, then the `wallet=` setting will be ignored, and should behave as if your bitcoin.conf had specified:
upnp=1
[main]
wallet=/secret/wallet.dat
For any `NETWORK_ONLY` options, if you're using `-testnet` or `-regtest`, you'll have to add the prefix to any command line options. This was necessary for `multiwallet.py` for instance.
I've left the "default" options as taking precedence over network specific ones, which might be backwards. So if you have:
maxmempool=200
[regtest]
maxmempool=100
your maxmempool will still be 200 on regtest. The advantage of doing it this way is that if you have `[regtest] maxmempool=100` in bitcoin.conf, and then say `bitcoind -regtest -maxmempool=200`, the same result is probably in line with what you expect...
The other thing to note is that I'm using the chain names from `chainparamsbase.cpp` / `ChainNameFromCommandLine`, so the sections are `[main]`, `[test]` and `[regtest]`; not `[mainnet]` or `[testnet]` as might be expected.
Thoughts? Ping @MeshCollider @laanwj @jonasschnelli @morcos
Tree-SHA512: f00b5eb75f006189987e5c15e154a42b66ee251777768c1e185d764279070fcb7c41947d8794092b912a03d985843c82e5189871416995436a6260520fb7a4db
|
|
|
|
|
|
|
|
|
|
|
|
When a -nofoo option is seen, instead of adding it to a separate
set of negated args, set the arg as being an empty vector of strings.
This changes the behaviour in some ways:
- -nofoo=0 still sets foo=1 but no longer treats it as a negated arg
- -nofoo=1 -foo=2 has GetArgs() return [2] rather than [2,0]
- "foo=2 \n -nofoo=1" in a config file no longer returns [2,0], just [0]
- GetArgs returns an empty vector for negated args
|
|
|
|
9b0f0c5 Add m_ prefix to WalletBatch::m_batch (Russell Yanofsky)
398c6f0 Update walletdb comment after renaming. (Russell Yanofsky)
ea23945 scripted-diff: Rename wallet database classes (Russell Yanofsky)
Pull request description:
Scripted diff to rename some wallet classes. Motivated by discussion in https://github.com/bitcoin/bitcoin/pull/11687#discussion_r155354119
| Current | New |
| ---------------- | ------------------- |
| CDBEnv | BerkeleyEnvironment |
| CDB | BerkeleyBatch |
| CWalletDBWrapper | WalletDatabase |
| CWalletDB | WalletBatch |
Berkeley\* classes are intended to contain BDB specific code, while Wallet\* classes are intended to be more backend-agnostic.
Also renamed associated variables:
| Current | New |
| ------------------- | --------------- |
| dbw | database |
| pwalletdb | batch |
| pwalletdbEncryption | encrypted_batch |
Tree-SHA512: 372f2e24b2deb59d4792b5ed578aaf0cce51b6db41c400bef5d0c2cd7833e62ae4d4afa0f6000268d52e15b20f737c5a55f1cecf7768556a782fd8cd6fe051d9
|
|
-BEGIN VERIFY SCRIPT-
sed -i 's/\<CWalletDBWrapper\>/BerkeleyDatabase/g' src/wallet/db.h src/wallet/db.cpp
sed -i '/statuses/i/** Backend-agnostic database type. */\nusing WalletDatabase = BerkeleyDatabase\;\n' src/wallet/walletdb.h
ren() { git grep -l "\<$1\>" 'src/*.cpp' 'src/*.h' ':(exclude)*dbwrapper*' test | xargs sed -i "s:\<$1\>:$2:g"; }
ren CDBEnv BerkeleyEnvironment
ren CDB BerkeleyBatch
ren CWalletDBWrapper WalletDatabase
ren CWalletDB WalletBatch
ren dbw database
ren m_dbw m_database
ren walletdb batch
ren pwalletdb batch
ren pwalletdbIn batch_in
ren wallet/batch.h wallet/walletdb.h
ren pwalletdbEncryption encrypted_batch
-END VERIFY SCRIPT-
|
|
|
|
|
|
|
|
|
|
f7683cba7b Track negated arguments in the argument paser. (Evan Klitzke)
4f872b2450 Add additional tests for GetBoolArg() (Evan Klitzke)
Pull request description:
This change explicitly enable tracking negated options in the option parser. A negated option is one passed with a `-no` prefix. For example, `-nofoo` is the negated form of `-foo`. Negated options were originally added in the 0.6 release.
The change here allows code to explicitly distinguish between cases like `-nofoo` and `-foo=0`, which was not possible previously. The option parser does not have any changed semantics as a result of this change, and existing code will parse options just as it did before.
The motivation for this change is to provide a way to disable options that are otherwise not boolean options. For example, the `-debuglogfile` option is normally interpreted as a string, where the value is the log file name. With this change a user can pass in `-nodebuglogfile` and the code can see that it was explicitly negated, and use that to disable the log file.
This change originally split out from #12689.
Tree-SHA512: cd5a7354eb03d2d402863c7b69e512cad382781d9b8f18c1ab104fc46d45a712530818d665203082da39572c8a42313c5be09306dc2a7227cdedb20ef7314823
|
|
This commit adds tracking for negated arguments. This change will be used in a
future commit that allows disabling the debug.log file using -nodebuglogfile.
|
|
This is meant to be an intermediate commit to prove that the next does not
introduce any changes in the semantics of boolean option parsing.
|
|
|
|
8674e74 Provide relevant error message if datadir is not writable. (murrayn)
Pull request description:
If the --datadir exists, but is not writable, the current error message on startup is 'Cannot obtain a lock on data directory foo. Bitcoin Core is probably already running.' This is misleading.
I believe this PR addresses #11668, although the issue is not Windows-specific.
Tree-SHA512: 10cbbaea433072aee4fb3e8938a72073c7a5c841f7a7685c9e12549c322b2925c7d34bac254ac33021b23132bfc352c058712bc9542298cf86f8fd9757f528b2
|
|
|
|
* Z is the zone designator for the zero UTC offset.
* T is the delimiter used to separate date and time.
This makes it clear for the end-user that the date/time logged is
specified in UTC and not in the local time zone.
|
|
d918eb7864 Fix typos (practicalswift)
Pull request description:
Fix typos.
Tree-SHA512: c790e49be6e01c8d70ebd872ef61cc210c1de15c4a1e5a98280169f32dc8a14cd68f4dd1c23afc76758b28ef355ab12ded2ff7504562dc9b69a11839ad3cd7e3
|
|
ac48861 Add tests for HexStr std::reverse_iterator cases (Kosta Zertsekel)
90eac8c Add tests for HexStr corner cases (Kosta Zertsekel)
Pull request description:
Tree-SHA512: 6298d6fdc344e67a9ea6dc74eadb04e68f4f49fc4511d4a8765cafce7eeb8603f96ebedd82c13811326bcaf1ee511946419b651ca411f711baca91bec51947d6
|