python: glue function for detecting if selftest is enabled
authorDavid Mulder <dmulder@suse.com>
Fri, 19 Mar 2021 18:31:42 +0000 (12:31 -0600)
committerDavid Mulder <dmulder@samba.org>
Wed, 21 Apr 2021 20:51:31 +0000 (20:51 +0000)
Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/pyglue.c
python/samba/__init__.py

index ed79df10be23c91a3924091ef4e46c39c4e05644..1947373974a196cf56f3be3bdd8cef772ca768c0 100644 (file)
@@ -256,6 +256,16 @@ static PyObject *py_is_ad_dc_built(PyObject *self,
 #endif
 }
 
+static PyObject *py_is_selftest_enabled(PyObject *self,
+                PyObject *Py_UNUSED(ignored))
+{
+#ifdef ENABLE_SELFTEST
+       Py_RETURN_TRUE;
+#else
+       Py_RETURN_FALSE;
+#endif
+}
+
 /*
   return the list of interface IPs we have configured
   takes an loadparm context, returns a list of IPs in string form
@@ -448,6 +458,8 @@ static PyMethodDef py_misc_methods[] = {
                "Generate random bytes with specified length." },
        { "is_ad_dc_built", (PyCFunction)py_is_ad_dc_built, METH_NOARGS,
                "is Samba built with AD DC?" },
+       { "is_selftest_enabled", (PyCFunction)py_is_selftest_enabled,
+               METH_NOARGS, "is Samba built with selftest enabled?" },
        {0}
 };
 
index cabae4eaf1f5e71f29e24fa5d5e43f5b58bab538..449e4826ffb4109b93c65ac90b372c01fa83b0fe 100644 (file)
@@ -382,6 +382,7 @@ strstr_m = _glue.strstr_m
 is_ntvfs_fileserver_built = _glue.is_ntvfs_fileserver_built
 is_heimdal_built = _glue.is_heimdal_built
 is_ad_dc_built = _glue.is_ad_dc_built
+is_selftest_enabled = _glue.is_selftest_enabled
 
 NTSTATUSError = _glue.NTSTATUSError
 HRESULTError = _glue.HRESULTError