commit: e612bf5e501f2ad421a9dfa234b12c3a3ea9fa9b Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Wed Jan 7 21:07:46 2026 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Wed Jan 7 21:07:46 2026 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=e612bf5e
qatom: allow artificial atom_clone for testing purposes atom_clone should retain the exact input, we better test that Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> qatom.c | 9 ++++++++- tests/qatom/dotest | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/qatom.c b/qatom.c index a076c49..9ff0e85 100644 --- a/qatom.c +++ b/qatom.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2019 Gentoo Foundation + * Copyright 2005-2026 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 * * Copyright 2005-2008 Ned Ludd - <[email protected]> @@ -48,6 +48,7 @@ int qatom_main(int argc, char **argv) depend_atom *atomc; tree_ctx *tree = NULL; int i; + bool clone = getenv("QATOM_CLONE") != NULL; /* testing purposes */ while ((i = GETOPT_LONG(QATOM, qatom, "")) != -1) { switch (i) { @@ -79,6 +80,12 @@ int qatom_main(int argc, char **argv) continue; } + if (clone) { + depend_atom *new = atom_clone(atom); + atom_implode(atom); + atom = new; + } + switch (action) { case _COMPARE: case _SCOMPARE: { diff --git a/tests/qatom/dotest b/tests/qatom/dotest index f478f1c..8350398 100755 --- a/tests/qatom/dotest +++ b/tests/qatom/dotest @@ -2,6 +2,9 @@ . ../init.sh || exit 1 +# test the effects of atom_clone on all our inputs +export QATOM_CLONE=1 + test() { local num=$1 exp=$2 ret=0 out shift 2
