mirror of
https://github.com/samba-team/samba.git
synced 2025-01-05 09:18:06 +03:00
Add pyglue for Rust for disabling tests
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
parent
910a331f3e
commit
986e398887
@ -355,6 +355,8 @@ def configure(conf):
|
|||||||
|
|
||||||
conf.env.disable_python = Options.options.disable_python
|
conf.env.disable_python = Options.options.disable_python
|
||||||
conf.env.enable_rust = Options.options.enable_rust
|
conf.env.enable_rust = Options.options.enable_rust
|
||||||
|
if Options.options.enable_rust:
|
||||||
|
conf.DEFINE('HAVE_RUST', '1')
|
||||||
|
|
||||||
if (conf.env.AUTOCONF_HOST and
|
if (conf.env.AUTOCONF_HOST and
|
||||||
conf.env.AUTOCONF_BUILD and
|
conf.env.AUTOCONF_BUILD and
|
||||||
|
@ -309,6 +309,16 @@ static PyObject *py_is_ad_dc_built(PyObject *self,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *py_is_rust_built(PyObject *self,
|
||||||
|
PyObject *Py_UNUSED(ignored))
|
||||||
|
{
|
||||||
|
#ifdef HAVE_RUST
|
||||||
|
Py_RETURN_TRUE;
|
||||||
|
#else
|
||||||
|
Py_RETURN_FALSE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *py_is_selftest_enabled(PyObject *self,
|
static PyObject *py_is_selftest_enabled(PyObject *self,
|
||||||
PyObject *Py_UNUSED(ignored))
|
PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
@ -580,6 +590,8 @@ static PyMethodDef py_misc_methods[] = {
|
|||||||
METH_NOARGS, "How many NDR internal tokens is too many for this build?" },
|
METH_NOARGS, "How many NDR internal tokens is too many for this build?" },
|
||||||
{ "get_burnt_commandline", (PyCFunction)py_get_burnt_commandline,
|
{ "get_burnt_commandline", (PyCFunction)py_get_burnt_commandline,
|
||||||
METH_VARARGS, "Return a redacted commandline to feed to setproctitle (None if no redaction required)" },
|
METH_VARARGS, "Return a redacted commandline to feed to setproctitle (None if no redaction required)" },
|
||||||
|
{ "is_rust_built", (PyCFunction)py_is_rust_built, METH_NOARGS,
|
||||||
|
"is Samba built with Rust?" },
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -432,6 +432,7 @@ is_ntvfs_fileserver_built = _glue.is_ntvfs_fileserver_built
|
|||||||
is_heimdal_built = _glue.is_heimdal_built
|
is_heimdal_built = _glue.is_heimdal_built
|
||||||
is_ad_dc_built = _glue.is_ad_dc_built
|
is_ad_dc_built = _glue.is_ad_dc_built
|
||||||
is_selftest_enabled = _glue.is_selftest_enabled
|
is_selftest_enabled = _glue.is_selftest_enabled
|
||||||
|
is_rust_built = _glue.is_rust_built
|
||||||
|
|
||||||
NTSTATUSError = _glue.NTSTATUSError
|
NTSTATUSError = _glue.NTSTATUSError
|
||||||
HRESULTError = _glue.HRESULTError
|
HRESULTError = _glue.HRESULTError
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
from samba.tests import TestCase, BlackboxProcessError
|
from samba.tests import TestCase, BlackboxProcessError
|
||||||
import os
|
import os
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
from samba import is_rust_built
|
||||||
|
|
||||||
|
|
||||||
class RustCargoTests(TestCase):
|
class RustCargoTests(TestCase):
|
||||||
@ -65,6 +66,9 @@ class RustCargoTests(TestCase):
|
|||||||
msg)
|
msg)
|
||||||
|
|
||||||
def test_rust(self):
|
def test_rust(self):
|
||||||
|
if not is_rust_built():
|
||||||
|
self.skipTest('Cannot test Samba Rust if not built')
|
||||||
|
|
||||||
crates = []
|
crates = []
|
||||||
for root, dirs, files in os.walk(self.rust_dir):
|
for root, dirs, files in os.walk(self.rust_dir):
|
||||||
for file in files:
|
for file in files:
|
||||||
|
Loading…
Reference in New Issue
Block a user