diff options
Diffstat (limited to 'meta/lib/oeqa/utils/nfs.py')
-rw-r--r-- | meta/lib/oeqa/utils/nfs.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/meta/lib/oeqa/utils/nfs.py b/meta/lib/oeqa/utils/nfs.py index a37686c914..903469bfee 100644 --- a/meta/lib/oeqa/utils/nfs.py +++ b/meta/lib/oeqa/utils/nfs.py | |||
@@ -1,4 +1,8 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
1 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
5 | # | ||
2 | import os | 6 | import os |
3 | import sys | 7 | import sys |
4 | import tempfile | 8 | import tempfile |
@@ -8,7 +12,7 @@ from oeqa.utils.commands import bitbake, get_bb_var, Command | |||
8 | from oeqa.utils.network import get_free_port | 12 | from oeqa.utils.network import get_free_port |
9 | 13 | ||
10 | @contextlib.contextmanager | 14 | @contextlib.contextmanager |
11 | def unfs_server(directory, logger = None): | 15 | def unfs_server(directory, logger = None, udp = True): |
12 | unfs_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "unfs3-native") | 16 | unfs_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "unfs3-native") |
13 | if not os.path.exists(os.path.join(unfs_sysroot, "usr", "bin", "unfsd")): | 17 | if not os.path.exists(os.path.join(unfs_sysroot, "usr", "bin", "unfsd")): |
14 | # build native tool | 18 | # build native tool |
@@ -22,11 +26,11 @@ def unfs_server(directory, logger = None): | |||
22 | exports.write("{0} (rw,no_root_squash,no_all_squash,insecure)\n".format(directory).encode()) | 26 | exports.write("{0} (rw,no_root_squash,no_all_squash,insecure)\n".format(directory).encode()) |
23 | 27 | ||
24 | # find some ports for the server | 28 | # find some ports for the server |
25 | nfsport, mountport = get_free_port(udp = True), get_free_port(udp = True) | 29 | nfsport, mountport = get_free_port(udp), get_free_port(udp) |
26 | 30 | ||
27 | nenv = dict(os.environ) | 31 | nenv = dict(os.environ) |
28 | nenv['PATH'] = "{0}/sbin:{0}/usr/sbin:{0}/usr/bin:".format(unfs_sysroot) + nenv.get('PATH', '') | 32 | nenv['PATH'] = "{0}/sbin:{0}/usr/sbin:{0}/usr/bin:".format(unfs_sysroot) + nenv.get('PATH', '') |
29 | cmd = Command(["unfsd", "-d", "-p", "-N", "-e", exports.name, "-n", str(nfsport), "-m", str(mountport)], | 33 | cmd = Command(["unfsd", "-d", "-p", "-e", exports.name, "-n", str(nfsport), "-m", str(mountport)], |
30 | bg = True, env = nenv, output_log = logger) | 34 | bg = True, env = nenv, output_log = logger) |
31 | cmd.run() | 35 | cmd.run() |
32 | yield nfsport, mountport | 36 | yield nfsport, mountport |