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, args.interface) if success and args.ledger: success &= ledger_test_suite(args.ledger_path, rpc, userpass, args.interface) sys.exit(not success)
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 args.bitbox: suite.addTest(digitalbitbox_test_suite(args.bitbox_path, rpc, userpass, args.interface)) if args.coldcard: suite.addTest(coldcard_test_suite(args.coldcard_path, rpc, userpass, args.interface)) if args.trezor: suite.addTest(trezor_test_suite(args.trezor_path, rpc, userpass, args.interface)) if args.trezor_t: suite.addTest(trezor_test_suite(args.trezor_t_path, rpc, userpass, args.interface, True)) if args.keepkey: suite.addTest(keepkey_test_suite(args.keepkey_path, rpc, userpass, args.interface)) if args.ledger: suite.addTest(ledger_test_suite(args.ledger_path, rpc, userpass, args.interface)) result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(suite) sys.exit(not result.wasSuccessful())
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.bitbox01 = False if args.bitbox01 is None else args.bitbox01 args.ledger = False if args.ledger is None else args.ledger if args.trezor_1 or args.trezor_t or args.coldcard or args.ledger or args.keepkey or args.bitbox01: # Start bitcoind rpc, userpass = start_bitcoind(args.bitcoind) if success and args.bitbox01: success &= digitalbitbox_test_suite(args.bitbox01_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_1: success &= trezor_test_suite(args.trezor_1_path, rpc, userpass, args.interface, '1') if success and args.trezor_t: success &= trezor_test_suite(args.trezor_t_path, rpc, userpass, args.interface, 't') if success and args.keepkey: success &= keepkey_test_suite(args.keepkey_path, rpc, userpass, args.interface) if success and args.ledger: success &= ledger_test_suite(args.ledger_path, rpc, userpass, args.interface) sys.exit(not success)
dbb_group = parser.add_mutually_exclusive_group() dbb_group.add_argument('--no_bitbox', help='Do not run Digital Bitbox test with simulator', action='store_true') dbb_group.add_argument('--bitbox', help='Path to Digital bitbox simulator.', default='work/mcu/build/bin/simulator') parser.add_argument('--bitcoind', help='Path to bitcoind.', default='work/bitcoin/src/bitcoind') parser.add_argument('--interface', help='Which interface to send commands over', choices=['library', 'cli', 'bindist', 'stdin'], default='library') args = parser.parse_args() # Run tests suite = unittest.TestSuite() suite.addTests(unittest.defaultTestLoader.loadTestsFromTestCase(TestDescriptor)) suite.addTests(unittest.defaultTestLoader.loadTestsFromTestCase(TestSegwitAddress)) suite.addTests(unittest.defaultTestLoader.loadTestsFromTestCase(TestPSBT)) if not args.no_trezor or not args.no_coldcard or args.ledger or not args.no_bitbox or not args.no_keepkey: # Start bitcoind rpc, userpass = start_bitcoind(args.bitcoind) if not args.no_trezor: suite.addTest(trezor_test_suite(args.trezor, rpc, userpass, args.interface)) if not args.no_coldcard: suite.addTest(coldcard_test_suite(args.coldcard, rpc, userpass, args.interface)) if args.ledger: suite.addTest(ledger_test_suite(rpc, userpass, args.interface)) if not args.no_bitbox: suite.addTest(digitalbitbox_test_suite(rpc, userpass, args.bitbox, args.interface)) if not args.no_keepkey: suite.addTest(keepkey_test_suite(args.keepkey, rpc, userpass, args.interface)) result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(suite) sys.exit(not result.wasSuccessful())
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.bitbox01 = False if args.bitbox01 is None else args.bitbox01 args.ledger = False if args.ledger is None else args.ledger args.ledger_legacy = False if args.ledger_legacy is None else args.ledger_legacy args.jade = False if args.jade is None else args.jade if args.trezor_1 or args.trezor_t or args.coldcard or args.ledger or args.ledger_legacy or args.keepkey or args.bitbox01 or args.jade: # Start bitcoind bitcoind = Bitcoind.create(args.bitcoind) if success and args.bitbox01: success &= digitalbitbox_test_suite(args.bitbox01_path, bitcoind, args.interface) if success and args.coldcard: success &= coldcard_test_suite(args.coldcard_path, bitcoind, args.interface) if success and args.trezor_1: success &= trezor_test_suite(args.trezor_1_path, bitcoind, args.interface, '1') if success and args.trezor_t: success &= trezor_test_suite(args.trezor_t_path, bitcoind, args.interface, 't') if success and args.keepkey: success &= keepkey_test_suite(args.keepkey_path, bitcoind, args.interface) if success and args.ledger: success &= ledger_test_suite(args.ledger_path, bitcoind, args.interface, False) if success and args.ledger_legacy: success &= ledger_test_suite(args.ledger_path, bitcoind, args.interface, True) if success and args.jade: success &= jade_test_suite(args.jade_path, bitcoind, args.interface) sys.exit(not success)