osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40589?usp=email )
Change subject: testenv: add run --asan ......................................................................
testenv: add run --asan
Add a new --asan option for building Osmocom libraries and programs from source with address sanitizer enabled. This works by adding sanitize.opts to osmo-dev's gen_makefile.py, which in turn adds --enable-sanitize to most Osmocom projects.
The --autoreconf-in-src-copy argument for gen_makefile.py must be moved up, so the list of *.opts files is not interrupted by another type of argument that causes argument parsing to fail.
Suggested-by: Pau Espin Pedrol pespin@sysmocom.de Related: https://gitea.osmocom.org/osmocom/osmo-dev/src/branch/master/sanitize.opts Change-Id: I1947dd3a7d9ce51dcbef9cffd5d7b402f236b9e2 --- M _testenv/testenv/__init__.py M _testenv/testenv/cmd.py M _testenv/testenv/osmo_dev.py 3 files changed, 16 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/89/40589/1
diff --git a/_testenv/testenv/__init__.py b/_testenv/testenv/__init__.py index f2f0321..3de7f0c 100644 --- a/_testenv/testenv/__init__.py +++ b/_testenv/testenv/__init__.py @@ -113,6 +113,12 @@ help="number of jobs to run simultaneously (default: nproc)", type=int, ) + group.add_argument( + "-a", + "--asan", + action="store_true", + help="pass --enable-sanitize to Osmocom configure scripts", + )
group = sub_run.add_argument_group("exit options", "When and how testenv should exit when done.") group = group.add_mutually_exclusive_group() @@ -229,6 +235,11 @@ if args.action != "run": return
+ if args.binary_repo and args.asan: + raise NoTraceException( + "--binary-repo cannot be used with --asan, consider using '--binary-repo osmocom:nightly:asan' instead" + ) + if args.binary_repo and not args.podman: raise NoTraceException("--binary-repo requires --podman")
diff --git a/_testenv/testenv/cmd.py b/_testenv/testenv/cmd.py index d4a1e9a..e8598f0 100644 --- a/_testenv/testenv/cmd.py +++ b/_testenv/testenv/cmd.py @@ -56,6 +56,8 @@ else: make_dir = os.path.join(testenv.args.cache, "host", "make") make_dir += str(make_dir_version) + if testenv.args.asan: + make_dir += "-asan" env_extra["OSMO_DEV_MAKE_DIR"] = make_dir
if testenv.args.kernel == "debian": diff --git a/_testenv/testenv/osmo_dev.py b/_testenv/testenv/osmo_dev.py index 45912ae..5852063 100644 --- a/_testenv/testenv/osmo_dev.py +++ b/_testenv/testenv/osmo_dev.py @@ -58,6 +58,8 @@ return
extra_opts = [] + if testenv.args.asan: + extra_opts += ["sanitize.opts"] if testenv.args.jobs: extra_opts += [f"-j{testenv.args.jobs}"]
@@ -73,6 +75,7 @@ "--no-ldconfig", "--src-dir", testenv.src_dir, + "--autoreconf-in-src-copy", "default.opts", "ccache.opts", "gtp_linux.opts", @@ -85,7 +88,6 @@ "no_systemd.opts", "werror.opts", os.path.join(testenv.data_dir, "osmo-dev/testenv.opts"), - "--autoreconf-in-src-copy", ] + extra_opts
cwd = get_osmo_dev_dir()