2"""Check that a libsecp256k1 shared library exports only expected symbols.
5 - When building with Autotools:
6 ./tools/symbol-check.py .libs/libsecp256k1.so
7 ./tools/symbol-check.py .libs/libsecp256k1-<V>.dll
8 ./tools/symbol-check.py .libs/libsecp256k1.dylib
10 - When building with CMake:
11 ./tools/symbol-check.py build/lib/libsecp256k1.so
12 ./tools/symbol-check.py build/bin/libsecp256k1-<V>.dll
13 ./tools/symbol-check.py build/lib/libsecp256k1.dylib"""
27 """Adapter function to get exported symbols based on the library format."""
38 """Guess the list of expected exported symbols from the source code."""
40 [
"git",
"grep",
r"^\s*SECP256K1_API",
"--",
"include"],
41 universal_newlines=
True,
51 """Check that the library exports only the expected symbols."""
53 unexpected_exports = set(actual_exports) - set(expected_exports)
54 if unexpected_exports != set():
65 except UnexpectedExport
as e:
66 print(f
"{sys.argv[0]}: In {sys.argv[1]}: {e}")
71if __name__ ==
"__main__":
list[str] get_exported_exports(library)
list[str] grep_expected_symbols()
None check_symbols(library, expected_exports)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.