@ -44,9 +44,9 @@ TEST_EXIT_FAILED = 1
@@ -44,9 +44,9 @@ TEST_EXIT_FAILED = 1
TEST_EXIT_SKIPPED = 77
class BitcoinTestFramework ( object ) :
""" Base class for a bit coin test script.
""" Base class for a lite coin test script.
Individual bit coin test scripts should subclass this class and override the set_test_params ( ) and run_test ( ) methods .
Individual lite coin test scripts should subclass this class and override the set_test_params ( ) and run_test ( ) methods .
Individual tests can also override the following methods to customize the test setup :
@ -73,11 +73,11 @@ class BitcoinTestFramework(object):
@@ -73,11 +73,11 @@ class BitcoinTestFramework(object):
parser = optparse . OptionParser ( usage = " % prog [options] " )
parser . add_option ( " --nocleanup " , dest = " nocleanup " , default = False , action = " store_true " ,
help = " Leave bit coinds and test.* datadir on exit or error " )
help = " Leave lite coinds and test.* datadir on exit or error " )
parser . add_option ( " --noshutdown " , dest = " noshutdown " , default = False , action = " store_true " ,
help = " Don ' t stop bit coinds after the test execution " )
help = " Don ' t stop lite coinds after the test execution " )
parser . add_option ( " --srcdir " , dest = " srcdir " , default = os . path . normpath ( os . path . dirname ( os . path . realpath ( __file__ ) ) + " /../../../src " ) ,
help = " Source directory containing bitcoind/bit coin-cli (default: %d efault) " )
help = " Source directory containing litecoind/lite coin-cli (default: %d efault) " )
parser . add_option ( " --cachedir " , dest = " cachedir " , default = os . path . normpath ( os . path . dirname ( os . path . realpath ( __file__ ) ) + " /../../cache " ) ,
help = " Directory for caching pregenerated datadirs " )
parser . add_option ( " --tmpdir " , dest = " tmpdir " , help = " Root directory for datadirs " )
@ -142,7 +142,7 @@ class BitcoinTestFramework(object):
@@ -142,7 +142,7 @@ class BitcoinTestFramework(object):
if self . nodes :
self . stop_nodes ( )
else :
self . log . info ( " Note: bit coinds were not stopped and may still be running " )
self . log . info ( " Note: lite coinds were not stopped and may still be running " )
if not self . options . nocleanup and not self . options . noshutdown and success != TestStatus . FAILED :
self . log . info ( " Cleaning up " )
@ -231,7 +231,7 @@ class BitcoinTestFramework(object):
@@ -231,7 +231,7 @@ class BitcoinTestFramework(object):
self . nodes . append ( TestNode ( i , self . options . tmpdir , extra_args [ i ] , rpchost , timewait = timewait , binary = binary [ i ] , stderr = None , mocktime = self . mocktime , coverage_dir = self . options . coveragedir ) )
def start_node ( self , i , extra_args = None , stderr = None ) :
""" Start a bit coind """
""" Start a lite coind """
node = self . nodes [ i ]
@ -242,7 +242,7 @@ class BitcoinTestFramework(object):
@@ -242,7 +242,7 @@ class BitcoinTestFramework(object):
coverage . write_all_rpc_commands ( self . options . coveragedir , node . rpc )
def start_nodes ( self , extra_args = None ) :
""" Start multiple bit coinds """
""" Start multiple lite coinds """
if extra_args is None :
extra_args = [ None ] * self . num_nodes
@ -282,7 +282,7 @@ class BitcoinTestFramework(object):
@@ -282,7 +282,7 @@ class BitcoinTestFramework(object):
self . start_node ( i , extra_args , stderr = log_stderr )
self . stop_node ( i )
except Exception as e :
assert ' bit coind exited' in str ( e ) # node must have shutdown
assert ' lite coind exited' in str ( e ) # node must have shutdown
self . nodes [ i ] . running = False
self . nodes [ i ] . process = None
if expected_msg is not None :
@ -292,9 +292,9 @@ class BitcoinTestFramework(object):
@@ -292,9 +292,9 @@ class BitcoinTestFramework(object):
raise AssertionError ( " Expected error \" " + expected_msg + " \" not found in: \n " + stderr )
else :
if expected_msg is None :
assert_msg = " bit coind should have exited with an error"
assert_msg = " lite coind should have exited with an error"
else :
assert_msg = " bit coind should have exited with expected error " + expected_msg
assert_msg = " lite coind should have exited with expected error " + expected_msg
raise AssertionError ( assert_msg )
def wait_for_node_exit ( self , i , timeout ) :
@ -362,7 +362,7 @@ class BitcoinTestFramework(object):
@@ -362,7 +362,7 @@ class BitcoinTestFramework(object):
self . log . addHandler ( ch )
if self . options . trace_rpc :
rpc_logger = logging . getLogger ( " Bit coinRPC" )
rpc_logger = logging . getLogger ( " Lite coinRPC" )
rpc_logger . setLevel ( logging . DEBUG )
rpc_handler = logging . StreamHandler ( sys . stdout )
rpc_handler . setLevel ( logging . DEBUG )
@ -392,7 +392,7 @@ class BitcoinTestFramework(object):
@@ -392,7 +392,7 @@ class BitcoinTestFramework(object):
# Create cache directories, run bitcoinds:
for i in range ( MAX_NODES ) :
datadir = initialize_datadir ( self . options . cachedir , i )
args = [ os . getenv ( " BIT COIND" , " bit coind" ) , " -server " , " -keypool=1 " , " -datadir= " + datadir , " -discover=0 " ]
args = [ os . getenv ( " LITE COIND" , " lite coind" ) , " -server " , " -keypool=1 " , " -datadir= " + datadir , " -discover=0 " ]
if i > 0 :
args . append ( " -connect=127.0.0.1: " + str ( p2p_port ( 0 ) ) )
self . nodes . append ( TestNode ( i , self . options . cachedir , extra_args = [ ] , rpchost = None , timewait = None , binary = None , stderr = None , mocktime = self . mocktime , coverage_dir = None ) )
@ -410,6 +410,7 @@ class BitcoinTestFramework(object):
@@ -410,6 +410,7 @@ class BitcoinTestFramework(object):
#
# blocks are created with timestamps 10 minutes apart
# starting from 2010 minutes in the past
self . enable_mocktime ( )
block_time = self . mocktime - ( 201 * 10 * 60 )
for i in range ( 2 ) :
@ -448,7 +449,7 @@ class BitcoinTestFramework(object):
@@ -448,7 +449,7 @@ class BitcoinTestFramework(object):
class ComparisonTestFramework ( BitcoinTestFramework ) :
""" Test framework for doing p2p comparison testing
Sets up some bit coind binaries :
Sets up some lite coind binaries :
- 1 binary : test binary
- 2 binaries : 1 test binary , 1 ref binary
- n > 2 binaries : 1 test binary , n - 1 ref binaries """
@ -459,11 +460,11 @@ class ComparisonTestFramework(BitcoinTestFramework):
@@ -459,11 +460,11 @@ class ComparisonTestFramework(BitcoinTestFramework):
def add_options ( self , parser ) :
parser . add_option ( " --testbinary " , dest = " testbinary " ,
default = os . getenv ( " BIT COIND" , " bit coind" ) ,
help = " bit coind binary to test" )
default = os . getenv ( " LITE COIND" , " lite coind" ) ,
help = " lite coind binary to test" )
parser . add_option ( " --refbinary " , dest = " refbinary " ,
default = os . getenv ( " BIT COIND" , " bit coind" ) ,
help = " bit coind binary to use for reference nodes (if any)" )
default = os . getenv ( " LITE COIND" , " lite coind" ) ,
help = " lite coind binary to use for reference nodes (if any)" )
def setup_network ( self ) :
extra_args = [ [ ' -whitelist=127.0.0.1 ' ] ] * self . num_nodes