python_code
stringlengths
0
679k
repo_name
stringlengths
9
41
file_path
stringlengths
6
149
import os import sys from TdcPlugin import TdcPlugin from tdc_config import * class SubPlugin(TdcPlugin): def __init__(self): self.sub_class = 'root/SubPlugin' super().__init__() def pre_suite(self, testcount, testidlist): # run commands before test_runner goes into a test loop ...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/selftests/tc-testing/plugin-lib/rootPlugin.py
''' run the command under test, under valgrind and collect memory leak info as a separate test. ''' import os import re import signal from string import Template import subprocess import time from TdcPlugin import TdcPlugin from TdcResults import * from tdc_config import * def vp_extract_num_from_string(num_as_stri...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py
# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) import hashlib import os import socket import struct import sys import unittest import fcntl import select TPM2_ST_NO_SESSIONS = 0x8001 TPM2_ST_SESSIONS = 0x8002 TPM2_CC_FIRST = 0x01FF TPM2_CC_CREATE_PRIMARY = 0x0131 TPM2_CC_DICTIONARY_ATTACK_LOCK_RESET = 0x0139 ...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/selftests/tpm2/tpm2.py
# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) from argparse import ArgumentParser from argparse import FileType import os import sys import tpm2 from tpm2 import ProtocolError import unittest import logging import struct class SmokeTest(unittest.TestCase): def setUp(self): self.client = tpm2.Client...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/selftests/tpm2/tpm2_tests.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # Test that truncation of bprm->buf doesn't cause unexpected execs paths, along # with various other pathological cases. import os, subprocess # Relevant commits # # b5372fe5dc84 ("exec: load_script: Do not exec truncated interpreter path") # 6eb3c3d0a52d ("e...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/selftests/exec/binfmt_script.py
#!/usr/bin/env python3 # Copyright (C) 2017 Netronome Systems, Inc. # Copyright (c) 2019 Mellanox Technologies. All rights reserved # # This software is licensed under the GNU General License Version 2, # June 1991 as shown in the file COPYING in the top-level directory of this # source tree. # # THE COPYRIGHT HOLDERS...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/selftests/bpf/test_offload.py
# SPDX-License-Identifier: GPL-2.0 # Copyright (c) 2020 SUSE LLC. import collections import functools import json import os import socket import subprocess import unittest # Add the source tree of bpftool and /usr/local/sbin to PATH cur_dir = os.path.dirname(os.path.realpath(__file__)) bpftool_dir = os.path.abspath(...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/selftests/bpf/test_bpftool.py
#!/usr/bin/env python3 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) # # Copyright (C) 2021 Isovalent, Inc. import argparse import re import os, sys LINUX_ROOT = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir)) BPFTOOL_DIR = os.getenv('BPFTOOL_DIR', os...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/selftests/bpf/test_bpftool_synctypes.py
# SPDX-License-Identifier: GPL-2.0 # # Collection of configs for building non-UML kernels and running them on QEMU. # # Copyright (C) 2021, Google LLC. # Author: Brendan Higgins <[email protected]> from dataclasses import dataclass from typing import List @dataclass(frozen=True) class QemuArchParams: linux...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/qemu_config.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # A thin wrapper on top of the KUnit Kernel # # Copyright (C) 2019, Google LLC. # Author: Felix Guo <[email protected]> # Author: Brendan Higgins <[email protected]> import argparse import os import re import sys import time assert sys.versio...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/kunit.py
# SPDX-License-Identifier: GPL-2.0 # # Parses KTAP test results from a kernel dmesg log and incrementally prints # results with reader-friendly format. Stores and returns test results in a # Test object. # # Copyright (C) 2019, Google LLC. # Author: Felix Guo <[email protected]> # Author: Brendan Higgins <brend...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/kunit_parser.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # A collection of tests for tools/testing/kunit/kunit.py # # Copyright (C) 2019, Google LLC. # Author: Brendan Higgins <[email protected]> import unittest from unittest import mock import tempfile, shutil # Handling test_tmpdir import itertools impo...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/kunit_tool_test.py
# SPDX-License-Identifier: GPL-2.0 # # Generates JSON from KUnit results according to # KernelCI spec: https://github.com/kernelci/kernelci-doc/wiki/Test-API # # Copyright (C) 2020, Google LLC. # Author: Heidi Fahim <[email protected]> from dataclasses import dataclass import json from typing import Any, Dict fro...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/kunit_json.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # This file runs some basic checks to verify kunit works. # It is only of interest if you're making changes to KUnit itself. # # Copyright (C) 2021, Google LLC. # Author: Daniel Latypov <[email protected]> from concurrent import futures import datetime ...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/run_checks.py
# SPDX-License-Identifier: GPL-2.0 # # Runs UML kernel, collects output, and handles errors. # # Copyright (C) 2019, Google LLC. # Author: Felix Guo <[email protected]> # Author: Brendan Higgins <[email protected]> import importlib.abc import importlib.util import logging import subprocess import os im...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/kunit_kernel.py
# SPDX-License-Identifier: GPL-2.0 # # Builds a .config from a kunitconfig. # # Copyright (C) 2019, Google LLC. # Author: Felix Guo <[email protected]> # Author: Brendan Higgins <[email protected]> from dataclasses import dataclass import re from typing import List, Set CONFIG_IS_NOT_SET_PATTERN = r'^...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/kunit_config.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='x86_64', kconfig=''' CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y''', qemu_arch='x86_64', kernel_path='arch/x86/boot/bzImage', kernel_command_line='console=ttyS0', extra_qemu_params=[])
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/qemu_configs/x86_64.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='i386', kconfig=''' CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y''', qemu_arch='i386', kernel_path='arch/x86/boot/bzImage', kernel_command_line='console=ttyS0', extra_qemu_params=[])
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/qemu_configs/i386.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='sparc', kconfig=''' CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y''', qemu_arch='sparc', kernel_path='arch/sparc/boot/zImage', kernel_command_line='console=ttyS0 mem=256M', extra_qemu_params=['-m', '256'])...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/qemu_configs/sparc.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='arm64', kconfig=''' CONFIG_SERIAL_AMBA_PL010=y CONFIG_SERIAL_AMBA_PL010_CONSOLE=y CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y''', qemu_arch='aarch64', kernel_path='arch/arm64/boot/Image.gz', kernel...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/qemu_configs/arm64.py
from ..qemu_config import QemuArchParams import os import os.path import sys GITHUB_OPENSBI_URL = 'https://github.com/qemu/qemu/raw/master/pc-bios/opensbi-riscv64-generic-fw_dynamic.bin' OPENSBI_FILE = os.path.basename(GITHUB_OPENSBI_URL) if not os.path.isfile(OPENSBI_FILE): print('\n\nOpenSBI file is not in the cur...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/qemu_configs/riscv.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='arm', kconfig=''' CONFIG_ARCH_VIRT=y CONFIG_SERIAL_AMBA_PL010=y CONFIG_SERIAL_AMBA_PL010_CONSOLE=y CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y''', qemu_arch='arm', kernel_path='arch/arm/boot/zImage', ...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/qemu_configs/arm.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='s390', kconfig=''' CONFIG_EXPERT=y CONFIG_TUNE_ZEC12=y CONFIG_NUMA=y CONFIG_MODULES=y''', qemu_arch='s390x', kernel_path='arch/s390/boot/bzImage', kernel_command_line='console=ttyS0', extra_qemu_params=[ ...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/qemu_configs/s390.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='alpha', kconfig=''' CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y''', qemu_arch='alpha', kernel_path='arch/alpha/boot/vmlinux', kernel_command_line='console=ttyS0', extra_qemu_params=[])
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/qemu_configs/alpha.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='powerpc', kconfig=''' CONFIG_PPC64=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_HVC_CONSOLE=y''', qemu_arch='ppc64', kernel_path='vmlinux', kernel_command_line='console=ttyS0', extra_qemu_params=...
nvtrust-main
infrastructure/linux/linux_source/tools/testing/kunit/qemu_configs/powerpc.py
#!/usr/bin/env drgn # SPDX-License-Identifier: GPL-2.0+ # # Dump out the number of RCU callbacks outstanding. # # On older kernels having multiple flavors of RCU, this dumps out the # number of callbacks for the most heavily used flavor. # # Usage: sudo drgn rcu-cbs.py # # Copyright (C) 2021 Facebook, Inc. # # Authors:...
nvtrust-main
infrastructure/linux/linux_source/tools/rcu/rcu-cbs.py
from os import getenv, path from subprocess import Popen, PIPE from re import sub cc = getenv("CC") cc_is_clang = b"clang version" in Popen([cc.split()[0], "-v"], stderr=PIPE).stderr.readline() src_feature_tests = getenv('srctree') + '/tools/build/feature' def clang_has_option(option): cc_output = Popen([cc, opt...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/util/setup.py
#! /usr/bin/env python # SPDX-License-Identifier: GPL-2.0-only # -*- python -*- # -*- coding: utf-8 -*- # twatch - Experimental use of the perf python interface # Copyright (C) 2011 Arnaldo Carvalho de Melo <[email protected]> # import perf def main(context_switch = 0, thread = -1): cpus = perf.cpu_map() threads ...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/python/twatch.py
#! /usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # -*- python -*- # -*- coding: utf-8 -*- import perf class tracepoint(perf.evsel): def __init__(self, sys, name): config = perf.tracepoint(sys, name) perf.evsel.__init__(self, type = perf.TYPE_TRACEPOINT, ...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/python/tracepoint.py
# SPDX-License-Identifier: GPL-2.0 from __future__ import print_function import os import sys import glob import optparse import tempfile import logging import shutil try: import configparser except ImportError: import ConfigParser as configparser def data_equal(a, b): # Allow multiple values in assignm...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/tests/attr.py
# SPDX-License-Identifier: GPL-2.0 # arm-cs-trace-disasm.py: ARM CoreSight Trace Dump With Disassember # # Author: Tor Jeremiassen <[email protected]> # Mathieu Poirier <[email protected]> # Leo Yan <[email protected]> # Al Grant <[email protected]> from __future__ import print_function impor...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/arm-cs-trace-disasm.py
# event_analyzing_sample.py: general event handler in python # SPDX-License-Identifier: GPL-2.0 # # Current perf report is already very powerful with the annotation integrated, # and this script is not trying to be as powerful as perf report, but # providing end user/developer a flexible way to analyze the events other...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/event_analyzing_sample.py
# Monitor the system for dropped packets and proudce a report of drop locations and counts # SPDX-License-Identifier: GPL-2.0 from __future__ import print_function import os import sys sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') from perf_trace_context import ...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/net_dropmonitor.py
# export-to-postgresql.py: export perf data to a postgresql database # Copyright (c) 2014, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundation. # # Thi...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/export-to-postgresql.py
# system call top # (c) 2010, Tom Zanussi <[email protected]> # Licensed under the terms of the GNU GPL License version 2 # # Periodically displays system-wide system call totals, broken down by # syscall. If a [comm] arg is specified, only syscalls called by # [comm] are displayed. If an [interval] arg is specified,...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/sctop.py
# SPDX-License-Identifier: GPL-2.0+ # # Copyright (C) 2018 Ravi Bangoria, IBM Corporation # # Hypervisor call statisics from __future__ import print_function import os import sys sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') from perf_trace_context import * from...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/powerpc-hcalls.py
# mem-phys-addr.py: Resolve physical address samples # SPDX-License-Identifier: GPL-2.0 # # Copyright (c) 2018, Intel Corporation. from __future__ import division from __future__ import print_function import os import sys import struct import re import bisect import collections sys.path.append(os.environ['PERF_EXEC_...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/mem-phys-addr.py
#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # libxed.py: Python wrapper for libxed.so # Copyright (c) 2014-2021, Intel Corporation. # To use Intel XED, libxed.so must be present. To build and install # libxed.so: # git clone https://github.com/intelxed/mbuild.git mbuild # git clone h...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/libxed.py
# system call counts # (c) 2010, Tom Zanussi <[email protected]> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide system call totals, broken down by syscall. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. from __future__ import print_function import ...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/syscall-counts.py
# futex contention # (c) 2010, Arnaldo Carvalho de Melo <[email protected]> # Licensed under the terms of the GNU GPL License version 2 # # Translation of: # # http://sourceware.org/systemtap/wiki/WSFutexContention # # to perf python scripting. # # Measures futex contention from __future__ import print_function import ...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/futex-contention.py
#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # exported-sql-viewer.py: view data from sql database # Copyright (c) 2014-2018, Intel Corporation. # To use this script you will need to have exported data using either the # export-to-sqlite.py or the export-to-postgresql.py script. Refer to those # scripts f...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/exported-sql-viewer.py
# Display a process of packets and processed time. # SPDX-License-Identifier: GPL-2.0 # It helps us to investigate networking or network device. # # options # tx: show only tx chart # rx: show only rx chart # dev=: show only thing related to specified device # debug: work with debug mode. It shows buffer status. from ...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/netdev-times.py
# failed system call counts, by pid # (c) 2010, Tom Zanussi <[email protected]> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide failed system call totals, broken down by pid. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. from __future__ import print...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/failed-syscalls-by-pid.py
# export-to-sqlite.py: export perf data to a sqlite3 database # Copyright (c) 2017, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundation. # # This progr...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/export-to-sqlite.py
# Cpu task migration overview toy # # Copyright (C) 2010 Frederic Weisbecker <[email protected]> # # perf script event handlers have been generated by perf script -g python # # This software is distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundat...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/sched-migration.py
# system call counts, by pid # (c) 2010, Tom Zanussi <[email protected]> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide system call totals, broken down by syscall. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. from __future__ import print_function ...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/syscall-counts-by-pid.py
# flamegraph.py - create flame graphs from perf samples # SPDX-License-Identifier: GPL-2.0 # # Usage: # # perf record -a -g -F 99 sleep 60 # perf script report flamegraph # # Combined: # # perf script flamegraph -a -F 99 sleep 60 # # Written by Andreas Gerstmayr <[email protected]> # Flame Graphs invent...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/flamegraph.py
# SPDX-License-Identifier: GPL-2.0 from __future__ import print_function data = {} times = [] threads = [] cpus = [] def get_key(time, event, cpu, thread): return "%d-%s-%d-%d" % (time, event, cpu, thread) def store_key(time, cpu, thread): if (time not in times): times.append(time) if (...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/stat-cpi.py
# perf script event handlers, generated by perf script -g python # (c) 2010, Tom Zanussi <[email protected]> # Licensed under the terms of the GNU GPL License version 2 # # This script tests basic functionality such as flag and symbol # strings, common_xxx() calls back into perf, begin, end, unhandled # events, etc. ...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/check-perf-trace.py
# report time spent in compaction # Licensed under the terms of the GNU GPL License version 2 # testing: # 'echo 1 > /proc/sys/vm/compact_memory' to force compaction of all zones import os import sys import re import signal signal.signal(signal.SIGPIPE, signal.SIG_DFL) usage = "usage: perf script report compaction-...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/compaction-times.py
# stackcollapse.py - format perf samples with one line per distinct call stack # SPDX-License-Identifier: GPL-2.0 # # This script's output has two space-separated fields. The first is a semicolon # separated stack including the program name (from the "comm" field) and the # function names from the call stack. The sec...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/stackcollapse.py
# SPDX-License-Identifier: GPL-2.0 # intel-pt-events.py: Print Intel PT Events including Power Events and PTWRITE # Copyright (c) 2017-2021, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as ...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/intel-pt-events.py
# Util.py - Python extension for perf script, miscellaneous utility code # # Copyright (C) 2010 by Tom Zanussi <[email protected]> # # This software may be distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundation. from __future__ import print_func...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
# Core.py - Python extension for perf script, core functions # # Copyright (C) 2010 by Tom Zanussi <[email protected]> # # This software may be distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundation. from collections import defaultdict def aut...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
# EventClass.py # SPDX-License-Identifier: GPL-2.0 # # This is a library defining some events types classes, which could # be used by other scripts to analyzing the perf samples. # # Currently there are just a few classes defined for examples, # PerfEvent is the base class for all perf event sample, PebsEvent # is a HW...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py
# SchedGui.py - Python extension for perf script, basic GUI code for # traces drawing and overview. # # Copyright (C) 2010 by Frederic Weisbecker <[email protected]> # # This software is distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundation. ...
nvtrust-main
infrastructure/linux/linux_source/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py
# SPDX-License-Identifier: GPL-2.0+ import os, csv, glob class CSVCollection(dict): delimiter=';' quotechar='"' source_column_name = 'Sources / Destinations' """ This class is a dictionary representation of the collection of sheets that exist in a given .ODS file. """ def __init__(self, pattern, skip...
nvtrust-main
infrastructure/linux/linux_source/drivers/comedi/drivers/ni_routing/tools/csv_collection.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0+ # This is simply to aide in creating the entries in the order of the value of # the device-global NI signal/terminal constants defined in comedi.h import comedi_h import os, sys, re from csv_collection import CSVCollection def c_to_o(filename, prefix='\t\t\t...
nvtrust-main
infrastructure/linux/linux_source/drivers/comedi/drivers/ni_routing/tools/convert_csv_to_c.py
# SPDX-License-Identifier: GPL-2.0+ """ This file helps to extract string names of NI signals as included in comedi.h between NI_NAMES_BASE and NI_NAMES_BASE+NI_NUM_NAMES. """ # This is simply to aide in creating the entries in the order of the value of # the device-global NI signal/terminal constants defined in comed...
nvtrust-main
infrastructure/linux/linux_source/drivers/comedi/drivers/ni_routing/tools/ni_names.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0+ from os import path import os, csv from itertools import chain from csv_collection import CSVCollection from ni_names import value_to_name import ni_values CSV_DIR = 'csv' def iter_src_values(D): return D.items() def iter_src(D): for dest in D: yie...
nvtrust-main
infrastructure/linux/linux_source/drivers/comedi/drivers/ni_routing/tools/convert_py_to_csv.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0+ from os import path import os, csv from csv_collection import CSVCollection from ni_names import value_to_name CSV_DIR = 'csv' def to_csv(): try: os.makedirs(CSV_DIR) except: pass csv_fname = path.join(CSV_DIR, 'blank_route_table.csv') fie...
nvtrust-main
infrastructure/linux/linux_source/drivers/comedi/drivers/ni_routing/tools/make_blank_csv.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # Usage: unwcheck.py FILE # # This script checks the unwind info of each function in file FILE # and verifies that the sum of the region-lengths matches the total # length of the function. # # Based on a shell/awk script originally written by Harish Patil, # w...
nvtrust-main
infrastructure/linux/linux_source/arch/ia64/scripts/unwcheck.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2018-2019 Netronome Systems, Inc. # Copyright (C) 2021 Isovalent, Inc. # In case user attempts to run with Python 2. from __future__ import print_function import argparse import re import sys, os class NoHelperFound(BaseException): ...
nvtrust-main
infrastructure/linux/linux_source/scripts/bpf_doc.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only """Find Kconfig symbols that are referenced but not defined.""" # (c) 2014-2017 Valentin Rothberg <[email protected]> # (c) 2014 Stefan Hengelein <[email protected]> # import argparse import difflib import os import re import signal impor...
nvtrust-main
infrastructure/linux/linux_source/scripts/checkkconfigsymbols.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # Copyright Thomas Gleixner <[email protected]> from argparse import ArgumentParser from ply import lex, yacc import locale import traceback import fnmatch import sys import git import re import os class ParserException(Exception): def __init__(self, tok,...
nvtrust-main
infrastructure/linux/linux_source/scripts/spdxcheck.py
#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0-only """ Copyright 2008 (c) Frederic Weisbecker <[email protected]> This script parses a trace provided by the function tracer in kernel/trace/trace_functions.c The resulted trace is processed into a tree to produce a more human view of the call stack by drawi...
nvtrust-main
infrastructure/linux/linux_source/scripts/tracing/draw_functrace.py
# # gdb helper commands and functions for Linux kernel debugging # # loader module # # Copyright (c) Siemens AG, 2012, 2013 # # Authors: # Jan Kiszka <[email protected]> # # This work is licensed under the terms of the GNU GPL version 2. # import os sys.path.insert(0, os.path.dirname(__file__) + "/scripts/gdb"...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/vmlinux-gdb.py
# # gdb helper commands and functions for Linux kernel debugging # # list tools # # Copyright (c) Thiebaud Weksteen, 2015 # # Authors: # Thiebaud Weksteen <[email protected]> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import utils list_head = utils.CachedType("st...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/lists.py
# # gdb helper commands and functions for Linux kernel debugging # # task & thread tools # # Copyright (c) Siemens AG, 2011-2013 # # Authors: # Jan Kiszka <[email protected]> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import utils task_type = utils.CachedType(...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/tasks.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright 2019 Google LLC. import gdb import zlib from linux import utils class LxConfigDump(gdb.Command): """Output kernel config to the filename specified as the command argument. Equivalent to 'zcat /proc/config.gz > config.txt' on a running target""" ...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/config.py
# # gdb helper commands and functions for Linux kernel debugging # # kernel log buffer dump # # Copyright (c) Siemens AG, 2011, 2012 # # Authors: # Jan Kiszka <[email protected]> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb import sys from linux import utils printk_info_typ...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/dmesg.py
# # gdb helper commands and functions for Linux kernel debugging # # Kernel proc information reader # # Copyright (c) 2016 Linaro Ltd # # Authors: # Kieran Bingham <[email protected]> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import constants from linux impor...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/proc.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright 2019 Google LLC. import gdb from linux import utils rb_root_type = utils.CachedType("struct rb_root") rb_node_type = utils.CachedType("struct rb_node") def rb_first(root): if root.type == rb_root_type.get_type(): node = root.address.cast(rb_root_type.get...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/rbtree.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright (c) NXP 2019 import gdb from linux.utils import CachedType from linux.utils import container_of from linux.lists import list_for_each_entry device_private_type = CachedType('struct device_private') device_type = CachedType('struct device') subsys_private_type = Cach...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/device.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright (c) NXP 2019 import gdb import sys from linux import utils, lists, constants clk_core_type = utils.CachedType("struct clk_core") def clk_core_for_each_child(hlist_head): return lists.hlist_for_each_entry(hlist_head, clk_core_type.get_type().pointer()...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/clk.py
# # gdb helper commands and functions for Linux kernel debugging # # per-cpu tools # # Copyright (c) Siemens AG, 2011-2013 # # Authors: # Jan Kiszka <[email protected]> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import tasks, utils task_type = utils.CachedType...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/cpus.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright 2019 Google LLC. import binascii import gdb from linux import constants from linux import cpus from linux import rbtree from linux import utils timerqueue_node_type = utils.CachedType("struct timerqueue_node").get_type() hrtimer_type = utils.CachedType("struct hrtimer...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/timerlist.py
# nothing to do for the initialization of this package
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/__init__.py
# # gdb helper commands and functions for Linux kernel debugging # # load kernel and module symbols # # Copyright (c) Siemens AG, 2011-2013 # # Authors: # Jan Kiszka <[email protected]> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb import os import re from linux import module...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/symbols.py
# # gdb helper commands and functions for Linux kernel debugging # # common utilities # # Copyright (c) Siemens AG, 2011-2013 # # Authors: # Jan Kiszka <[email protected]> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb class CachedType: def __init__(self, name): s...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/utils.py
# # gdb helper commands and functions for Linux kernel debugging # # module tools # # Copyright (c) Siemens AG, 2013 # # Authors: # Jan Kiszka <[email protected]> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import cpus, utils, lists module_type = utils.CachedTy...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/modules.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright (c) NXP 2019 import gdb import sys from linux.utils import CachedType from linux.lists import list_for_each_entry generic_pm_domain_type = CachedType('struct generic_pm_domain') pm_domain_data_type = CachedType('struct pm_domain_data') device_link_type = CachedType('s...
nvtrust-main
infrastructure/linux/linux_source/scripts/gdb/linux/genpd.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright (C) 2018 Masahiro Yamada <[email protected]> # """ Kconfig unit testing framework. This provides fixture functions commonly used from test files. """ import os import pytest import shutil import subprocess import tempfile CONF_PATH = os.path.abspath(os.pa...
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/conftest.py
# SPDX-License-Identifier: GPL-2.0 """ Do not affect user-assigned choice value by another choice. Handling of state flags for choices is complecated. In old days, the defconfig result of a choice could be affected by another choice if those choices interact by 'depends on', 'select', etc. Related Linux commit: fbe9...
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/inter_choice/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Create submenu for symbols that depend on the preceding one. If a symbols has dependency on the preceding symbol, the menu entry should become the submenu of the preceding one, and displayed with deeper indentation. """ def test(conf): assert conf.oldaskconfig() == 0 as...
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/auto_submenu/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Escape sequence tests. """ def test(conf): assert conf.oldaskconfig() == 0 assert conf.stderr_matches('expected_stderr')
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/preprocess/escape/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Variable and user-defined function tests. """ def test(conf): assert conf.oldaskconfig() == 0 assert conf.stderr_matches('expected_stderr')
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/preprocess/variable/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Detect circular variable expansion. If a recursively expanded variable references itself (eventually), it should fail with an error message. """ def test(conf): assert conf.oldaskconfig() != 0 assert conf.stderr_matches('expected_stderr')
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/preprocess/circular_expansion/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Built-in function tests. """ def test(conf): assert conf.oldaskconfig() == 0 assert conf.stdout_contains('expected_stdout') assert conf.stderr_matches('expected_stderr')
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/preprocess/builtin_func/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Basic choice tests. The handling of 'choice' is a bit complicated part in Kconfig. The behavior of 'y' choice is intuitive. If choice values are tristate, the choice can be 'm' where each value can be enabled independently. Also, if a choice is marked as 'optional', the whole c...
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/choice/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Detect recursive inclusion error. If recursive inclusion is detected, it should fail with error messages. """ def test(conf): assert conf.oldaskconfig() != 0 assert conf.stderr_contains('expected_stderr')
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/err_recursive_inc/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Detect recursive dependency error. Recursive dependency should be treated as an error. """ def test(conf): assert conf.oldaskconfig() == 1 assert conf.stderr_contains('expected_stderr')
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/err_recursive_dep/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Do not write choice values to .config if the dependency is unmet. "# CONFIG_... is not set" should not be written into the .config file for symbols with unmet dependency. This was not working correctly for choice values because choice needs a bit different symbol computation. T...
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Hide tristate choice values with mod dependency in y choice. If tristate choice values depend on symbols set to 'm', they should be hidden when the choice containing them is changed from 'm' to 'y' (i.e. exclusive choice). Related Linux commit: fa64e5f6a35efd5e77d639125d973077ca...
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Ask new choice values when they become visible. If new choice values are added with new dependency, and they become visible during user configuration, oldconfig should recognize them as (NEW), and ask the user for choice. Related Linux commit: 5d09598d488f081e3be23f885ed65cbbe2d...
nvtrust-main
infrastructure/linux/linux_source/scripts/kconfig/tests/new_choice_with_dep/__init__.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # Copyright (C) Google LLC, 2020 # # Author: Nathan Huckleberry <[email protected]> # """A helper routine run clang-tidy and the clang static-analyzer on compile_commands.json. """ import argparse import json import multiprocessing import os import subprocess ...
nvtrust-main
infrastructure/linux/linux_source/scripts/clang-tools/run-clang-tools.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # Copyright (C) Google LLC, 2018 # # Author: Tom Roeder <[email protected]> # """A tool for generating compile_commands.json in the Linux kernel.""" import argparse import json import logging import os import re import subprocess import sys _DEFAULT_OUTPUT...
nvtrust-main
infrastructure/linux/linux_source/scripts/clang-tools/gen_compile_commands.py
# # SPDX-FileCopyrightText: Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions o...
nvtrust-main
guest_tools/gpu_verifiers/local_gpu_verifier/src/verifier/config.py
# # SPDX-FileCopyrightText: Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of...
nvtrust-main
guest_tools/gpu_verifiers/local_gpu_verifier/src/verifier/cc_admin_utils.py
# # SPDX-FileCopyrightText: Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions o...
nvtrust-main
guest_tools/gpu_verifiers/local_gpu_verifier/src/verifier/__about__.py