diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rwxr-xr-x | tests/functional_tests/blockchain.py | 7 | ||||
-rwxr-xr-x | tests/functional_tests/cold_signing.py | 7 | ||||
-rwxr-xr-x | tests/functional_tests/functional_tests_rpc.py | 1 | ||||
-rwxr-xr-x | tests/functional_tests/mining.py | 7 | ||||
-rwxr-xr-x | tests/functional_tests/multisig.py | 7 | ||||
-rwxr-xr-x | tests/functional_tests/proofs.py | 7 | ||||
-rwxr-xr-x | tests/functional_tests/transfer.py | 7 | ||||
-rwxr-xr-x | tests/functional_tests/txpool.py | 7 | ||||
-rwxr-xr-x | tests/functional_tests/wallet_address.py | 8 | ||||
-rw-r--r-- | tests/unit_tests/logging.cpp | 3 | ||||
-rw-r--r-- | tests/unit_tests/output_distribution.cpp | 7 |
12 files changed, 69 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bbb0bc051..afc69ee88 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -66,6 +66,7 @@ else () # Emulate the FindGTest module's variable. set(GTEST_LIBRARIES gtest gtest_main) + set(GTEST_BOTH_LIBRARIES gtest gtest_main) include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/gtest/include") endif (GTest_FOUND) diff --git a/tests/functional_tests/blockchain.py b/tests/functional_tests/blockchain.py index 56164600d..6376b86d0 100755 --- a/tests/functional_tests/blockchain.py +++ b/tests/functional_tests/blockchain.py @@ -45,9 +45,16 @@ from framework.daemon import Daemon class BlockchainTest(): def run_test(self): + self.reset() self._test_generateblocks(5) self._test_alt_chains() + def reset(self): + print 'Resetting blockchain' + daemon = Daemon() + daemon.pop_blocks(1000) + daemon.flush_txpool() + def _test_generateblocks(self, blocks): assert blocks >= 2 diff --git a/tests/functional_tests/cold_signing.py b/tests/functional_tests/cold_signing.py index e5430f87c..59a879e0a 100755 --- a/tests/functional_tests/cold_signing.py +++ b/tests/functional_tests/cold_signing.py @@ -38,10 +38,17 @@ from framework.wallet import Wallet class ColdSigningTest(): def run_test(self): + self.reset() self.create(0) self.mine() self.transfer() + def reset(self): + print 'Resetting blockchain' + daemon = Daemon() + daemon.pop_blocks(1000) + daemon.flush_txpool() + def create(self, idx): print 'Creating hot and cold wallet' diff --git a/tests/functional_tests/functional_tests_rpc.py b/tests/functional_tests/functional_tests_rpc.py index 83b75a088..e754b4e33 100755 --- a/tests/functional_tests/functional_tests_rpc.py +++ b/tests/functional_tests/functional_tests_rpc.py @@ -98,6 +98,7 @@ FAIL = [] for test in tests: try: print('[TEST STARTED] ' + test) + sys.stdout.flush() cmd = [python, srcdir + '/' + test + ".py"] subprocess.check_call(cmd) PASS.append(test) diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py index 1b189beb2..78dc68640 100755 --- a/tests/functional_tests/mining.py +++ b/tests/functional_tests/mining.py @@ -43,9 +43,16 @@ from framework.wallet import Wallet class MiningTest(): def run_test(self): + self.reset() self.create() self.mine() + def reset(self): + print 'Resetting blockchain' + daemon = Daemon() + daemon.pop_blocks(1000) + daemon.flush_txpool() + def create(self): print 'Creating wallet' wallet = Wallet() diff --git a/tests/functional_tests/multisig.py b/tests/functional_tests/multisig.py index a61f30001..476e3a02d 100755 --- a/tests/functional_tests/multisig.py +++ b/tests/functional_tests/multisig.py @@ -38,6 +38,7 @@ from framework.wallet import Wallet class MultisigTest(): def run_test(self): + self.reset() self.mine('493DsrfJPqiN3Suv9RcRDoZEbQtKZX1sNcGPA3GhkKYEEmivk8kjQrTdRdVc4ZbmzWJuE157z9NNUKmF2VDfdYDR3CziGMk', 5) self.mine('42jSRGmmKN96V2j3B8X2DbiNThBXW1tSi1rW1uwkqbyURenq3eC3yosNm8HEMdHuWwKMFGzMUB3RCTvcTaW9kHpdRPP7p5y', 5) self.mine('47fF32AdrmXG84FcPY697uZdd42pMMGiH5UpiTRTt3YX2pZC7t7wkzEMStEicxbQGRfrYvAAYxH6Fe8rnD56EaNwUgxRd53', 5) @@ -68,6 +69,12 @@ class MultisigTest(): self.import_multisig_info([0, 1, 2, 3], 6) self.check_transaction(txid) + def reset(self): + print 'Resetting blockchain' + daemon = Daemon() + daemon.pop_blocks(1000) + daemon.flush_txpool() + def mine(self, address, blocks): print("Mining some blocks") daemon = Daemon() diff --git a/tests/functional_tests/proofs.py b/tests/functional_tests/proofs.py index 0a0b6304d..844131095 100755 --- a/tests/functional_tests/proofs.py +++ b/tests/functional_tests/proofs.py @@ -38,6 +38,7 @@ from framework.wallet import Wallet class ProofsTest(): def run_test(self): + self.reset() self.mine('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 80) self.create_wallets() txid, tx_key, amount = self.transfer() @@ -45,6 +46,12 @@ class ProofsTest(): self.check_tx_proof(txid, amount) self.check_reserve_proof() + def reset(self): + print 'Resetting blockchain' + daemon = Daemon() + daemon.pop_blocks(1000) + daemon.flush_txpool() + def mine(self, address, blocks): print("Mining some blocks") daemon = Daemon() diff --git a/tests/functional_tests/transfer.py b/tests/functional_tests/transfer.py index bc2f5472b..1ff641d1f 100755 --- a/tests/functional_tests/transfer.py +++ b/tests/functional_tests/transfer.py @@ -39,6 +39,7 @@ from framework.wallet import Wallet class TransferTest(): def run_test(self): + self.reset() self.create() self.mine() self.transfer() @@ -46,6 +47,12 @@ class TransferTest(): self.check_double_spend_detection() self.sweep_single() + def reset(self): + print 'Resetting blockchain' + daemon = Daemon() + daemon.pop_blocks(1000) + daemon.flush_txpool() + def create(self): print 'Creating wallets' seeds = [ diff --git a/tests/functional_tests/txpool.py b/tests/functional_tests/txpool.py index 71109c9e5..d74395f10 100755 --- a/tests/functional_tests/txpool.py +++ b/tests/functional_tests/txpool.py @@ -38,10 +38,17 @@ from framework.wallet import Wallet class TransferTest(): def run_test(self): + self.reset() self.create() self.mine() self.check_txpool() + def reset(self): + print 'Resetting blockchain' + daemon = Daemon() + daemon.pop_blocks(1000) + daemon.flush_txpool() + def create(self): print 'Creating wallet' wallet = Wallet() diff --git a/tests/functional_tests/wallet_address.py b/tests/functional_tests/wallet_address.py index cb9c52e7a..8a55521c6 100755 --- a/tests/functional_tests/wallet_address.py +++ b/tests/functional_tests/wallet_address.py @@ -39,9 +39,11 @@ Test the following RPCs: """ from framework.wallet import Wallet +from framework.daemon import Daemon class WalletAddressTest(): def run_test(self): + self.reset() self.create() self.check_main_address() self.check_keys() @@ -49,6 +51,12 @@ class WalletAddressTest(): self.open_close() self.languages() + def reset(self): + print 'Resetting blockchain' + daemon = Daemon() + daemon.pop_blocks(1000) + daemon.flush_txpool() + def create(self): print 'Creating wallet' wallet = Wallet() diff --git a/tests/unit_tests/logging.cpp b/tests/unit_tests/logging.cpp index 12d49e2fb..056eae604 100644 --- a/tests/unit_tests/logging.cpp +++ b/tests/unit_tests/logging.cpp @@ -44,7 +44,10 @@ static void init() static void cleanup() { + // windows does not let files be deleted if still in use, so leave droppings there +#ifndef _WIN32 boost::filesystem::remove(log_filename); +#endif } static size_t nlines(const std::string &str) diff --git a/tests/unit_tests/output_distribution.cpp b/tests/unit_tests/output_distribution.cpp index 45f2c135b..2f3c78642 100644 --- a/tests/unit_tests/output_distribution.cpp +++ b/tests/unit_tests/output_distribution.cpp @@ -62,6 +62,13 @@ public: return d; } + std::vector<uint64_t> get_block_weights(uint64_t start_offset, size_t count) const override + { + std::vector<uint64_t> weights; + while (count--) weights.push_back(1); + return weights; + } + uint64_t blockchain_height; }; |