/linux/tools/testing/kunit/ |
H A D | kunit_parser.py | 1 # SPDX-License-Identifier: GPL-2.0 3 # Parses KTAP test results from a kernel dmesg log and incrementally prints 4 # results with reader-friendly format. Stores and returns test results in a 5 # Test object. 22 class Test: class 24 A class to represent a test parsed from KTAP results. All KTAP 25 results within a test lo 39 __init__(self) global() argument 48 __str__(self) global() argument 53 __repr__(self) global() argument 57 add_error(self, printer: Printer, error_message: str) global() argument 62 ok_status(self) global() argument 87 __str__(self) global() argument 95 total(self) global() argument 102 add_subtest_counts(self, counts: TestCounts) global() argument 118 get_status(self) global() argument 135 add_status(self, status: TestStatus) global() argument 157 __init__(self, lines: Iterator[Tuple[int, str]]) global() argument 164 _get_next(self) global() argument 175 peek(self) global() argument 181 pop(self) global() argument 191 __bool__(self) global() argument 197 __iter__(self) global() argument 204 line_number(self) global() argument 254 check_version(version_num: int, accepted_versions: List[int], version_type: str, test: Test, printer: Printer) global() argument 273 parse_ktap_header(lines: LineStream, test: Test, printer: Printer) global() argument 305 parse_test_header(lines: LineStream, test: Test) global() argument 329 parse_test_plan(lines: LineStream, test: Test) global() argument 359 peek_test_name_match(lines: LineStream, test: Test) global() argument 384 parse_test_result(lines: LineStream, test: Test, expected_num: int, printer: Printer) global() argument 492 print_test_header(test: Test, printer: Printer) global() argument 522 format_test_result(test: Test, printer: Printer) global() argument 549 print_test_result(test: Test, printer: Printer) global() argument 562 print_test_footer(test: Test, printer: Printer) global() argument 577 print_test(test: Test, failed_only: bool, printer: Printer) global() argument 604 _summarize_failed_tests(test: Test) global() argument 607 failed_names(test: Test, parent_name: str) global() argument 636 print_summary_line(test: Test, printer: Printer) global() argument 670 bubble_up_test_results(test: Test) global() argument [all...] |
H A D | kunit_tool_test.py | 2 # SPDX-License-Identifier: GPL-2.0 44 def test_is_subset_of(self): argument 46 self.assertTrue(kconfig0.is_subset_of(kconfig0)) 49 kconfig1.add_entry('TEST', 'y') 50 self.assertTrue(kconfig1.is_subset_of(kconfig1)) 51 self.assertTrue(kconfig0.is_subset_of(kconfig1)) 52 self.assertFalse(kconfig1.is_subset_of(kconfig0)) 54 def test_read_from_file(self): argument 62 expected_kconfig.add_entry('TEST', 'y') 66 self.assertEqual(kconfig, expected_kconfig) [all …]
|
/linux/tools/testing/selftests/hid/tests/ |
H A D | base.py | 2 # SPDX-License-Identifier: GPL-2.0 3 # -*- coding: utf-8 -*- 22 logger = logging.getLogger("hidtools.test.base") 139 def __init__(self, name, application, rdesc_str=None, rdesc=None, input_info=None): argument 141 self.application_matches = application_matches 143 name = f"uhid test {self.__class__.__name__}" 144 if not name.startswith("uhid test "): 145 name = "uhid test " + self.name 146 self.name = name 169 # List of kernel modules to load before starting the test [all …]
|
/linux/tools/testing/selftests/tc-testing/ |
H A D | TdcPlugin.py | 4 def __init__(self): argument 6 print(' -- {}.__init__'.format(self.sub_class)) 8 def pre_suite(self, testcount, testlist): argument 9 '''run commands before test_runner goes into a test loop''' 10 self.testcount = testcount 11 self.testlist = testlist 12 if self.args.verbose > 1: 13 print(' -- {}.pre_suite'.format(self.sub_class)) 15 def post_suite(self, index): argument 16 '''run commands after test_runner completes the test loop [all …]
|
H A D | tdc.py | 2 # SPDX-License-Identifier: GPL-2.0 5 tdc.py - Linux tc (Traffic Control) unit test driver 31 def __init__(self, missing_pg): argument 32 self.missing_pg = missing_pg 35 def __init__(self, stage, output, message): argument 36 self.stage = stage 37 self.output = output 38 self.message = message 41 def __init__(self, argparser): argument 43 self.plugins = set() [all …]
|
/linux/tools/perf/tests/shell/lib/ |
H A D | perf_metric_validation.py | 1 # SPDX-License-Identifier: GPL-2.0 11 …def __init__(self, metric: list[str], wl: str, value: list[float], low: float, up=float('nan'), de… argument 12 self.metric: list = metric # multiple metrics in relationship type tests 13 self.workloads = [wl] # multiple workloads possible 14 self.collectedValue: list = value 15 self.valueLowBound = low 16 self.valueUpBound = up 17 self.description = description 19 def __repr__(self) -> str: argument 20 if len(self.metric) > 1: [all …]
|
/linux/tools/testing/selftests/tc-testing/plugin-lib/ |
H A D | valgrindPlugin.py | 2 run the command under test, under valgrind and collect memory leak info 3 as a separate test. 22 def __init__(self): argument 23 self.sub_class = 'valgrind/SubPlugin' 24 self.tap = '' 25 self._tsr = TestSuiteReport() 28 def pre_suite(self, testcount, testist): argument 29 '''run commands before test_runner goes into a test loop''' 30 self.testidlist = [tidx['id'] for tidx in testlist] 32 if self.args.verbose > 1: [all …]
|
H A D | nsPlugin.py | 21 def __init__(self): argument 22 self.sub_class = 'ns/SubPlugin' 25 def pre_suite(self, testcount, testlist): argument 28 def prepare_test(self, test): argument 29 if 'skip' in test and test['skip'] == 'yes': 32 if 'nsPlugin' not in test['plugins']: 36 self._nl_ns_create() 38 self._ipr2_ns_create() 45 self._proc_check() 47 ns = self.args.NAMES['NS'] [all …]
|
/linux/tools/testing/selftests/net/af_unix/ |
H A D | unix_connect.c | 1 // SPDX-License-Identifier: GPL-2.0 33 .sun_path = "test", in FIXTURE_VARIANT_ADD() 42 .sun_path = "\0test", in FIXTURE_VARIANT_ADD() 51 .sun_path = "test", in FIXTURE_VARIANT_ADD() 60 .sun_path = "\0test", in FIXTURE_VARIANT_ADD() 69 .sun_path = "test", in FIXTURE_VARIANT_ADD() 78 .sun_path = "\0test", in FIXTURE_VARIANT_ADD() 87 .sun_path = "test", in FIXTURE_VARIANT_ADD() 96 .sun_path = "\0test", in FIXTURE_VARIANT_ADD() 104 self->family = AF_UNIX; in FIXTURE_SETUP() [all …]
|
/linux/tools/testing/selftests/tc-testing/creating-plugins/ |
H A D | AddingPlugins.txt | 1 tdc - Adding plugins for tdc 3 Author: Brenda J. Butler - bjb@mojatatu.com 6 -------------- 9 There are some examples in plugin-lib. 11 The plugin can be used to add functionality to the test framework, 14 - adding commands to be run before and/or after the test suite 15 - adding commands to be run before and/or after the test cases 16 - adding commands to be run before and/or after the execute phase of the test cases 17 - ability to alter the command to be run in any phase: 18 pre (the pre-suite stage) [all …]
|
/linux/tools/testing/selftests/rtc/ |
H A D | rtctest.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * Real Time Clock Driver Test Program 40 self->fd = open(rtc_file, O_RDONLY); in FIXTURE_SETUP() 44 close(self->fd); in FIXTURE_TEARDOWN() 51 if (self->fd == -1 && errno == ENOENT) in TEST_F() 52 SKIP(return, "Skipping test since %s does not exist", rtc_file); in TEST_F() 53 ASSERT_NE(-1, self->fd); in TEST_F() 56 rc = ioctl(self->fd, RTC_RD_TIME, &rtc_tm); in TEST_F() 57 ASSERT_NE(-1, rc); in TEST_F() 67 .tm_sec = rtc_time->tm_sec, in rtc_time_to_timestamp() [all …]
|
/linux/drivers/firewire/ |
H A D | self-id-sequence-helper-test.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 3 // self-id-sequence-helper-test.c - An application of Kunit to test helpers of self ID sequence. 7 #include <kunit/test.h> 9 #include "phy-packet-definitions.h" 11 static void test_self_id_sequence_enumerator_valid(struct kunit *test) in test_self_id_sequence_enumerator_valid() argument 27 KUNIT_EXPECT_PTR_EQ(test, entry, &valid_sequences[0]); in test_self_id_sequence_enumerator_valid() 28 KUNIT_EXPECT_EQ(test, quadlet_count, 1); in test_self_id_sequence_enumerator_valid() 29 KUNIT_EXPECT_EQ(test, enumerator.quadlet_count, 6); in test_self_id_sequence_enumerator_valid() 32 KUNIT_EXPECT_PTR_EQ(test, entry, &valid_sequences[1]); in test_self_id_sequence_enumerator_valid() 33 KUNIT_EXPECT_EQ(test, quadlet_count, 2); in test_self_id_sequence_enumerator_valid() [all …]
|
/linux/tools/testing/selftests/drivers/net/lib/py/ |
H A D | env.py | 1 # SPDX-License-Identifier: GPL-2.0 18 test_dir: Path to the source directory of the test 21 def __init__(self, src_path): argument 22 self.src_path = Path(src_path) 23 self.test_dir = self.src_path.parent.resolve() 24 self.net_lib_dir = (Path(__file__).parent / "../../../../net/lib").resolve() 26 self 28 _load_env_file(self) global() argument 56 __init__(self, src_path, nsim_test=None, **kwargs) global() argument 75 __enter__(self) global() argument 80 __exit__(self, ex_type, ex_value, ex_tb) global() argument 86 __del__(self) global() argument 105 __init__(self, src_path, nsim_test=None) global() argument 166 create_local(self) global() argument 186 _check_env(self) global() argument 210 resolve_remote_ifc(self) global() argument 222 __enter__(self) global() argument 225 __exit__(self, ex_type, ex_value, ex_tb) global() argument 231 __del__(self) global() argument 245 require_ipver(self, ipver) global() argument 249 _require_cmd(self, comm, key, host=None) global() argument 257 require_cmd(self, comm, local=True, remote=False) global() argument 265 wait_hw_stats_settle(self) global() argument [all...] |
/linux/tools/testing/selftests/pci_endpoint/ |
H A D | pci_endpoint_test.c | 1 // SPDX-License-Identifier: GPL-2.0 27 ret = ioctl(self->fd, cmd, arg); \ 28 ret = ret < 0 ? -errno : ret; \ 31 static const char *test_device = "/dev/pci-endpoint-test.0"; 41 self->fd = open(test_device, O_RDWR); in FIXTURE_SETUP() 43 ASSERT_NE(-1, self->fd) TH_LOG("Can't open PCI Endpoint Test device"); in FIXTURE_SETUP() 48 close(self->fd); in FIXTURE_TEARDOWN() 67 pci_ep_ioctl(PCITEST_BAR, variant->barno); in TEST_F() 68 if (ret == -ENODATA) in TEST_F() 70 EXPECT_FALSE(ret) TH_LOG("Test failed for BAR%d", variant->barno); in TEST_F() [all …]
|
/linux/tools/testing/selftests/mm/ |
H A D | process_madv.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 30 self->page_size = (unsigned long)sysconf(_SC_PAGESIZE); in FIXTURE_SETUP() 31 self->pidfd = PIDFD_SELF; in FIXTURE_SETUP() 32 self->remote_pidfd = -1; in FIXTURE_SETUP() 33 self->child_pid = -1; in FIXTURE_SETUP() 39 if (self->child_pid > 0) { in FIXTURE_TEARDOWN_PARENT() 40 kill(self->child_pid, SIGKILL); in FIXTURE_TEARDOWN_PARENT() 41 waitpid(self->child_pid, NULL, 0); in FIXTURE_TEARDOWN_PARENT() 44 if (self->remote_pidfd >= 0) in FIXTURE_TEARDOWN_PARENT() 45 close(self->remote_pidfd); in FIXTURE_TEARDOWN_PARENT() [all …]
|
/linux/tools/testing/selftests/net/ |
H A D | bpf_offload.py | 7 # June 1991 as shown in the file COPYING in the top-level directory of this 53 log_level -= sub 116 stdout = stdout.decode("utf-8") 117 stderr = stderr.decode("utf-8") 122 if stderr[-1] == "\n": 123 stderr = stderr[:-1] 132 if len(stderr) > 0 and stderr[-1] == "\n": 133 stderr = stderr[:-1] 142 cmd("rm -f %s" % (f)) 174 return tool("bpftool", args, {"json":"- 292 __init__(self, path) global() argument 296 __len__(self) global() argument 299 __getitem__(self, key) global() argument 304 __setitem__(self, key, value) global() argument 314 _debugfs_dir_read(self, path) global() argument 350 __init__(self, port_count=1, ns=None) global() argument 354 _make_port(self, port_index, ifname) global() argument 357 dfs_num_bound_progs(self) global() argument 362 dfs_get_bound_progs(self, expected) global() argument 370 remove(self) global() argument 380 __init__(self, nsimdev, port_index, ifname, ns=None) global() argument 386 __getitem__(self, key) global() argument 389 remove(self) global() argument 392 dfs_refresh(self) global() argument 396 dfs_read(self, f) global() argument 401 wait_for_flush(self, bound=0, total=0, n_retry=20) global() argument 410 set_ns(self, ns) global() argument 415 set_mtu(self, mtu, fail=True) global() argument 419 set_xdp(self, bpf, mode, force=False, JSON=True, verbose=False, fail=True, include_stderr=False) global() argument 427 unset_xdp(self, mode, force=False, JSON=True, fail=True, include_stderr=False) global() argument 433 ip_link_show(self, xdp) global() argument 444 tc_add_ingress(self) global() argument 447 tc_del_ingress(self) global() argument 450 tc_flush_filters(self, bound=0, total=0) global() argument 455 tc_show_ingress(self, expected=None) global() argument 486 cls_filter_op(self, op, qdisc="ingress", prio=None, handle=None, chain=None, cls="", params="", fail=True, include_stderr=False) global() argument 502 cls_bpf_add_filter(self, bpf, op="add", prio=None, handle=None, chain=None, da=False, verbose=False, skip_sw=False, skip_hw=False, fail=True, include_stderr=False) global() argument 522 set_ethtool_tc_offloads(self, enable, fail=True) global() argument [all...] |
H A D | epoll_busy_poll.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 3 /* Basic per-epoll context busy poll test. 5 * Only tests the ioctls, but should be expanded to test two connected hosts in 55 EXPECT_NE(-1, ret) in FIXTURE_SETUP() 58 self->invalid_fd = ret; in FIXTURE_SETUP() 65 ret = close(self->invalid_fd); in FIXTURE_TEARDOWN() 73 ret = ioctl(self->invalid_fd, EPIOCGPARAMS, &self->params); in TEST_F() 75 EXPECT_EQ(-1, ret) in TEST_F() 81 memset(&self->params, 0, sizeof(struct epoll_params)); in TEST_F() 83 ret = ioctl(self->invalid_fd, EPIOCSPARAMS, &self->params); in TEST_F() [all …]
|
/linux/drivers/soc/fsl/qbman/ |
H A D | Kconfig | 1 # SPDX-License-Identifier: GPL-2.0-only 26 Compiles in additional checks, to sanity-check the drivers and 30 tristate "BMan self-tests" 32 Compile the BMan self-test code. These tests will 37 bool "High-level API self-test" 41 This requires the presence of cpu-affine portals, and performs 42 high-level API testing with them (whichever portal(s) are affine 43 to the cpu(s) the test executes on). 46 tristate "QMan self-tests" 48 Compile self-test code for QMan. [all …]
|
/linux/tools/testing/selftests/sgx/ |
H A D | main.c | 1 // SPDX-License-Identifier: GPL-2.0 2 /* Copyright(c) 2016-20 Intel Corporation. */ 30 * instructions (eg. ENCLU[EACCEPT] and ENCLU[EMODPE]) holds meta-data 49 Elf64_Phdr *phdrtab = addr + ehdr->e_phoff; in vdso_get_dyntab() 52 for (i = 0; i < ehdr->e_phnum; i++) in vdso_get_dyntab() 74 symtab->elf_symtab = vdso_get_dyn(addr, dyntab, DT_SYMTAB); in vdso_get_symtab() 75 if (!symtab->elf_symtab) in vdso_get_symtab() 78 symtab->elf_symstrtab = vdso_get_dyn(addr, dyntab, DT_STRTAB); in vdso_get_symtab() 79 if (!symtab->elf_symstrtab) in vdso_get_symtab() 82 symtab->elf_hashtab = vdso_get_dyn(addr, dyntab, DT_HASH); in vdso_get_symtab() [all …]
|
/linux/tools/testing/selftests/pidfd/ |
H A D | pidfd_file_handle_test.c | 1 // SPDX-License-Identifier: GPL-2.0 46 self->pid = getpid(); in FIXTURE_SETUP() 47 self->pidfd = sys_pidfd_open(self->pid, 0); in FIXTURE_SETUP() 48 ASSERT_GE(self->pidfd, 0); in FIXTURE_SETUP() 53 self->child_pid1 = create_child(&self->child_pidfd1, CLONE_NEWUSER); in FIXTURE_SETUP() 54 EXPECT_GE(self->child_pid1, 0); in FIXTURE_SETUP() 56 if (self->child_pid1 == 0) { in FIXTURE_SETUP() 75 self->child_pid2 = create_child(&self->child_pidfd2, CLONE_NEWUSER | CLONE_NEWPID); in FIXTURE_SETUP() 76 EXPECT_GE(self->child_pid2, 0); in FIXTURE_SETUP() 78 if (self->child_pid2 == 0) { in FIXTURE_SETUP() [all …]
|
/linux/tools/testing/selftests/ |
H A D | kselftest_harness.h | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 5 * kselftest_harness.h: simple C unit test helper. 7 * See documentation in Documentation/dev-tools/kselftest.rst 15 * .. code-block:: c 19 * TEST(standalone_test) { 37 * self->data = mytype_new(); 38 * ASSERT_NE(NULL, self->data); 41 * mytype_free(self->data); 44 * EXPECT_EQ(1, is_my_data_good(self->data)); 75 /* Utilities exposed to the test definitions */ [all …]
|
/linux/samples/rust/ |
H A D | rust_driver_platform.rs | 1 // SPDX-License-Identifier: GPL-2.0 5 //! ACPI match table test 7 //! This demonstrates how to test an ACPI-based Rust platform driver using QEMU 15 //! DefinitionBlock ("", "SSDT", 2, "TEST", "VIRTACPI", 0x00000001) 36 //! iasl -tc ssdt.dsl 44 //! qemu-system-x86_6 106 probe( pdev: &platform::Device<Core>, info: Option<&Self::IdInfo>, ) -> Result<Pin<KBox<Self>>> probe() argument 182 drop(&mut self) drop() argument [all...] |
H A D | rust_driver_pci.rs | 1 // SPDX-License-Identifier: GPL-2.0 3 //! Rust PCI driver sample (based on QEMU's `pci-testdev`). 5 //! To make this driver probe, QEMU must be run with `-device pci-testdev`. 12 const TEST: usize = 0x0; constant 25 const NO_EVENTFD: Self = Self(0); 47 fn testdev(index: &TestIndex, bar: &Bar0) -> Resul 68 probe(pdev: &pci::Device<Core>, info: &Self::IdInfo) -> Result<Pin<KBox<Self>>> probe() argument 98 unbind(pdev: &pci::Device<Core>, this: Pin<&Self>) unbind() argument 108 drop(self: Pin<&mut Self>) drop() argument [all...] |
/linux/tools/testing/selftests/kvm/s390/ |
H A D | ucontrol_test.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * Test code for the s390x kvm ucontrol interface 43 TEST_REQUIRE((data->effective & CAP_TO_MASK(CAP_SYS_ADMIN)) > 0); in require_ucontrol_admin() 48 /* Test program setting some registers and looping */ 65 /* Test program manipulating memory */ 82 /* Test program manipulating storage keys */ 131 self->kvm_fd = open_kvm_dev_path_or_exit(); in FIXTURE_SETUP() 132 self->vm_fd = ioctl(self->kvm_fd, KVM_CREATE_VM, KVM_VM_S390_UCONTROL); in FIXTURE_SETUP() 133 ASSERT_GE(self->vm_fd, 0); in FIXTURE_SETUP() 135 kvm_device_attr_get(self->vm_fd, KVM_S390_VM_CPU_MODEL, in FIXTURE_SETUP() [all …]
|
/linux/tools/testing/selftests/seccomp/ |
H A D | seccomp_bpf.c | 1 // SPDX-License-Identifier: GPL-2.0-only 5 * Test code for seccomp bpf. 60 /* Attempt to de-conflict with the selftests tree. */ 331 return -1; in __filecmp() 342 TH_LOG("kcmp() syscall missing (test is less accurate)");\ 348 TEST(kcmp) in TEST() function 358 TEST(mode_strict_support) in TEST() function 384 /* Note! This doesn't test no new privs behavior */ 385 TEST(no_new_privs_support) in TEST() function 396 TEST(mode_filter_support) in TEST() function [all …]
|