args.coldcard = True if args.coldcard is None else args.coldcard args.keepkey = True if args.keepkey is None else args.keepkey args.bitbox = True if args.bitbox is None else args.bitbox args.ledger = True if args.ledger is None else args.ledger else: # Default all false unless overridden args.trezor = False if args.trezor is None else args.trezor args.trezor_t = False if args.trezor_t is None else args.trezor_t args.coldcard = False if args.coldcard is None else args.coldcard args.keepkey = False if args.keepkey is None else args.keepkey args.bitbox = False if args.bitbox is None else args.bitbox args.ledger = False if args.ledger is None else args.ledger if args.trezor or args.trezor_t or args.coldcard or args.ledger or args.keepkey or args.bitbox: # Start bitcoind rpc, userpass = start_bitcoind(args.bitcoind) if success and args.bitbox: success &= digitalbitbox_test_suite(args.bitbox_path, rpc, userpass, args.interface) if success and args.coldcard: success &= coldcard_test_suite(args.coldcard_path, rpc, userpass, args.interface) if success and args.trezor: success &= trezor_test_suite(args.trezor_path, rpc, userpass, args.interface) if success and args.trezor_t: success &= trezor_test_suite(args.trezor_t_path, rpc, userpass, args.interface, True) if success and args.keepkey: success &= keepkey_test_suite(args.keepkey_path, rpc, userpass,
] # Generic device tests suite = unittest.TestSuite() suite.addTest(DeviceTestCase.parameterize(TestColdcardManCommands, rpc, userpass, dev_type, dev_type, sim_path, fpr, '', interface=interface)) suite.addTest(DeviceTestCase.parameterize(TestColdcardGetXpub, rpc, userpass, dev_type, dev_type, sim_path, fpr, xpub, interface=interface)) suite.addTest(DeviceTestCase.parameterize(TestDeviceConnect, rpc, userpass, dev_type, dev_type, sim_path, fpr, xpub, interface=interface)) suite.addTest(DeviceTestCase.parameterize(TestDeviceConnect, rpc, userpass, 'coldcard_simulator', dev_type, sim_path, fpr, xpub, interface=interface)) suite.addTest(DeviceTestCase.parameterize(TestGetDescriptors, rpc, userpass, dev_type, dev_type, sim_path, fpr, xpub, interface=interface)) suite.addTest(DeviceTestCase.parameterize(TestGetKeypool, rpc, userpass, dev_type, dev_type, sim_path, fpr, xpub, interface=interface)) suite.addTest(DeviceTestCase.parameterize(TestDisplayAddress, rpc, userpass, dev_type, dev_type, sim_path, fpr, xpub, interface=interface)) suite.addTest(DeviceTestCase.parameterize(TestSignMessage, rpc, userpass, dev_type, dev_type, sim_path, fpr, xpub, interface=interface)) suite.addTest(DeviceTestCase.parameterize(TestSignTx, rpc, userpass, dev_type, dev_type, sim_path, fpr, xpub, interface=interface, signtx_cases=signtx_cases)) result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(suite) cleanup_simulator() atexit.unregister(cleanup_simulator) return result.wasSuccessful() if __name__ == '__main__': parser = argparse.ArgumentParser(description='Test Coldcard implementation') parser.add_argument('simulator', help='Path to the Coldcard simulator') parser.add_argument('groestlcoind', help='Path to groestlcoind binary') parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli', 'bindist'], default='library') args = parser.parse_args() # Start bitcoind rpc, userpass = start_bitcoind(args.groestlcoind) sys.exit(not coldcard_test_suite(args.simulator, rpc, userpass, args.interface))