~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/net/lib/py/ynl.py

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 # SPDX-License-Identifier: GPL-2.0
  2 
  3 import sys
  4 from pathlib import Path
  5 from .consts import KSRC, KSFT_DIR
  6 from .ksft import ksft_pr, ktap_result
  7 
  8 # Resolve paths
  9 try:
 10     if (KSFT_DIR / "kselftest-list.txt").exists():
 11         # Running in "installed" selftests
 12         tools_full_path = KSFT_DIR
 13         SPEC_PATH = KSFT_DIR / "net/lib/specs"
 14 
 15         sys.path.append(tools_full_path.as_posix())
 16         from net.lib.ynl.lib import YnlFamily, NlError
 17     else:
 18         # Running in tree
 19         tools_full_path = KSRC / "tools"
 20         SPEC_PATH = KSRC / "Documentation/netlink/specs"
 21 
 22         sys.path.append(tools_full_path.as_posix())
 23         from net.ynl.lib import YnlFamily, NlError
 24 except ModuleNotFoundError as e:
 25     ksft_pr("Failed importing `ynl` library from kernel sources")
 26     ksft_pr(str(e))
 27     ktap_result(True, comment="SKIP")
 28     sys.exit(4)
 29 
 30 #
 31 # Wrapper classes, loading the right specs
 32 # Set schema='' to avoid jsonschema validation, it's slow
 33 #
 34 class EthtoolFamily(YnlFamily):
 35     def __init__(self):
 36         super().__init__((SPEC_PATH / Path('ethtool.yaml')).as_posix(),
 37                          schema='')
 38 
 39 
 40 class RtnlFamily(YnlFamily):
 41     def __init__(self):
 42         super().__init__((SPEC_PATH / Path('rt_link.yaml')).as_posix(),
 43                          schema='')
 44 
 45 
 46 class NetdevFamily(YnlFamily):
 47     def __init__(self):
 48         super().__init__((SPEC_PATH / Path('netdev.yaml')).as_posix(),
 49                          schema='')

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php