mirror of
https://git.yoctoproject.org/poky
synced 2026-02-07 09:16:36 +01:00
Add a nfs module into oeqa utils. This module provides unfs_server which allows a test case to build unfs3-native and setup the unfs server on a target directory of the host. This directory is then shared and can be mounted by the host or a target device attached to the host (e.g. qemu via tap or slirp). The nfs server is setup over UDP and automatically assigns user privileged ports. The function provides the UDP ports for the server as part of a returned python contextmanager which handles cleanup of the server process on completion or exception. Also add a 'udp' arg to get_free_port to get a free UDP port. Note: unfs3 still requires the host to have rpcbind or portmap running. (From OE-Core rev: c754fd85be85ad0a381b642365eca17cea8eb627) Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13 lines
255 B
Python
13 lines
255 B
Python
#
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
|
|
import socket
|
|
|
|
def get_free_port(udp = False):
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM if not udp else socket.SOCK_DGRAM)
|
|
s.bind(('', 0))
|
|
addr = s.getsockname()
|
|
s.close()
|
|
return addr[1]
|