]> git.ipfire.org Git - pakfire.git/commitdiff
build: Add switch to disable tests
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 31 Oct 2022 11:14:03 +0000 (11:14 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 31 Oct 2022 11:14:03 +0000 (11:14 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c
src/libpakfire/build.c
src/libpakfire/include/pakfire/build.h
src/scripts/pakfire-builder.in

index 73e8418aab051c25b5027c279c54ef33aa3b0fd0..6ec1ce9ce2bfd5933b1c7aa5f07188b3979b8353 100644 (file)
@@ -1114,6 +1114,7 @@ static PyObject* Pakfire_build(PakfireObject* self, PyObject* args, PyObject* kw
                "build_id",
                "disable_snapshot",
                "disable_ccache",
+               "disable_tests",
                NULL,
        };
 
@@ -1121,9 +1122,10 @@ static PyObject* Pakfire_build(PakfireObject* self, PyObject* args, PyObject* kw
        const char* build_id = NULL;
        int disable_snapshot = 0;
        int disable_ccache = 0;
+       int disable_tests = 0;
 
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zpp", kwlist, &path, &build_id,
-                       &disable_snapshot, &disable_ccache))
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zppp", kwlist, &path, &build_id,
+                       &disable_snapshot, &disable_ccache, &disable_tests))
                return NULL;
 
        int flags = 0;
@@ -1136,6 +1138,10 @@ static PyObject* Pakfire_build(PakfireObject* self, PyObject* args, PyObject* kw
        if (disable_ccache)
                flags |= PAKFIRE_BUILD_DISABLE_CCACHE;
 
+       // Disable tests if requested
+       if (disable_tests)
+               flags |= PAKFIRE_BUILD_DISABLE_TESTS;
+
        // Run build
        int r = pakfire_build(self->pakfire, path, NULL, build_id, flags);
 
index 9dce793b872d17683bb43aabac36d8e875342b20..12b8a5a25df65355d23ed426f6f61c08ac47aa55 100644 (file)
@@ -1210,9 +1210,11 @@ static int pakfire_build_perform(struct pakfire_build* build,
                goto ERROR;
 
        // Test the build
-       r = pakfire_build_stage(build, makefile, "test");
-       if (r)
-               goto ERROR;
+       if (!pakfire_build_has_flag(build, PAKFIRE_BUILD_DISABLE_TESTS)) {
+               r = pakfire_build_stage(build, makefile, "test");
+               if (r)
+                       goto ERROR;
+       }
 
        // Install everything
        r = pakfire_build_stage(build, makefile, "install");
index 726d32d3ecb47504879fa64f4314a04aebaa2a57..2eda64eed6ff2abfa827043f77c8de53ed279469 100644 (file)
@@ -29,6 +29,7 @@ enum pakfire_build_flags {
        PAKFIRE_BUILD_INTERACTIVE      = (1 << 0),
        PAKFIRE_BUILD_DISABLE_SNAPSHOT = (1 << 1),
        PAKFIRE_BUILD_DISABLE_CCACHE   = (1 << 2),
+       PAKFIRE_BUILD_DISABLE_TESTS    = (1 << 3),
 };
 
 int pakfire_build_create(struct pakfire_build** build,
index ae1d2ee9025f0bd8264274d6c0abfea45347b0aa..df2a551d6cdeafffe4bde5d19fe9213612fd86bb 100644 (file)
@@ -63,6 +63,8 @@ class Cli(object):
                        help=_("Disable ccache"))
                build.add_argument("--disable-snapshot", action="store_true",
                        help=_("Disable using snapshots"))
+               build.add_argument("--disable-tests", action="store_true",
+                       help=_("Disable running tests"))
 
                # clean
                clean = subparsers.add_parser("clean", help=_("Cleanup all temporary files"))
@@ -204,6 +206,7 @@ class Cli(object):
                                        build_id="%s" % ns.build_id if ns.build_id else None,
                                        disable_ccache=ns.disable_ccache,
                                        disable_snapshot=ns.disable_snapshot,
+                                       disable_tests=ns.disable_tests,
                                )
 
        def _dist(self, ns):