osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38260?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: testenv/README: document current working dir
......................................................................
testenv/README: document current working dir
Change-Id: I218507bcbec94a36976fbf57d12ffd083fd2acfb
---
M _testenv/README.md
1 file changed, 23 insertions(+), 5 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/_testenv/README.md b/_testenv/README.md
index 82903a1..983692c 100644
--- a/_testenv/README.md
+++ b/_testenv/README.md
@@ -55,14 +55,14 @@
* `clean=`: optional script to run before running the testsuite and on exit.
This can be used to clean up network devices for example, or to fix name
collisions when running a test with multiple configs
- (`rename_junit_xml_classname.sh`). See below for `PATH`. A
+ (`rename_junit_xml_classname.sh`). See below for `PATH` and `PWD`. A
`TESTENV_CLEAN_REASON` env var is set to `prepare`, `crashed` or `finished`
depending on when the script runs.
#### Component section
* `program=`: executable for starting a test component, may contain arguments.
- See below for `PATH`.
+ 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.
@@ -78,12 +78,12 @@
* `prepare=`: optional script to run before staring the program (after files
are copied to the test directory). Typically this is used to create configs
- with `osmo-config-merge`. See below for `PATH`.
+ with `osmo-config-merge`. See below for `PATH` and `PWD`.
* `setup=`: optional script to run after the program was started. Execution of
the next program / the testsuite will wait until the setup script has quit.
This can be used to wait until the program is ready or to fill a test
- database for example. See below for `PATH`.
+ database for example. See below for `PATH` and `PWD`.
* `clean=`: same as in the Testsuite section above, but runs at a slightly
different time: before/after/on crash of the program instead of the
@@ -96,7 +96,9 @@
* `vty_host=`: optionally set the VTY host for the SUT component to be used
when obtaining a talloc report. If this is not set, `127.0.0.1` is used.
-### PATH
+### Executables
+
+#### $PATH
Executables mentioned in `program=`, `prepare=`, `setup=` and `clean=` run
with a `PATH` environment variable containing:
@@ -105,6 +107,22 @@
* The directory for binaries built from source
* The directory `_testenv/data/scripts` (which has e.g. `respawn.sh`)
+#### $PWD (current working dir)
+
+The executables run inside a directory with the component name, inside the log
+dir. For example:
+
+```
+/tmp/logs
+├── ggsn # Executables from [ggsn] section run in this dir
+│ ├── ggsn.log
+│ └── osmo-ggsn.cfg
+└── testsuite # Executables from [testsuite] run in this dir
+ ├── Common.cfg
+ ├── GGSN_Tests.cfg
+ └── GGSN_Tests.default
+```
+
### Latest configs
Sometimes we need to run test components and/or testsuites with different
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38260?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I218507bcbec94a36976fbf57d12ffd083fd2acfb
Gerrit-Change-Number: 38260
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38259?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: testenv/README: deduplicate clean= description
......................................................................
testenv/README: deduplicate clean= description
Change-Id: I12dc9adb508a409a6156f9682c9db5684f551b06
---
M _testenv/README.md
1 file changed, 3 insertions(+), 5 deletions(-)
Approvals:
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/_testenv/README.md b/_testenv/README.md
index 2c70a0a..82903a1 100644
--- a/_testenv/README.md
+++ b/_testenv/README.md
@@ -85,11 +85,9 @@
This can be used to wait until the program is ready or to fill a test
database for example. See below for `PATH`.
-* `clean=`: optional script to run before `prepare=` and on exit. This can be
- used to clean up network devices for example, or to fix name collisions when
- running a test with multiple configs (`rename_junit_xml_classname.sh`). See
- below for `PATH`. A `TESTENV_CLEAN_REASON` env var is set to `prepare`,
- `crashed` or `finished` depending on when the script runs.
+* `clean=`: same as in the Testsuite section above, but runs at a slightly
+ different time: before/after/on crash of the program instead of the
+ testsuite.
* `vty_port=`: optionally set the VTY port for the SUT component to obtain a
talloc report after each test case has been executed. If this is not set, no
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38259?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I12dc9adb508a409a6156f9682c9db5684f551b06
Gerrit-Change-Number: 38259
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38261?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: testenv: clean_run_scripts: skip if podman stopped
......................................................................
testenv: clean_run_scripts: skip if podman stopped
Do not attempt to run the clean_run_scripts, if podman is being used and
the container has already been shutdown.
Change-Id: I3cc05aabd97b73b65c3089e8806f7a9b32e5975c
---
M _testenv/README.md
M _testenv/testenv/testdir.py
2 files changed, 12 insertions(+), 5 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/_testenv/README.md b/_testenv/README.md
index 983692c..09b12e8 100644
--- a/_testenv/README.md
+++ b/_testenv/README.md
@@ -57,7 +57,8 @@
collisions when running a test with multiple configs
(`rename_junit_xml_classname.sh`). See below for `PATH` and `PWD`. A
`TESTENV_CLEAN_REASON` env var is set to `prepare`, `crashed` or `finished`
- depending on when the script runs.
+ depending on when the script runs. The script will not run on crash if podman
+ is used, as the container gets shutdown beforehand.
#### Component section
diff --git a/_testenv/testenv/testdir.py b/_testenv/testenv/testdir.py
index 242d17d..55f04d2 100644
--- a/_testenv/testenv/testdir.py
+++ b/_testenv/testenv/testdir.py
@@ -170,8 +170,14 @@
def clean_run_scripts(reason="crashed"):
global clean_scripts
- for section, script in clean_scripts.items():
- logging.info(f"Running {section} clean script (reason: {reason})")
- env = {"TESTENV_CLEAN_REASON": reason}
- testenv.cmd.run(script, cwd=os.path.join(testdir, section), env=env)
+ if not clean_scripts:
+ return
+ elif testenv.args.podman and not testenv.podman.is_running():
+ logging.debug("Skipping clean up scripts, podman container has already stopped")
+ else:
+ for section, script in clean_scripts.items():
+ logging.info(f"Running {section} clean script (reason: {reason})")
+ env = {"TESTENV_CLEAN_REASON": reason}
+ testenv.cmd.run(script, cwd=os.path.join(testdir, section), env=env)
+
clean_scripts = {}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38261?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I3cc05aabd97b73b65c3089e8806f7a9b32e5975c
Gerrit-Change-Number: 38261
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38262?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: testenv: copy=: support copying directories too
......................................................................
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(-)
Approvals:
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
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 https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38262?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8e680fbd93516030614c015d7c3b5bdb153ec487
Gerrit-Change-Number: 38262
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38257?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: testenv/README: consistency fix
......................................................................
testenv/README: consistency fix
Add = after the vty_* keys too, like the others.
Change-Id: Ic9828b67f5a81498d0e951dd71b80b36cdd36173
---
M _testenv/README.md
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/_testenv/README.md b/_testenv/README.md
index 8562063..2c70a0a 100644
--- a/_testenv/README.md
+++ b/_testenv/README.md
@@ -91,12 +91,12 @@
below for `PATH`. A `TESTENV_CLEAN_REASON` env var is set to `prepare`,
`crashed` or `finished` depending on when the script runs.
-* `vty_port`: optionally set the VTY port for the SUT component to obtain a
+* `vty_port=`: optionally set the VTY port for the SUT component to obtain a
talloc report after each test case has been executed. If this is not set, no
talloc reports will be obtained.
-* `vty_host`: optionally set the VTY host for the SUT component to be used when
- obtaining a talloc report. If this is not set, `127.0.0.1` is used.
+* `vty_host=`: optionally set the VTY host for the SUT component to be used
+ when obtaining a talloc report. If this is not set, `127.0.0.1` is used.
### PATH
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38257?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ic9828b67f5a81498d0e951dd71b80b36cdd36173
Gerrit-Change-Number: 38257
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38256?usp=email )
Change subject: testenv: testsuite: use rsync with --archive
......................................................................
testenv: testsuite: use rsync with --archive
When running in podman, the source files from the testsuite get copied
to a temporary directory to build the testsuites out-of-tree (avoiding
conflicts with possibly incompatible binary objects that may exist from
previously building the testsuites on the host).
This also copies additional scripts for preparation / clean up that may
be used in testenv.cfg. Use the --archive flag with rsync to ensure
that the executability is the same. I could have also used
--executability, but --archive contains two other existing flags and
more flags which may help us from running into unexpected situations
such as this one.
Without this patch, there was a bug when:
* first creating a shell script but not making it executable
* running testenv with podman (where rsync runs and creates the file
initially without executable permissions)
* making the script executable
* running testenv with podman again, rsync will not adjust the
permissions for the copy of the file
* user wonders why there is a "sh: 1: script.sh: Permission denied"
error
Change-Id: Ia9737bd8ba22a555615862bf5e14dbdf0dea19b4
---
M _testenv/testenv/testsuite.py
1 file changed, 1 insertion(+), 2 deletions(-)
Approvals:
osmith: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py
index 7a42216..7fc4344 100644
--- a/_testenv/testenv/testsuite.py
+++ b/_testenv/testenv/testsuite.py
@@ -52,8 +52,7 @@
testenv.cmd.run(
[
"rsync",
- "--links",
- "--recursive",
+ "--archive",
f"--files-from={copy_list}",
f"{ttcn3_hacks_dir_src}/",
f"{ttcn3_hacks_dir}/",
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38256?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia9737bd8ba22a555615862bf5e14dbdf0dea19b4
Gerrit-Change-Number: 38256
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38258?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: testenv: podman.exec_cmd: better error if stopped
......................................................................
testenv: podman.exec_cmd: better error if stopped
Testenv may try to run a comand in podman after the container was
stopped, if there is a bug in the shutdown logic. Give a meaningful
error in that case, instead of failing later on with a cryptic error in
subprocess.run() because None was passed inside cmd (for the container
name) instead of a string.
Change-Id: I29ebe200258a9a9ffb127ec8fa1260b7e2124c38
---
M _testenv/testenv/podman.py
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index 6d801fa..53806a4 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -131,6 +131,10 @@
def exec_cmd(cmd, podman_opts=[], cwd=None, env={}, *args, **kwargs):
+ if not container_name:
+ raise RuntimeError("Attempting to execute a command in podman, but the"
+ f" container isn't running anymore: {cmd}")
+
podman_opts = list(podman_opts)
podman_opts += generate_env_podman(env)
# Attach a fake tty (eclipse-titan won't print colored output otherwise)
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38258?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I29ebe200258a9a9ffb127ec8fa1260b7e2124c38
Gerrit-Change-Number: 38258
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge, pespin.
osmith has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38256?usp=email )
Change subject: testenv: testsuite: use rsync with --archive
......................................................................
Patch Set 2: Code-Review+2
(2 comments)
Patchset:
PS1:
> I think in general it's useful to use `-a` with rsync as a default option in all situations. […]
Done
Patchset:
PS2:
applying +2 after using --archive
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38256?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia9737bd8ba22a555615862bf5e14dbdf0dea19b4
Gerrit-Change-Number: 38256
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 23 Sep 2024 11:15:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>