osmith has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40034?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: testenv: remove copy_ttcn3_hacks_dir
......................................................................
testenv: remove copy_ttcn3_hacks_dir
When running with podman, set a separate builddir to avoid conflicts
with build objects generated from running "make" outside of podman. As
the buildsystem supports setting a differerent builddir directly now,
remove the copy_ttcn3_hacks_dir logic that was used to emulate this
feature.
Change-Id: I9cae0c4f8c34bb6876ef51048ef19b35a2e369a9
---
M _testenv/testenv/requirements.py
M _testenv/testenv/testenv_cfg.py
M _testenv/testenv/testsuite.py
3 files changed, 15 insertions(+), 63 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
diff --git a/_testenv/testenv/requirements.py b/_testenv/testenv/requirements.py
index 5405f50..cd320d5 100644
--- a/_testenv/testenv/requirements.py
+++ b/_testenv/testenv/requirements.py
@@ -75,7 +75,7 @@
"-q",
"fftranscode",
os.path.join(
- testenv.testsuite.ttcn3_hacks_dir_src,
+ testenv.testsuite.ttcn3_hacks_dir,
testenv.args.testsuite,
"regen_makefile.sh",
),
diff --git a/_testenv/testenv/testenv_cfg.py b/_testenv/testenv/testenv_cfg.py
index 4044225..70d64c8 100644
--- a/_testenv/testenv/testenv_cfg.py
+++ b/_testenv/testenv/testenv_cfg.py
@@ -30,7 +30,7 @@
def exit_error_readme():
- readme = os.path.join(testenv.testsuite.ttcn3_hacks_dir_src,
"_testenv/README.md")
+ readme = os.path.join(testenv.testsuite.ttcn3_hacks_dir,
"_testenv/README.md")
logging.error(f"More information: {readme}")
sys.exit(1)
@@ -194,7 +194,7 @@
def find_configs():
- dir_testsuite = os.path.join(testenv.testsuite.ttcn3_hacks_dir_src,
testenv.args.testsuite)
+ dir_testsuite = os.path.join(testenv.testsuite.ttcn3_hacks_dir,
testenv.args.testsuite)
pattern = os.path.join(dir_testsuite, "testenv*.cfg")
ret = sorted(glob.glob(pattern))
diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py
index c1d048b..a42c4e4 100644
--- a/_testenv/testenv/testsuite.py
+++ b/_testenv/testenv/testsuite.py
@@ -1,6 +1,7 @@
# Copyright 2024 sysmocom - s.f.m.c. GmbH
# SPDX-License-Identifier: GPL-3.0-or-later
import atexit
+import copy
import glob
import logging
import os
@@ -12,8 +13,8 @@
import testenv.cmd
import time
-ttcn3_hacks_dir = None
-ttcn3_hacks_dir_src = os.path.realpath(f"{__file__}/../../..")
+ttcn3_hacks_dir = os.path.realpath(f"{__file__}/../../..")
+builddir_env = {}
testsuite_proc = None
@@ -23,82 +24,34 @@
return
logging.info("Updating osmo-ttcn3-hacks/deps")
- deps_dir = os.path.join(ttcn3_hacks_dir_src, "deps")
+ deps_dir = os.path.join(ttcn3_hacks_dir, "deps")
testenv.cmd.run(["make", "-C", deps_dir])
testenv.cmd.run(["touch", deps_marker])
-def copy_ttcn3_hacks_dir():
- """Copy source files of osmo-ttcn3-hacks.git to the cache dir, so we
don't
- mix binary objects from host and inside podman that are very likely to
- be incompatible"""
- global ttcn3_hacks_dir
-
- ttcn3_hacks_dir = os.path.join(testenv.args.cache, "podman",
"osmo-ttcn3-hacks")
-
- logging.info(f"Copying osmo-ttcn3-hacks sources to: {ttcn3_hacks_dir}")
-
- # Rsync can't directly parse the .gitignore with ! rules, so create a list
- # of files to be copied with git
- copy_list = os.path.join(testenv.args.cache, "podman",
"ttcn3-copy-list")
- testenv.cmd.run(
- f"git ls-files -o -c --exclude-standard >
{shlex.quote(copy_list)}",
- cwd=ttcn3_hacks_dir_src,
- no_podman=True,
- )
-
- # Copy source files, excluding binary objects
- testenv.cmd.run(
- [
- "rsync",
- "--archive",
- f"--files-from={copy_list}",
- f"{ttcn3_hacks_dir_src}/",
- f"{ttcn3_hacks_dir}/",
- ],
- no_podman=True,
- )
-
- # The "deps" dir is in gitignore, copy it separately
- testenv.cmd.run(
- [
- "rsync",
- "--links",
- "--recursive",
- "--exclude",
- "/.git",
- f"{ttcn3_hacks_dir_src}/deps/",
- f"{ttcn3_hacks_dir}/deps/",
- ],
- no_podman=True,
- )
-
-
def prepare_testsuite_dir():
testsuite_dir = f"{ttcn3_hacks_dir}/{testenv.args.testsuite}"
logging.info(f"Generating links and Makefile for
{testenv.args.testsuite}")
- testenv.cmd.run(["./gen_links.sh"], cwd=testsuite_dir)
- testenv.cmd.run("USE_CCACHE=1 ./regen_makefile.sh", cwd=testsuite_dir)
+ testenv.cmd.run(["./gen_links.sh"], cwd=testsuite_dir, env=builddir_env)
+ testenv.cmd.run("USE_CCACHE=1 ./regen_makefile.sh", cwd=testsuite_dir,
env=builddir_env)
def init():
- global ttcn3_hacks_dir
+ global builddir_env
atexit.register(stop)
-
update_deps()
if testenv.args.podman:
- copy_ttcn3_hacks_dir()
- else:
- ttcn3_hacks_dir = ttcn3_hacks_dir_src
+ builddir = os.path.join(testenv.args.cache, "podman",
"ttcn3")
+ builddir_env = {"BUILDDIR": builddir}
prepare_testsuite_dir()
def build():
logging.info("Building testsuite")
- testenv.cmd.run(["make", testenv.args.testsuite], cwd=ttcn3_hacks_dir)
+ testenv.cmd.run(["make", testenv.args.testsuite], cwd=ttcn3_hacks_dir,
env=builddir_env)
def is_running(pid):
@@ -170,9 +123,8 @@
suite = os.path.join(ttcn3_hacks_dir, testenv.args.testsuite,
section_data["program"])
suite = os.path.relpath(suite, ttcn3_hacks_dir)
- env = {
- "TTCN3_PCAP_PATH": os.path.join(testenv.testdir.testdir,
"testsuite"),
- }
+ env = copy.copy(builddir_env)
+ env["TTCN3_PCAP_PATH"] = os.path.join(testenv.testdir.testdir,
"testsuite")
# Let ttcn3-tcpdump-stop.sh retrieve talloc reports
host, port = testenv.testenv_cfg.get_vty_host_port(cfg)
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40034?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: I9cae0c4f8c34bb6876ef51048ef19b35a2e369a9
Gerrit-Change-Number: 40034
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>