osmith submitted this change.
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
testenv: copy=: support copying directories too
In preparation for adding the inital testenv.cfgs for ggsn, allow
copying full directories with copy= too. This will make the ggsn
testenv.cfg files easier to maintain.
Change-Id: I8e680fbd93516030614c015d7c3b5bdb153ec487
---
M _testenv/README.md
M _testenv/testenv/testdir.py
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/_testenv/README.md b/_testenv/README.md
index 09b12e8..7db3e24 100644
--- a/_testenv/README.md
+++ b/_testenv/README.md
@@ -65,8 +65,9 @@
* `program=`: executable for starting a test component, may contain arguments.
See below for `PATH` and `PWD`.
-* `copy=`: file(s) to copy from the testsuite directory to the test directory,
- like `.cfg` and `.confmerge` files. Multiple values are separated by spaces.
+* `copy=`: optionally copy a space separated list of files or directories from
+ the testsuite directory to the test directory, like `.cfg` and `.confmerge`
+ files.
* `make=`: osmo-dev make target for building from source, if running without
`--binary-repo`. This is usually the name of the git repository, but could
diff --git a/_testenv/testenv/testdir.py b/_testenv/testenv/testdir.py
index 55f04d2..ee698fff 100644
--- a/_testenv/testenv/testdir.py
+++ b/_testenv/testenv/testdir.py
@@ -80,11 +80,19 @@
testenv.cmd.run(["install", "-Dm644", path, path_dest])
if "copy" in section_data:
- for file in section_data["copy"].split(" "):
- path = os.path.join(testsuite_dir, file)
- path_dest = os.path.join(section_dir, file)
- mode = 755 if os.access(path, os.X_OK) else 644
- testenv.cmd.run(["install", f"-Dm{mode}", path, path_dest])
+ for copy_entry in section_data["copy"].split(" "):
+ path = os.path.join(testsuite_dir, copy_entry)
+ if os.path.isdir(path):
+ pattern = os.path.join(path, "**")
+ paths = glob.glob(pattern, recursive=True)
+ else:
+ paths = [path]
+ for path in paths:
+ if os.path.isdir(path):
+ continue
+ path_dest = os.path.join(section_dir, os.path.relpath(path, testsuite_dir))
+ mode = 755 if os.access(path, os.X_OK) else 644
+ testenv.cmd.run(["install", f"-Dm{mode}", path, path_dest])
if "clean" in section_data:
logging.info(f"Running {section} clean script (reason: prepare)")
To view, visit change 38262. To unsubscribe, or for help writing mail filters, visit settings.