From: David Mulder Date: Fri, 19 Mar 2021 18:31:42 +0000 (-0600) Subject: python: glue function for detecting if selftest is enabled X-Git-Tag: tevent-0.11.0~1052 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d01a588c20723090b4d672d869c89a4397bce3c0;p=thirdparty%2Fsamba.git python: glue function for detecting if selftest is enabled Signed-off-by: David Mulder Reviewed-by: Andrew Bartlett --- diff --git a/python/pyglue.c b/python/pyglue.c index ed79df10be2..1947373974a 100644 --- a/python/pyglue.c +++ b/python/pyglue.c @@ -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} }; diff --git a/python/samba/__init__.py b/python/samba/__init__.py index cabae4eaf1f..449e4826ffb 100644 --- a/python/samba/__init__.py +++ b/python/samba/__init__.py @@ -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