From 81c38a24975f34e5894efe3d1aaf45ff6a8cee4a Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Sun, 29 Dec 2019 18:45:59 +0100 Subject: config: enable passing -asmap an absolute file path - allow passing an absolute file path to the -asmap config arg - update the -asmap config help - add a functional test in feature_asmap.py --- test/functional/feature_asmap.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/feature_asmap.py b/test/functional/feature_asmap.py index a196d7cc9d..07dde84775 100755 --- a/test/functional/feature_asmap.py +++ b/test/functional/feature_asmap.py @@ -8,11 +8,13 @@ Verify node behaviour and debug log when launching bitcoind in these cases: 1. `bitcoind` with no -asmap arg, using /16 prefix for IP bucketing -2. `bitcoind -asmap=`, using the unit test skeleton asmap +2. `bitcoind -asmap=`, using the unit test skeleton asmap -3. `bitcoind -asmap/-asmap=` with no file specified, using the default asmap +3. `bitcoind -asmap=`, using the unit test skeleton asmap -4. `bitcoind -asmap` with no file specified, and a missing default asmap file +4. `bitcoind -asmap/-asmap=` with no file specified, using the default asmap + +5. `bitcoind -asmap` with no file specified and a missing default asmap file The tests are order-independent. The slowest test (missing default asmap file) is placed last. @@ -42,6 +44,15 @@ class AsmapTest(BitcoinTestFramework): with self.node.assert_debug_log(['Using /16 prefix for IP bucketing']): self.start_node(0) + def test_asmap_with_absolute_path(self): + self.log.info('Test bitcoind -asmap=') + self.stop_node(0) + filename = os.path.join(self.datadir, 'my-map-file.map') + shutil.copyfile(self.asmap_raw, filename) + with self.node.assert_debug_log(expected_messages(filename)): + self.start_node(0, ['-asmap={}'.format(filename)]) + os.remove(filename) + def test_asmap_with_relative_path(self): self.log.info('Test bitcoind -asmap=') self.stop_node(0) @@ -74,6 +85,7 @@ class AsmapTest(BitcoinTestFramework): self.asmap_raw = os.path.join(os.path.dirname(os.path.realpath(__file__)), ASMAP) self.test_without_asmap_arg() + self.test_asmap_with_absolute_path() self.test_asmap_with_relative_path() self.test_default_asmap() self.test_default_asmap_with_missing_file() -- cgit v1.2.3