pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39080?usp=email )
Change subject: testenv: make copy= more intuitive ......................................................................
testenv: make copy= more intuitive
Currently copy= in testenv.cfg creates copies of files under the full source file name under the target directory: copy=dir/file.cfg creates dir/file.cfg (like "cp -a --parents"). This is not very intuitive, change it to create a "file.cfg" instead without subdirectory. With this change, it behaves the same as "cp -a".
Suggested-by: Pau Espin Pedrol pespin@sysmocom.de Change-Id: Id9e4ea066d0a0e72ccd83e4f6f887f382bf61e46 --- M _testenv/README.md M _testenv/testenv/testdir.py M ggsn_tests/open5gs/open5gs-smf.yaml M ggsn_tests/testenv_open5gs.cfg 4 files changed, 7 insertions(+), 18 deletions(-)
Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified
diff --git a/_testenv/README.md b/_testenv/README.md index bd102a8..2a08e7d 100644 --- a/_testenv/README.md +++ b/_testenv/README.md @@ -89,7 +89,7 @@
* `copy=`: optionally copy a space separated list of files or directories from the testsuite directory to the test directory, like `.cfg` and `.confmerge` - files. + files. Testenv runs `cp -a <SOURCES> <TEST DIR>` internally.
* `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 b18efd1..2f21d23 100644 --- a/_testenv/testenv/testdir.py +++ b/_testenv/testenv/testdir.py @@ -85,19 +85,8 @@ testenv.cmd.run(["install", "-Dm644", path, path_dest])
if "copy" in section_data: - 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]) + sources = section_data["copy"].split(" ") + testenv.cmd.run(["cp", "-a"] + sources + [section_dir], no_podman=True, cwd=testsuite_dir)
# Referenced in testsuite cfgs: *.default pattern = os.path.join(testsuite_dir, "*.default") diff --git a/ggsn_tests/open5gs/open5gs-smf.yaml b/ggsn_tests/open5gs/open5gs-smf.yaml index 0e26550..2532665 100644 --- a/ggsn_tests/open5gs/open5gs-smf.yaml +++ b/ggsn_tests/open5gs/open5gs-smf.yaml @@ -46,7 +46,7 @@ mtu: 1400 ctf: enabled: auto - freeDiameter: open5gs/freediameter.conf + freeDiameter: freediameter.conf
parameter:
diff --git a/ggsn_tests/testenv_open5gs.cfg b/ggsn_tests/testenv_open5gs.cfg index 2d107a8..6d951f2 100644 --- a/ggsn_tests/testenv_open5gs.cfg +++ b/ggsn_tests/testenv_open5gs.cfg @@ -3,14 +3,14 @@ config=GGSN_Tests.cfg
[smf] -program=open5gs-smfd -c open5gs/open5gs-smf.yaml +program=open5gs-smfd -c open5gs-smf.yaml make=open5gs package=open5gs-smf copy=open5gs/open5gs-smf.yaml open5gs/freediameter.conf
[upf] -program=open5gs-upfd -c open5gs/open5gs-upf.yaml +program=open5gs-upfd -c open5gs-upf.yaml make=open5gs package=open5gs-upf copy=open5gs/open5gs-upf.yaml open5gs/testenv.sh -clean=open5gs/testenv.sh +clean=./testenv.sh