|
9 | 9 | import argparse
|
10 | 10 | import logging
|
11 | 11 | import os
|
| 12 | +import platform |
12 | 13 | import pdb
|
13 | 14 | import random
|
14 | 15 | import re
|
@@ -821,6 +822,29 @@ def skip_if_no_py3_zmq(self):
|
821 | 822 | except ImportError:
|
822 | 823 | raise SkipTest("python3-zmq module not available.")
|
823 | 824 |
|
| 825 | + def skip_if_no_python_bcc(self): |
| 826 | + """Attempt to import the bcc package and skip the tests if the import fails.""" |
| 827 | + try: |
| 828 | + import bcc # type: ignore[import] # noqa: F401 |
| 829 | + except ImportError: |
| 830 | + raise SkipTest("bcc python module not available") |
| 831 | + |
| 832 | + def skip_if_no_bitcoind_tracepoints(self): |
| 833 | + """Skip the running test if bitcoind has not been compiled with USDT tracepoint support.""" |
| 834 | + if not self.is_usdt_compiled(): |
| 835 | + raise SkipTest("bitcoind has not been built with USDT tracepoints enabled.") |
| 836 | + |
| 837 | + def skip_if_no_bpf_permissions(self): |
| 838 | + """Skip the running test if we don't have permissions to do BPF syscalls and load BPF maps.""" |
| 839 | + # check for 'root' permissions |
| 840 | + if os.geteuid() != 0: |
| 841 | + raise SkipTest("no permissions to use BPF (please review the tests carefully before running them with higher privileges)") |
| 842 | + |
| 843 | + def skip_if_platform_not_linux(self): |
| 844 | + """Skip the running test if we are not on a Linux platform""" |
| 845 | + if platform.system() != "Linux": |
| 846 | + raise SkipTest("not on a Linux system") |
| 847 | + |
824 | 848 | def skip_if_no_bitcoind_zmq(self):
|
825 | 849 | """Skip the running test if bitcoind has not been compiled with zmq support."""
|
826 | 850 | if not self.is_zmq_compiled():
|
@@ -902,6 +926,10 @@ def is_zmq_compiled(self):
|
902 | 926 | """Checks whether the zmq module was compiled."""
|
903 | 927 | return self.config["components"].getboolean("ENABLE_ZMQ")
|
904 | 928 |
|
| 929 | + def is_usdt_compiled(self): |
| 930 | + """Checks whether the USDT tracepoints were compiled.""" |
| 931 | + return self.config["components"].getboolean("ENABLE_USDT_TRACEPOINTS") |
| 932 | + |
905 | 933 | def is_sqlite_compiled(self):
|
906 | 934 | """Checks whether the wallet module was compiled with Sqlite support."""
|
907 | 935 | return self.config["components"].getboolean("USE_SQLITE")
|
|
0 commit comments