[pacman-dev] [PATCH 1/4] silence warning when built without curl
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> --- lib/libalpm/handle.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index f912d2f5..c491d87c 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -876,6 +876,8 @@ int SYMEXPORT alpm_option_set_disable_dl_timeout(alpm_handle_t *handle, CHECK_HANDLE(handle, return -1); #ifdef HAVE_LIBCURL handle->disable_dl_timeout = disable_dl_timeout; +#else + (void)disable_dl_timeout; /* silence unused variable warnings */ #endif return 0; } -- 2.19.2
Unused since 12e00af5315135a29a66c9aaa01e141a32d4634b Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> --- test/pacman/pactest.py | 3 --- test/pacman/pmenv.py | 5 ----- 2 files changed, 8 deletions(-) diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py index 85cce6a1..a563fa72 100755 --- a/test/pacman/pactest.py +++ b/test/pacman/pactest.py @@ -160,6 +160,3 @@ def create_parser(): shutil.rmtree(root_path) else: tap.diag("pacman testing root saved: %s" % root_path) - - if env.failed > 0: - sys.exit(1) diff --git a/test/pacman/pmenv.py b/test/pacman/pmenv.py index f1d626d3..9e6b5625 100644 --- a/test/pacman/pmenv.py +++ b/test/pacman/pmenv.py @@ -24,12 +24,7 @@ class pmenv(object): """Environment object """ - testcases = [] - passed = 0 - failed = 0 - expectedfail = 0 - unexpectedpass = 0 def __init__(self, root = "root"): self.root = os.path.abspath(root) -- 2.19.2
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> --- test/pacman/tap.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/pacman/tap.py b/test/pacman/tap.py index 6a3bee0d..eb0747be 100644 --- a/test/pacman/tap.py +++ b/test/pacman/tap.py @@ -21,6 +21,11 @@ def _output(msg): print("%s%s" % (" "*level, str(msg).replace("\n", "\\n"))) +def skip_all(description=""): + if description: + description = " # " + description + _output("1..0%s" % (description)) + def ok(ok, description=""): global count, failed count += 1 -- 2.19.2
Previously, pacman's test suite would fail when compiled without signature support. Adds a require_capability method to pmtest objects. Currently recognized values are 'gpg', 'curl', and 'nls'; although only gpg is used presently. Missing features are indicated by running pactest with one of the --without-<feature> options. This modifies pmenv to run each case as independent tests. Previously, a single pmenv could run multiple tests, combining there output into a single TAP stream but making it impossible to properly skip an entire test case. This change does not affect running pactest.py with a single test (as both autotools and meson do), but will affect anybody manually running pactest.py with multiple tests at once. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> --- Makefile.am | 6 ++++++ test/pacman/meson.build | 25 ++++++++++++++++--------- test/pacman/pactest.py | 12 ++++++++++++ test/pacman/pmenv.py | 26 +++++++++++++++++--------- test/pacman/pmtest.py | 8 +++++++- test/pacman/tests/sign001.py | 1 + 6 files changed, 59 insertions(+), 19 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1e9ee152..98ad8b62 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,6 +51,12 @@ AM_PY_LOG_FLAGS = \ --ldconfig $(LDCONFIG) \ --bindir $(top_builddir)/src/pacman \ --bindir $(top_builddir)/scripts +if !HAVE_LIBGPGME +AM_PY_LOG_FLAGS += --without-gpg +endif +if !HAVE_LIBCURL +AM_PY_LOG_FLAGS += --without-curl +endif # create the pacman DB, cache, makepkg-template and system hook directories upon install install-data-local: diff --git a/test/pacman/meson.build b/test/pacman/meson.build index 3ad1fcd0..5edbbd43 100644 --- a/test/pacman/meson.build +++ b/test/pacman/meson.build @@ -342,19 +342,26 @@ foreach testobj : pacman_tests input = testobj.get('name') test_name = input.split('/')[1] should_fail = testobj.get('should_fail', false) + args = [ + join_paths(meson.source_root(), 'build-aux/tap-driver.py'), + join_paths(meson.current_source_dir(), 'pactest.py'), + '--scriptlet-shell', get_option('scriptlet-shell'), + '--bindir', meson.build_root(), + '--ldconfig', LDCONFIG, + '--verbose', + join_paths(meson.current_source_dir(), input) + ] + if not conf.get('HAVE_LIBCURL') + args += '--without-curl' + endif + if not conf.get('HAVE_LIBGPGME') + args += '--without-gpg' + endif test( test_name, PYTHON, - args : [ - join_paths(meson.source_root(), 'build-aux/tap-driver.py'), - join_paths(meson.current_source_dir(), 'pactest.py'), - '--scriptlet-shell', get_option('scriptlet-shell'), - '--bindir', meson.build_root(), - '--ldconfig', LDCONFIG, - '--verbose', - join_paths(meson.current_source_dir(), input) - ], + args : args, depends : [pacman_bin], should_fail : should_fail) endforeach diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py index a563fa72..2d1edf1d 100755 --- a/test/pacman/pactest.py +++ b/test/pacman/pactest.py @@ -77,6 +77,15 @@ def create_parser(): parser.add_option("--bindir", type = "string", dest = "bindir", action = "append", help = "specify location of binaries") + parser.add_option("--without-gpg", action = "store_true", + dest = "missing_gpg", default = False, + help = "skip gpg-related tests") + parser.add_option("--without-curl", action = "store_true", + dest = "missing_curl", default = False, + help = "skip downloader-related tests") + parser.add_option("--without-nls", action = "store_true", + dest = "missing_nls", default = False, + help = "skip translation-related tests") parser.add_option("--keep-root", action = "store_true", dest = "keeproot", default = False, help = "don't remove the generated pacman root filesystem") @@ -137,6 +146,9 @@ def create_parser(): env.pacman["manual-confirm"] = opts.manualconfirm env.pacman["scriptlet-shell"] = opts.scriptletshell env.pacman["ldconfig"] = opts.ldconfig + env.config["gpg"] = not opts.missing_gpg + env.config["nls"] = not opts.missing_nls + env.config["curl"] = not opts.missing_curl try: for i in args: diff --git a/test/pacman/pmenv.py b/test/pacman/pmenv.py index 9e6b5625..71001dbf 100644 --- a/test/pacman/pmenv.py +++ b/test/pacman/pmenv.py @@ -36,6 +36,11 @@ def __init__(self, root = "root"): "valgrind": 0, "nolog": 0 } + self.config = { + "gpg": True, + "nls": True, + "curl": True + } def __str__(self): return "root = %s\n" \ @@ -52,15 +57,18 @@ def addtest(self, testcase): def run(self): """ """ - tap.plan(len(self.testcases)) for testcase in self.testcases: - t = pmtest.pmtest(testcase, self.root) - tap.diag("Running '%s'" % t.testname) - + t = pmtest.pmtest(testcase, self.root, self.config) t.load() - t.generate(self.pacman) - t.run(self.pacman) + if t.skipall: + tap.skip_all("skipping %s (%s)" % (t.description, t.skipall)) + else: + tap.plan(1) + tap.diag("Running '%s'" % t.testname) + + t.generate(self.pacman) + t.run(self.pacman) - tap.diag("==> Checking rules") - tap.todo = t.expectfailure - tap.subtest(lambda: t.check(), t.description) + tap.diag("==> Checking rules") + tap.todo = t.expectfailure + tap.subtest(lambda: t.check(), t.description) diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index 00012ac6..274677d2 100644 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -33,12 +33,13 @@ class pmtest(object): """Test object """ - def __init__(self, name, root): + def __init__(self, name, root, config): self.name = name self.testname = os.path.basename(name).replace('.py', '') self.root = root self.dbver = 9 self.cachepkgs = True + self.config = config self.cmd = ["pacman", "--noconfirm", "--config", self.configfile(), "--root", self.rootdir(), @@ -101,6 +102,7 @@ def load(self): self.rules = [] self.files = [] self.expectfailure = False + self.skipall = False if os.path.isfile(self.name): # all tests expect this to be available @@ -201,6 +203,10 @@ def generate(self, pacman): self.files.append(f) vprint("\t%s" % f.name) + def require_capability(self, cap): + if not self.config[cap]: + self.skipall = "missing capability " + cap + def add_hook(self, name, content): if not name.endswith(".hook"): name = name + ".hook" diff --git a/test/pacman/tests/sign001.py b/test/pacman/tests/sign001.py index 14add09c..e63bce2c 100644 --- a/test/pacman/tests/sign001.py +++ b/test/pacman/tests/sign001.py @@ -1,4 +1,5 @@ self.description = "Add a bogus signature to a package DB" +self.require_capability("gpg") sp = pmpkg("pkg1") sp.pgpsig = "asdfasdfsdfasdfsdafasdfsdfasd" -- 2.19.2
On 23/12/18 4:24 pm, Andrew Gregory wrote:
Previously, pacman's test suite would fail when compiled without signature support.
Adds a require_capability method to pmtest objects. Currently recognized values are 'gpg', 'curl', and 'nls'; although only gpg is used presently. Missing features are indicated by running pactest with one of the --without-<feature> options.
This modifies pmenv to run each case as independent tests. Previously, a single pmenv could run multiple tests, combining there output into a single TAP stream but making it impossible to properly skip an entire test case. This change does not affect running pactest.py with a single test (as both autotools and meson do), but will affect anybody manually running pactest.py with multiple tests at once.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
OK. Pulled entire patch series. Allan
participants (2)
-
Allan McRae
-
Andrew Gregory