summaryrefslogtreecommitdiff
path: root/tests/atf_python/sys
AgeCommit message (Collapse)Author
2025-12-22atf_python: support setting interface mtuKristof Provost
Teach the vnet support code to set interface MTU. Some tests make use of this, so have the framework handle it. Adapt a few pf tests to use this. Reviewed by: melifaro Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D54333
2025-10-03tests/ipfw: Update regression tests to match new 32-bit size rule numbersOlivier Cochard
Commit 4a77657cbc01 increased the size of several opcodes to ipfw_insn_u32. Approved by: ae Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D52876
2025-09-30atf_python: allow test scripts to pass jail optionsKristof Provost
Test scripts based on atf_python can now pass jail command options via the 'opts' key in the 'vnetX' key of TOPOLOGY. Reviewed by: melifaro MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D52761
2025-09-04tests: disable transmit checksum offloading for epair interfacesMichael Tuexen
When transmit checksum offloading is enabled, if_epair does not compute checksums, it just marks packets that this computation still needs to be done. However, some test cases verify the checksum. Therefore disable this for IPv4 and IPv6. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D52379
2025-07-09tests: Get the MAC from the epairs.Ronald Klop
This removes knowledge of the implementation of if_epair. Makes it easier to modify if_epair in future commits. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D51205
2025-05-08aft_python: fix incorrect ndp useKristof Provost
If we want to clear a flag we have to include '--' before the flag we clear, otherwise ndp will misparse our command (the getopt call will interpret it as another option, and reject it). This caused spurious errors at the end of every atf_python test case such as: ============================== 1 passed in 7.26s =============================== usage: ndp [-nt] hostname ndp [-nt] -a | -c | -p | -r | -H | -P | -R ndp [-nt] -A wait ndp [-nt] -d hostname ndp [-nt] -f filename ndp [-nt] -i interface [flags...] ndp [-nt] -I [interface|delete] ndp [-nt] -s nodename etheraddr [temp] [proxy] Sponsored by: Rubicon Communications, LLC ("Netgate")
2024-07-23vnet tests: verify that we can load if_epair and if_bridgeKristof Provost
We're going to start running many of the vnet tests in nested jails (so they can run in parallel). That means the tests won't be able to load kernel modules, which we commonly do for if_epair and if_bridge. Just assume that all vnet tests need this, because so many of them do that we don't want to manually annotate all of them. This is essentially a no-op on non-nested tests. Do the same for the python test framework. While here also have pflog_init actually call pft_init. While having pflog loaded implies we have pf too pft_init also checks for vimage support, and now for if_epair. Reviewed by: markj MFC after: 1 month Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46039
2024-04-19tests: move atf_python/sys/ into the tests packageLexi Winter
Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1174
2023-10-13atf_python: Standardize custom sectionsJose Luis Duran
To be replaced with pytest's section/add_report_section. Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/865
2023-10-13atf_python: Set verbosity for commands in a vnetJose Luis Duran
Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/865
2023-10-13atf_python: vnet: Use absolute paths within helpersJose Luis Duran
Usually tests are run in sterile environments; however, there is a slight chance that the PATH overrides the utilities used for testing. Pedantically use absolute paths, even inside VNETs, to avoid ambiguity. Chiefly, jexec -> /usr/sbin/jexec, and ifconfig -> /sbin/ifconfig. Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/865
2023-10-13atf_python: Actually implement verbosity for run_cmdJose Luis Duran
Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/865
2023-10-13atf_python: Do not attempt to automatically delete lo0Jose Luis Duran
Else `ifconfig lo0 destroy` will throw an: ifconfig: SIOCIFDESTROY: Invalid argument Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/865
2023-08-04pf: test rules evaluation in the face of multiple IPv6 fragment headersKristof Provost
Send an ICMPv6 echo request packet with multiple IPv6 fragment headers. Set rules to pass all packets, except for ICMPv6 echo requests. pf ought to drop the echo request, but doesn't because it reassembles the packet, and then doesn't handle the second fragment header. In other words: it fails to detect the ICMPv6 echo header. Reported by: Enrico Bassetti bassetti@di.uniroma1.it (NetSecurityLab @ Sapienza University of Rome) MFC after: instant Sponsored by: Rubicon Communications, LLC ("Netgate")
2023-06-15ipfw: add eaction testsAlexander V. Chernikov
MFC after: 2 weeks
2023-06-13ipfw(8): add ioctl/instruction generation testsAlexander V. Chernikov
Differential Revision: https://reviews.freebsd.org/D40488 MFC after: 2 weeks
2023-06-01netlink: add support for decoding genl ops/groups in pytestAlexander V. Chernikov
MFC after: 2 weeks
2023-05-16netlink: add support for adding/deleting interface addressesAlexander V. Chernikov
Differential Revision: https://reviews.freebsd.org/D40103 MFC after: 2 weeks
2023-05-16testing: improve vnet support in pytestAlexander V. Chernikov
* Allow vnet object to be directly referenced (self.vnet1 vs self.vnet_map["vnet1"]) * Allow iface object to be directly reference (vnet.bridge vs vnet.iface_alias_map["bridge"]) * Allow arbitrary interface alias names insted of ifX * Add wait_objects_any() method for waiting object from multiple vnets * Add wait() method for indefinite sleep on vnet handlers MFC after: 2 weeks
2023-05-15testing: rename IfattrType to IfaAttrType for consistencyAlexander V. Chernikov
All other attribute classes are named as 'type'AttrType and 'type' int this case is ifa (interface address). MFC after: 2 weeks
2023-05-15testing: add support for handling Netlink carp messagesAlexander V. Chernikov
MFC after: 2 weeks
2023-05-15testing: add support for using custom interfaces in pytest framework.Alexander V. Chernikov
MFC after: 2 weeks
2023-04-18tests: fix netlink type parsing.Alexander V. Chernikov
Netlink attribute type field is 2 bytes, not one. MFC after: 2 weeks
2023-04-14Testing: add framework for the kernel unit tests.Alexander V. Chernikov
This changes intends to reduce the bar to the kernel unit-testing by introducing a new kernel-testing framework ("ktest") based on Netlink, loadable test modules and python test suite integration. This framework provides the following features: * Integration to the FreeBSD test suite * Automatic test discovery * Automatic test module loading * Minimal boiler-plate code in both kernel and userland * Passing any metadata to the test * Convenient environment pre-setup using python testing framework * Streaming messages from the kernel to the userland * Running tests in the dedicated taskqueues * Skipping or parametrizing tests Differential Revision: https://reviews.freebsd.org/D39385 MFC after: 2 weeks
2023-04-02tests: fix utils import in netlink testsAlexander V. Chernikov
MFC after: 2 weeks
2023-04-01tests: add support for parsing generic netlink families.Alexander V. Chernikov
MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D39370
2023-04-01tests: split netlink.py into multiple files to impove maintainability.Alexander V. Chernikov
This diff does not contain any functional changes. Its sole purpose is splitting netlink.py into smaller chunks. The new code simplifies the upcoming generic netlink support introduction. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D39365
2023-03-13tests: fix python parsing of netlink nested attributesAlexander V. Chernikov
MFC after: 2 weeks
2023-03-07tests: add more netlink tests for neighbors/routesAlexander V. Chernikov
Differential Revision: https://reviews.freebsd.org/D38912 MFC after: 2 weeks
2023-02-20tests: add netlink large dump buffer checkAlexander V. Chernikov
Differential Revision: https://reviews.freebsd.org/D38665 MFC after: 2 weeks
2023-02-17netlink: improve attribute decoding in python testsAlexander V. Chernikov
MFC after: 2 weeks
2023-02-09netlink: return optional metadata with the operation result.Alexander V. Chernikov
Some operations like interface creation may need to return metadata - in this case, interface name - back to the caller if the operation is successful. This change implements attaching an `NLMSGERR_ATTR_COOKIE` nla to the operation reply message via `nlmsg_report_cookie()`. Additionally, on successful interface creation, interface index and interface name are returned in the `IFLA_NEW_IFINDEX` and `IFLA_IFNAME TLVs, encapsulated in the `NLMSGERR_ATTR_COOKIE`. Reviewed By: pauamma Differential Revision: https://reviews.freebsd.org/D38283 MFC after: 1 week
2023-02-09testing: handling non-root users with VNETs in pytest-based tests.Alexander V. Chernikov
Currently isolation and resource requirements are handled directly by the kyua runner, based on the requirements specified by the test. It works well for simple tests, but may cause discrepancy with tests doing complex pre-setups. For example, all tests that perform VNET setups require root access to properly function. This change adds additional handling of the "require_user" property within the python testing framework. Specifically, it requests root access if the test class signals its root requirements and drops privileges to the desired user after performing the pre-setup. Differential Revision: https://reviews.freebsd.org/D37923 MFC after: 2 weeks
2023-01-25pytest: delete interfaces from inside the jail.Alexander V. Chernikov
This change follows the approach used in 80fc25025ffc, to minimise the impact of the delayed interface migration. MFC after: 2 weeks
2023-01-11tests: Add an IPv4 loopback address of 127.0.0.1/8 to the lo0Jose Luis Duran
interface by default when creating VNETSs using pytest. Reviewed By: asomers Differential Revision: https://reviews.freebsd.org/D38021
2023-01-08netlink: improve RTM_GETADDR handling.Alexander V. Chernikov
* Allow filtering by ifa_family & ifa_index. * Add common RTM_<NEW|DEL|GET>ADDR parser * Add tests verifying RTM_GETADDR filtering behaviour & output * Factor out common netlink socket test methods into NetlinkTestTemplate * Add NLMSG_DONE message handler Reviewed By: pauamma Differential Revision: https://reviews.freebsd.org/D37970
2022-12-29testing: improve python vnet wrapper.Alexander V. Chernikov
* Derive jail name from class name and method name, instead of just method name. This change reduces the chances of different tests clashing. Old: 'jail_test_one'. New: 'pytest:TestExampleSimplest:test_one' * Simplify vnetX_handler() method signature by skipping obj_map (unused) and pipe. The latter can be accessed as the vnet property. * Add `send_object()` method as a pair to the `wait_object` inside the VnetTestTemplate class. * Add `test_id` property to the BaseTest method. Previously it was provided only for the VnetTestTemplate class. This change makes the identifier easily accessible for all users. MFC after: 2 weeks
2022-12-16netlink: connect netlink tests to the buildAlexander V. Chernikov
Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D37708
2022-12-14netlink: improve interface handlingAlexander V. Chernikov
* Separate interface creation from interface modification code * Support setting some interface attributes (ifdescr, mtu, up/down, promisc) * Improve interaction with the cloners requiring to parse/write custom interface attributes * Add bitmask-based way of checking if the attribute is present in the message * Don't use multipart RTM_GETLINK replies when searching for the specific interface names * Use ENODEV instead of ENOENT in case of failed RTM_GETLINK search * Add python netlink test helpers * Add some netlink interface tests Differential Revision: https://reviews.freebsd.org/D37668
2022-08-07tests: add routing tests for switching between same prefixesAlexander V. Chernikov
Differential Revision: https://reviews.freebsd.org/D36055 MFC after: 2 weeks
2022-07-07testing: add ability to specify multi-vnet topologies in the pytest framework.Alexander V. Chernikov
Notable amount of tests related to the packet IO require two VNET jails for proper testing and avoiding side effects for the host system. Additionally, it is often required to run actions in the jails seme-sequentially - waiting for the listener initialisation can be an example of such dependency. This change extends pytest vnet framework to allow defining multi-vnet multi-epair topologies in declarative style, without any need to bother about jail or repair names. All jail creation/teardown, interface creation/teardown and address assignments are handled automatically. Example: TOPOLOGY = { "vnet1": {"ifaces": ["if1", "if2", "if3"]}, "vnet2": {"ifaces": ["if1", "if2", "if3"]}, "if1": {"prefixes6": [("2001:db8:a::1/64", "2001:db8:a::2/64")]}, "if2": {"prefixes6": [("2001:db8:b::1/64", "2001:db8:b::2/64")]}, "if3": {"prefixes6": [("2001:db8:c::1/64", "2001:db8:c::2/64")]}, } def vnet2_handler(self, vnet, obj_map, pipe): ss = VerboseSocketServer("::", self.DEFAULT_PORT) pipe.send("READY") def test_output6_base(self): self.wait_object(second_vnet.pipe) The definitions above will create 2 vnets ("jail_test_output6_base", "jail_test_output6_base_2"), 3 epairs, attached to both first and second jails, set up the IP addresses for each epair, spawn another process for vnet2_handler and pass control to vnet2_handler and test_output6_base. Both processes can pass objects between each other using pre-created pipes. Differential Revision: https://reviews.freebsd.org/D35708
2022-06-25testing: Add basic atf support to pytest.Alexander V. Chernikov
Implementation consists of the pytest plugin implementing ATF format and a simple C++ wrapper, which reorders the provided arguments from ATF format to the format understandable by pytest. Each test has this wrapper specified after the shebang. When kyua executes the test, wrapper calls pytest, which loads atf plugin, does the work and returns the result. Additionally, a separate python "package", `/usr/tests/atf_python` has been added to collect code that may be useful across different tests. Current limitations: * Opaque metadata passing via X-Name properties. Require some fixtures to write * `-s srcdir` parameter passed by the runner is ignored. * No `atf-c-api(3)` or similar - relying on pytest framework & existing python libraries * No support for `atf_tc_<get|has>_config_var()` & `atf_tc_set_md_var()`. Can be probably implemented with env variables & autoload fixtures Differential Revision: https://reviews.freebsd.org/D31084 Reviewed by: kp, ngie