1
0

dlinfo_glibc_test.py 516 B

12345678910111213141516171819202122
  1. import ctypes
  2. import os
  3. import pytest
  4. from dlinfo import DLInfo
  5. @pytest.mark.parametrize('lib_name', [
  6. 'c',
  7. 'dl',
  8. 'python_grasp',
  9. ])
  10. def test_dlinfo_path(lib_name):
  11. lib_filename = ctypes.util.find_library(lib_name)
  12. if not lib_filename:
  13. pytest.xfail(f"lib{lib_name} not found")
  14. lib = ctypes.cdll.LoadLibrary(lib_filename)
  15. dlinfo = DLInfo(lib)
  16. assert os.path.exists(dlinfo.path)
  17. assert os.path.isabs(dlinfo.path)
  18. assert lib_filename == os.path.basename(dlinfo.path)