ldap/servers
by Ludwig Krispenz
ldap/servers/plugins/replication/repl5_ruv.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
New commits:
commit 61953fc2d47f134795f365e60b1286dd8b0cd1de
Author: Ludwig Krispenz <lkrispen(a)redhat.com>
Date: Tue Feb 7 17:02:00 2017 +0100
fix for reg in 49008, check if ruv element exists
diff --git a/ldap/servers/plugins/replication/repl5_ruv.c b/ldap/servers/plugins/replication/repl5_ruv.c
index 111b88f..d59e6d2 100644
--- a/ldap/servers/plugins/replication/repl5_ruv.c
+++ b/ldap/servers/plugins/replication/repl5_ruv.c
@@ -1705,8 +1705,14 @@ int ruv_cancel_csn_inprogress (RUV *ruv, const CSN *csn, ReplicaId local_rid)
replica = ruvGetReplica (ruv, prim_rid);
rc = csnplRemoveAll (replica->csnpl, prim_csn);
if (prim_rid != local_rid) {
- replica = ruvGetReplica (ruv, local_rid);
- rc = csnplRemoveAll (replica->csnpl, prim_csn);
+ if( local_rid != READ_ONLY_REPLICA_ID) {
+ replica = ruvGetReplica (ruv, local_rid);
+ if (replica) {
+ rc = csnplRemoveAll (replica->csnpl, prim_csn);
+ } else {
+ rc = RUV_NOTFOUND;
+ }
+ }
}
} else {
rc = csnplRemove (replica->csnpl, csn);
7 years, 1 month
ldap/admin
by vashirov
ldap/admin/src/scripts/ds_selinux_port_query.in | 66 ++++++++++--------------
1 file changed, 29 insertions(+), 37 deletions(-)
New commits:
commit 5e4630228d3188cfb3021c84e5b9088815dccc2f
Author: Viktor Ashirov <vashirov(a)redhat.com>
Date: Fri Feb 3 18:26:52 2017 +0100
Ticket 49108 - ds_selinux_port_query doesn't detect ports labeled with range
Bug Description:
If ports were labeled using range, ds_selinux_port_query still thinks that
they are not labeled.
Fix Description:
Rewrite ds_selinux_port_query to use sepolicy instead of semanage to be
able to use range lookup.
https://fedorahosted.org/389/ticket/49108
Reviewed by: nhosoi, wibrown (Thanks!)
diff --git a/ldap/admin/src/scripts/ds_selinux_port_query.in b/ldap/admin/src/scripts/ds_selinux_port_query.in
index 006f978..407478c 100644
--- a/ldap/admin/src/scripts/ds_selinux_port_query.in
+++ b/ldap/admin/src/scripts/ds_selinux_port_query.in
@@ -5,13 +5,12 @@
# All rights reserved.
#
# License: GPL (version 3 or any later version).
-# See LICENSE for details.
+# See LICENSE for details.
# END COPYRIGHT BLOCK
#
import sys
-import selinux
-import semanage
+import sepolicy
# These are python 3 capable, but el7 doesn't have libsemanage-python3
@@ -22,6 +21,8 @@ import semanage
# or if a lable is given, exists AND inside of label type.
# 2 means port exists but belongs to a different type.
+# Get the arguments
+# Fail if they are not set correctly.
if len(sys.argv) <= 1:
sys.stderr.write("Must provide port to query\n")
sys.exit(512)
@@ -33,37 +34,28 @@ try:
except:
pass
-# Get the arguments
-
-# Fail if they are not set correctly.
-
-# Check the port in policy
-h = semanage.semanage_handle_create()
-semanage.semanage_connect(h)
-# This could check high / low values, but eh.
-(r, k) = semanage.semanage_port_key_create(h, port, port, semanage.SEMANAGE_PROTO_TCP)
-
-# Do I need to check _local too?
-(t, e) = semanage.semanage_port_exists(h, k)
-
-if label is None:
- sys.exit(e)
-
-# See if it has a specifc label
-
-if (e == 0):
- # No point checking the label, it doesn't exist
- sys.exit(e)
-
-(t, sp) = semanage.semanage_port_query(h, k)
-
-# do we need to check if this is none? We already know that the port exists, so it must have a context ...
-r = semanage.semanage_port_get_con(sp)
-
-if label == semanage.semanage_context_get_type(r):
- sys.exit(1)
-
-else:
- sys.stderr.write('Port belongs to %s\n' % semanage.semanage_context_get_type(r))
- sys.exit(2)
-
+# Get all defined ports from the policy
+portrecs, portrecsbynum = sepolicy.gen_port_dict()
+all_ports = []
+for i in portrecs:
+ if i[0] not in all_ports:
+ all_ports.append(i[0])
+all_ports.sort()
+
+found = False
+for i in portrecsbynum:
+ # Check if the port is in range
+ if i[0] <= port and port <= i[1] and 'tcp' == i[2]:
+ # See if it has a specific label
+ # Ignore default label types
+ if portrecsbynum[i][0] not in ['unreserved_port_t', 'reserved_port_t',
+ 'ephemeral_port_t']:
+ # Port exists within our label type or exists if none is given
+ if label == portrecsbynum[i][0] or label == None:
+ found = True
+ sys.exit(1)
+ else:
+ sys.stderr.write("Port belongs to {}\n".format(portrecsbynum[i][0]))
+ sys.exit(2)
+if not found:
+ sys.exit(0)
7 years, 1 month
dirsrvtests/tests
by vashirov
dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py | 2 -
dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py | 4 +--
dirsrvtests/tests/tickets/ticket1347760_test.py | 13 +++++++---
dirsrvtests/tests/tickets/ticket397_test.py | 3 ++
dirsrvtests/tests/tickets/ticket47431_test.py | 3 ++
dirsrvtests/tests/tickets/ticket47490_test.py | 4 +++
dirsrvtests/tests/tickets/ticket47536_test.py | 2 +
dirsrvtests/tests/tickets/ticket47640_test.py | 7 +++--
dirsrvtests/tests/tickets/ticket47653MMR_test.py | 4 +++
dirsrvtests/tests/tickets/ticket47653_test.py | 4 +++
dirsrvtests/tests/tickets/ticket47676_test.py | 4 +++
dirsrvtests/tests/tickets/ticket47714_test.py | 4 +++
dirsrvtests/tests/tickets/ticket47815_test.py | 4 +++
dirsrvtests/tests/tickets/ticket47819_test.py | 4 +++
dirsrvtests/tests/tickets/ticket47823_test.py | 3 ++
dirsrvtests/tests/tickets/ticket47828_test.py | 4 +++
dirsrvtests/tests/tickets/ticket47829_test.py | 3 ++
dirsrvtests/tests/tickets/ticket47833_test.py | 3 ++
dirsrvtests/tests/tickets/ticket47838_test.py | 4 +++
dirsrvtests/tests/tickets/ticket47871_test.py | 4 +++
dirsrvtests/tests/tickets/ticket47910_test.py | 3 ++
dirsrvtests/tests/tickets/ticket47920_test.py | 3 ++
dirsrvtests/tests/tickets/ticket47927_test.py | 3 ++
dirsrvtests/tests/tickets/ticket47931_test.py | 7 +++--
dirsrvtests/tests/tickets/ticket48013_test.py | 3 ++
dirsrvtests/tests/tickets/ticket48026_test.py | 3 ++
dirsrvtests/tests/tickets/ticket48194_test.py | 4 +++
dirsrvtests/tests/tickets/ticket48272_test.py | 3 ++
dirsrvtests/tests/tickets/ticket48294_test.py | 4 +--
dirsrvtests/tests/tickets/ticket48295_test.py | 4 +--
dirsrvtests/tests/tickets/ticket48312_test.py | 2 -
dirsrvtests/tests/tickets/ticket48362_test.py | 3 ++
dirsrvtests/tests/tickets/ticket48366_test.py | 4 +++
dirsrvtests/tests/tickets/ticket48784_test.py | 3 ++
dirsrvtests/tests/tickets/ticket48906_test.py | 4 +++
dirsrvtests/tests/tickets/ticket48916_test.py | 3 ++
dirsrvtests/tests/tickets/ticket48961_test.py | 3 ++
dirsrvtests/tests/tickets/ticket548_test.py | 3 ++
38 files changed, 130 insertions(+), 15 deletions(-)
New commits:
commit ad23dc80745b28c0159fa3ee9c4ee2b47cb7afa7
Author: Viktor Ashirov <vashirov(a)redhat.com>
Date: Mon Jan 30 22:21:08 2017 +0100
Ticket 49057 - Fix tests failures on older versions of DS
Bug Description:
On older versions of DS some tests are failing because features are not
implemented.
Fix Description:
Skip tests if they're using missing features.
Fix usage of instance specific scripts in 1.2.11.
https://fedorahosted.org/389/ticket/49057
Reviewed by: wibrown, nhosoi (Thanks!)
diff --git a/dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py b/dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py
index 32a7327..904d1fc 100644
--- a/dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py
+++ b/dirsrvtests/tests/suites/attr_uniqueness_plugin/attr_uniqueness_test.py
@@ -25,7 +25,7 @@ def test_attr_uniqueness_init(topology_st):
try:
topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-dynamic-plugins', 'on')])
except ldap.LDAPError as e:
- ldap.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
+ log.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
assert False
topology_st.standalone.plugins.enable(name=PLUGIN_ATTR_UNIQUENESS)
diff --git a/dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py b/dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py
index dec6e87..9badcc3 100644
--- a/dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py
+++ b/dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py
@@ -67,14 +67,14 @@ def test_dynamic_plugins(topology_st):
try:
topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-dynamic-plugins', 'on')])
except ldap.LDAPError as e:
- ldap.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
+ log.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
assert False
# Test that critical plugins can be updated even though the change might not be applied
try:
topology_st.standalone.modify_s(DN_LDBM, [(ldap.MOD_REPLACE, 'description', 'test')])
except ldap.LDAPError as e:
- ldap.fatal('Failed to apply change to critical plugin' + e.message['desc'])
+ log.fatal('Failed to apply change to critical plugin' + e.message['desc'])
assert False
while 1:
diff --git a/dirsrvtests/tests/tickets/ticket1347760_test.py b/dirsrvtests/tests/tickets/ticket1347760_test.py
index 9019764..70ad9c4 100644
--- a/dirsrvtests/tests/tickets/ticket1347760_test.py
+++ b/dirsrvtests/tests/tickets/ticket1347760_test.py
@@ -176,10 +176,11 @@ def test_ticket1347760(topology_st):
log.info('Deleting aci in %s.' % DEFAULT_SUFFIX)
topology_st.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_DELETE, 'aci', None)])
- log.info('While binding as DM, acquire an access log path')
+ log.info('While binding as DM, acquire an access log path and instance dir')
ds_paths = Paths(serverid=topology_st.standalone.serverid,
instance=topology_st.standalone)
file_path = ds_paths.access_log
+ inst_dir = ds_paths.inst_dir
log.info('Bind case 1. the bind user has no rights to read the entry itself, bind should be successful.')
log.info('Bind as {%s,%s} who has no access rights.' % (BINDDN, BINDPW))
@@ -420,8 +421,14 @@ def test_ticket1347760(topology_st):
check_op_result(topology_st.standalone, 'delete', BOGUSDN, None, exists, rc)
log.info('Inactivate %s' % BINDDN)
- nsinactivate = os.path.join(topology_st.standalone.get_sbin_dir(), 'ns-inactivate.pl')
- p = Popen([nsinactivate, '-Z', topology_st.standalone.serverid, '-D', DN_DM, '-w', PASSWORD, '-I', BINDDN])
+ if ds_paths.version < '1.3':
+ nsinactivate = '%s/ns-inactivate.pl' % inst_dir
+ nsinactivate_cmd = [nsinactivate, '-D', DN_DM, '-w', PASSWORD, '-I', BINDDN]
+ else:
+ nsinactivate = '%s/ns-inactivate.pl' % ds_paths.sbin_dir
+ nsinactivate_cmd = [nsinactivate, '-Z', SERVERID_STANDALONE, '-D', DN_DM, '-w', PASSWORD, '-I', BINDDN]
+ log.info(nsinactivate_cmd)
+ p = Popen(nsinactivate_cmd)
assert (p.wait() == 0)
log.info('Bind as {%s,%s} which should fail with %s.' % (BINDDN, BUID, ldap.UNWILLING_TO_PERFORM.__name__))
diff --git a/dirsrvtests/tests/tickets/ticket397_test.py b/dirsrvtests/tests/tickets/ticket397_test.py
index 424c91b..91a9790 100644
--- a/dirsrvtests/tests/tickets/ticket397_test.py
+++ b/dirsrvtests/tests/tickets/ticket397_test.py
@@ -11,6 +11,9 @@ if DEBUGGING:
else:
logging.getLogger(__name__).setLevel(logging.INFO)
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.6'), reason="Not implemented")
+
log = logging.getLogger(__name__)
diff --git a/dirsrvtests/tests/tickets/ticket47431_test.py b/dirsrvtests/tests/tickets/ticket47431_test.py
index 573dc77..7c726ac 100644
--- a/dirsrvtests/tests/tickets/ticket47431_test.py
+++ b/dirsrvtests/tests/tickets/ticket47431_test.py
@@ -11,6 +11,9 @@ from lib389.tasks import *
from lib389.utils import *
from lib389.topologies import topology_st
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3'), reason="Not implemented")
+
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
diff --git a/dirsrvtests/tests/tickets/ticket47490_test.py b/dirsrvtests/tests/tickets/ticket47490_test.py
index ea6c2bd..df57aab 100644
--- a/dirsrvtests/tests/tickets/ticket47490_test.py
+++ b/dirsrvtests/tests/tickets/ticket47490_test.py
@@ -21,6 +21,10 @@ from lib389 import Entry
from lib389._constants import *
from lib389.topologies import topology_m1c1
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3'), reason="Not implemented")
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
diff --git a/dirsrvtests/tests/tickets/ticket47536_test.py b/dirsrvtests/tests/tickets/ticket47536_test.py
index e287e2e..7850ea5 100644
--- a/dirsrvtests/tests/tickets/ticket47536_test.py
+++ b/dirsrvtests/tests/tickets/ticket47536_test.py
@@ -13,6 +13,8 @@ from lib389.tasks import *
from lib389.utils import *
from lib389.topologies import topology_m2
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.5'), reason="Not implemented")
+
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
diff --git a/dirsrvtests/tests/tickets/ticket47640_test.py b/dirsrvtests/tests/tickets/ticket47640_test.py
index aa11684..23e7c03 100644
--- a/dirsrvtests/tests/tickets/ticket47640_test.py
+++ b/dirsrvtests/tests/tickets/ticket47640_test.py
@@ -11,6 +11,9 @@ from lib389.tasks import *
from lib389.utils import *
from lib389.topologies import topology_st
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.4'), reason="Not implemented")
+
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
@@ -25,13 +28,13 @@ def test_ticket47640(topology_st):
try:
topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-dynamic-plugins', 'on')])
except ldap.LDAPError as e:
- ldap.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
+ log.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
assert False
try:
topology_st.standalone.plugins.enable(name=PLUGIN_LINKED_ATTRS)
except ValueError as e:
- ldap.fatal('Failed to enable linked attributes plugin!' + e.message['desc'])
+ log.fatal('Failed to enable linked attributes plugin!' + e.message['desc'])
assert False
# Add the plugin config entry
diff --git a/dirsrvtests/tests/tickets/ticket47653MMR_test.py b/dirsrvtests/tests/tickets/ticket47653MMR_test.py
index 7fe07f5..53e921f 100644
--- a/dirsrvtests/tests/tickets/ticket47653MMR_test.py
+++ b/dirsrvtests/tests/tickets/ticket47653MMR_test.py
@@ -21,6 +21,10 @@ from lib389._constants import *
from lib389.topologies import topology_m2
logging.getLogger(__name__).setLevel(logging.DEBUG)
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.2'), reason="Not implemented")
log = logging.getLogger(__name__)
TEST_REPL_DN = "cn=test_repl, %s" % SUFFIX
diff --git a/dirsrvtests/tests/tickets/ticket47653_test.py b/dirsrvtests/tests/tickets/ticket47653_test.py
index 7ff1b87..241b4d0 100644
--- a/dirsrvtests/tests/tickets/ticket47653_test.py
+++ b/dirsrvtests/tests/tickets/ticket47653_test.py
@@ -16,6 +16,10 @@ from lib389.topologies import topology_st
log = logging.getLogger(__name__)
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.2'), reason="Not implemented")
OC_NAME = 'OCticket47653'
MUST = "(postalAddress $ postalCode)"
MAY = "(member $ street)"
diff --git a/dirsrvtests/tests/tickets/ticket47676_test.py b/dirsrvtests/tests/tickets/ticket47676_test.py
index a7a12f6..3468b90 100644
--- a/dirsrvtests/tests/tickets/ticket47676_test.py
+++ b/dirsrvtests/tests/tickets/ticket47676_test.py
@@ -21,6 +21,10 @@ from lib389._constants import *
from lib389.topologies import topology_m2
logging.getLogger(__name__).setLevel(logging.DEBUG)
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.2'), reason="Not implemented")
log = logging.getLogger(__name__)
SCHEMA_DN = "cn=schema"
diff --git a/dirsrvtests/tests/tickets/ticket47714_test.py b/dirsrvtests/tests/tickets/ticket47714_test.py
index 49d671f..146b49d 100644
--- a/dirsrvtests/tests/tickets/ticket47714_test.py
+++ b/dirsrvtests/tests/tickets/ticket47714_test.py
@@ -17,6 +17,10 @@ from lib389.topologies import topology_st
log = logging.getLogger(__name__)
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.3'), reason="Not implemented")
ACCT_POLICY_CONFIG_DN = ('cn=config,cn=%s,cn=plugins,cn=config' %
PLUGIN_ACCT_POLICY)
ACCT_POLICY_DN = 'cn=Account Inactivation Policy,%s' % SUFFIX
diff --git a/dirsrvtests/tests/tickets/ticket47815_test.py b/dirsrvtests/tests/tickets/ticket47815_test.py
index 0b68ca4..939a9bc 100644
--- a/dirsrvtests/tests/tickets/ticket47815_test.py
+++ b/dirsrvtests/tests/tickets/ticket47815_test.py
@@ -16,6 +16,10 @@ from lib389._constants import *
from lib389.topologies import topology_st
log = logging.getLogger(__name__)
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.3'), reason="Not implemented")
def test_ticket47815(topology_st):
diff --git a/dirsrvtests/tests/tickets/ticket47819_test.py b/dirsrvtests/tests/tickets/ticket47819_test.py
index 555ce67..cc00921 100644
--- a/dirsrvtests/tests/tickets/ticket47819_test.py
+++ b/dirsrvtests/tests/tickets/ticket47819_test.py
@@ -17,6 +17,10 @@ log = logging.getLogger(__name__)
def test_ticket47819(topology_st):
"""
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.4'), reason="Not implemented")
Testing precise tombstone purging:
[1] Make sure "nsTombstoneCSN" is added to new tombstones
[2] Make sure an import of a replication ldif adds "nsTombstoneCSN"
diff --git a/dirsrvtests/tests/tickets/ticket47823_test.py b/dirsrvtests/tests/tickets/ticket47823_test.py
index 92e189b..2beeb25 100644
--- a/dirsrvtests/tests/tickets/ticket47823_test.py
+++ b/dirsrvtests/tests/tickets/ticket47823_test.py
@@ -19,7 +19,10 @@ from lib389._constants import *
from lib389.topologies import topology_st
log = logging.getLogger(__name__)
+from lib389.utils import *
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.3'), reason="Not implemented")
PROVISIONING_CN = "provisioning"
PROVISIONING_DN = "cn=%s,%s" % (PROVISIONING_CN, SUFFIX)
diff --git a/dirsrvtests/tests/tickets/ticket47828_test.py b/dirsrvtests/tests/tickets/ticket47828_test.py
index 8626344..55d65ed 100644
--- a/dirsrvtests/tests/tickets/ticket47828_test.py
+++ b/dirsrvtests/tests/tickets/ticket47828_test.py
@@ -18,6 +18,10 @@ log = logging.getLogger(__name__)
ACCT_POLICY_CONFIG_DN = 'cn=config,cn=%s,cn=plugins,cn=config' % PLUGIN_ACCT_POLICY
ACCT_POLICY_DN = 'cn=Account Inactivation Policy,%s' % SUFFIX
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.3'), reason="Not implemented")
INACTIVITY_LIMIT = '9'
SEARCHFILTER = '(objectclass=*)'
diff --git a/dirsrvtests/tests/tickets/ticket47829_test.py b/dirsrvtests/tests/tickets/ticket47829_test.py
index e585c57..72a42d7 100644
--- a/dirsrvtests/tests/tickets/ticket47829_test.py
+++ b/dirsrvtests/tests/tickets/ticket47829_test.py
@@ -14,7 +14,10 @@ import pytest
from lib389 import Entry
from lib389._constants import *
from lib389.topologies import topology_st
+from lib389.utils import *
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.4'), reason="Not implemented")
SCOPE_IN_CN = 'in'
SCOPE_OUT_CN = 'out'
SCOPE_IN_DN = 'cn=%s,%s' % (SCOPE_IN_CN, SUFFIX)
diff --git a/dirsrvtests/tests/tickets/ticket47833_test.py b/dirsrvtests/tests/tickets/ticket47833_test.py
index e2b38cd..d95c7be 100644
--- a/dirsrvtests/tests/tickets/ticket47833_test.py
+++ b/dirsrvtests/tests/tickets/ticket47833_test.py
@@ -19,6 +19,9 @@ SCOPE_OUT_DN = 'cn=%s,%s' % (SCOPE_OUT_CN, SUFFIX)
PROVISIONING_CN = "provisioning"
PROVISIONING_DN = "cn=%s,%s" % (PROVISIONING_CN, SCOPE_IN_DN)
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.3'), reason="Not implemented")
+
ACTIVE_CN = "accounts"
STAGE_CN = "staged users"
DELETE_CN = "deleted users"
diff --git a/dirsrvtests/tests/tickets/ticket47838_test.py b/dirsrvtests/tests/tickets/ticket47838_test.py
index 1f6f8ce..50924b7 100644
--- a/dirsrvtests/tests/tickets/ticket47838_test.py
+++ b/dirsrvtests/tests/tickets/ticket47838_test.py
@@ -18,6 +18,10 @@ from lib389.topologies import topology_st
log = logging.getLogger(__name__)
CONFIG_DN = 'cn=config'
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.3'), reason="Not implemented")
ENCRYPTION_DN = 'cn=encryption,%s' % CONFIG_DN
MY_SECURE_PORT = '36363'
RSA = 'RSA'
diff --git a/dirsrvtests/tests/tickets/ticket47871_test.py b/dirsrvtests/tests/tickets/ticket47871_test.py
index 826ca44..8d2a49e 100644
--- a/dirsrvtests/tests/tickets/ticket47871_test.py
+++ b/dirsrvtests/tests/tickets/ticket47871_test.py
@@ -21,6 +21,10 @@ from lib389._constants import *
from lib389.topologies import topology_m1c1
logging.getLogger(__name__).setLevel(logging.DEBUG)
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.2'), reason="Not implemented")
log = logging.getLogger(__name__)
TEST_REPL_DN = "cn=test_repl, %s" % SUFFIX
diff --git a/dirsrvtests/tests/tickets/ticket47910_test.py b/dirsrvtests/tests/tickets/ticket47910_test.py
index b51118c..f636950 100644
--- a/dirsrvtests/tests/tickets/ticket47910_test.py
+++ b/dirsrvtests/tests/tickets/ticket47910_test.py
@@ -16,7 +16,10 @@ from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
+from lib389.utils import *
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.4'), reason="Not implemented")
@pytest.fixture(scope="module")
def log_dir(topology_st):
'''
diff --git a/dirsrvtests/tests/tickets/ticket47920_test.py b/dirsrvtests/tests/tickets/ticket47920_test.py
index cd4b7f4..3db5d8d 100644
--- a/dirsrvtests/tests/tickets/ticket47920_test.py
+++ b/dirsrvtests/tests/tickets/ticket47920_test.py
@@ -19,7 +19,10 @@ SCOPE_IN_CN = 'in'
SCOPE_OUT_CN = 'out'
SCOPE_IN_DN = 'cn=%s,%s' % (SCOPE_IN_CN, SUFFIX)
SCOPE_OUT_DN = 'cn=%s,%s' % (SCOPE_OUT_CN, SUFFIX)
+from lib389.utils import *
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.2'), reason="Not implemented")
PROVISIONING_CN = "provisioning"
PROVISIONING_DN = "cn=%s,%s" % (PROVISIONING_CN, SCOPE_IN_DN)
diff --git a/dirsrvtests/tests/tickets/ticket47927_test.py b/dirsrvtests/tests/tickets/ticket47927_test.py
index 1cb20d2..08b10ad 100644
--- a/dirsrvtests/tests/tickets/ticket47927_test.py
+++ b/dirsrvtests/tests/tickets/ticket47927_test.py
@@ -11,6 +11,9 @@ from lib389.tasks import *
from lib389.utils import *
from lib389.topologies import topology_st
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.4'), reason="Not implemented")
+
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
diff --git a/dirsrvtests/tests/tickets/ticket47931_test.py b/dirsrvtests/tests/tickets/ticket47931_test.py
index 7e4964a..9e4d03e 100644
--- a/dirsrvtests/tests/tickets/ticket47931_test.py
+++ b/dirsrvtests/tests/tickets/ticket47931_test.py
@@ -5,6 +5,9 @@ from lib389.tasks import *
from lib389.utils import *
from lib389.topologies import topology_st
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.3'), reason="Not implemented")
+
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
@@ -66,7 +69,7 @@ def test_ticket47931(topology_st):
'nsslapd-dynamic-plugins',
'on')])
except ldap.LDAPError as e:
- ldap.error('Failed to enable dynamic plugins! ' + e.message['desc'])
+ log.error('Failed to enable dynamic plugins! ' + e.message['desc'])
assert False
# Enable the plugins
@@ -93,7 +96,7 @@ def test_ticket47931(topology_st):
'nsslapd-include-suffix',
DEFAULT_SUFFIX)])
except ldap.LDAPError as e:
- ldap.error('Failed to configure retrocl plugin: ' + e.message['desc'])
+ log.error('Failed to configure retrocl plugin: ' + e.message['desc'])
assert False
# Configure memberOf group attribute
diff --git a/dirsrvtests/tests/tickets/ticket48013_test.py b/dirsrvtests/tests/tickets/ticket48013_test.py
index e178a0c..78c6226 100644
--- a/dirsrvtests/tests/tickets/ticket48013_test.py
+++ b/dirsrvtests/tests/tickets/ticket48013_test.py
@@ -13,6 +13,9 @@ from ldap.syncrepl import SyncreplConsumer
from lib389.utils import *
from lib389.topologies import topology_st
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.4'), reason="Not implemented")
+
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
diff --git a/dirsrvtests/tests/tickets/ticket48026_test.py b/dirsrvtests/tests/tickets/ticket48026_test.py
index 5af3d90..c0c31dd 100644
--- a/dirsrvtests/tests/tickets/ticket48026_test.py
+++ b/dirsrvtests/tests/tickets/ticket48026_test.py
@@ -11,6 +11,9 @@ from lib389.tasks import *
from lib389.utils import *
from lib389.topologies import topology_st
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.4'), reason="Not implemented")
+
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
diff --git a/dirsrvtests/tests/tickets/ticket48194_test.py b/dirsrvtests/tests/tickets/ticket48194_test.py
index 773dc95..fb50251 100644
--- a/dirsrvtests/tests/tickets/ticket48194_test.py
+++ b/dirsrvtests/tests/tickets/ticket48194_test.py
@@ -19,6 +19,10 @@ from lib389.topologies import topology_st
log = logging.getLogger(__name__)
CONFIG_DN = 'cn=config'
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.4'), reason="Not implemented")
ENCRYPTION_DN = 'cn=encryption,%s' % CONFIG_DN
RSA = 'RSA'
RSA_DN = 'cn=%s,%s' % (RSA, ENCRYPTION_DN)
diff --git a/dirsrvtests/tests/tickets/ticket48272_test.py b/dirsrvtests/tests/tickets/ticket48272_test.py
index 8f3af70..8cdafa8 100644
--- a/dirsrvtests/tests/tickets/ticket48272_test.py
+++ b/dirsrvtests/tests/tickets/ticket48272_test.py
@@ -11,6 +11,9 @@ else:
logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.6'), reason="Not implemented")
+
USER1 = 'user1'
USER1_DOMAIN = 'user1(a)example.com'
diff --git a/dirsrvtests/tests/tickets/ticket48294_test.py b/dirsrvtests/tests/tickets/ticket48294_test.py
index 260d9f6..df48dc6 100644
--- a/dirsrvtests/tests/tickets/ticket48294_test.py
+++ b/dirsrvtests/tests/tickets/ticket48294_test.py
@@ -94,13 +94,13 @@ def test_48294_init(topology_st):
try:
topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-dynamic-plugins', 'on')])
except ldap.LDAPError as e:
- ldap.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
+ log.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
assert False
try:
topology_st.standalone.plugins.enable(name=PLUGIN_LINKED_ATTRS)
except ValueError as e:
- ldap.fatal('Failed to enable linked attributes plugin!' + e.message['desc'])
+ log.fatal('Failed to enable linked attributes plugin!' + e.message['desc'])
assert False
log.info('Add the plugin config entry')
diff --git a/dirsrvtests/tests/tickets/ticket48295_test.py b/dirsrvtests/tests/tickets/ticket48295_test.py
index db8fc64..d118de4 100644
--- a/dirsrvtests/tests/tickets/ticket48295_test.py
+++ b/dirsrvtests/tests/tickets/ticket48295_test.py
@@ -72,13 +72,13 @@ def test_48295_init(topology_st):
try:
topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-dynamic-plugins', 'on')])
except ldap.LDAPError as e:
- ldap.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
+ log.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
assert False
try:
topology_st.standalone.plugins.enable(name=PLUGIN_LINKED_ATTRS)
except ValueError as e:
- ldap.fatal('Failed to enable linked attributes plugin!' + e.message['desc'])
+ log.fatal('Failed to enable linked attributes plugin!' + e.message['desc'])
assert False
log.info('Add the plugin config entry')
diff --git a/dirsrvtests/tests/tickets/ticket48312_test.py b/dirsrvtests/tests/tickets/ticket48312_test.py
index 36c30d8..bc72a9b 100644
--- a/dirsrvtests/tests/tickets/ticket48312_test.py
+++ b/dirsrvtests/tests/tickets/ticket48312_test.py
@@ -26,7 +26,7 @@ def test_ticket48312(topology_st):
try:
topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-dynamic-plugins', 'on')])
except ldap.LDAPError as e:
- ldap.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
+ log.fatal('Failed to enable dynamic plugin!' + e.message['desc'])
assert False
topology_st.standalone.plugins.enable(name=PLUGIN_MANAGED_ENTRY)
diff --git a/dirsrvtests/tests/tickets/ticket48362_test.py b/dirsrvtests/tests/tickets/ticket48362_test.py
index 10687a3..ab0aaa5 100644
--- a/dirsrvtests/tests/tickets/ticket48362_test.py
+++ b/dirsrvtests/tests/tickets/ticket48362_test.py
@@ -3,6 +3,9 @@ from lib389.tasks import *
from lib389.utils import *
from lib389.topologies import topology_m2
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.4'), reason="Not implemented")
+
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
diff --git a/dirsrvtests/tests/tickets/ticket48366_test.py b/dirsrvtests/tests/tickets/ticket48366_test.py
index 98b191f..90dc6af 100644
--- a/dirsrvtests/tests/tickets/ticket48366_test.py
+++ b/dirsrvtests/tests/tickets/ticket48366_test.py
@@ -17,6 +17,10 @@ from lib389.topologies import topology_st
log = logging.getLogger(__name__)
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.5'), reason="Not implemented")
PROXY_USER_DN = 'cn=proxy,ou=people,%s' % SUFFIX
TEST_USER_DN = 'cn=test,ou=people,%s' % SUFFIX
USER_PW = 'password'
diff --git a/dirsrvtests/tests/tickets/ticket48784_test.py b/dirsrvtests/tests/tickets/ticket48784_test.py
index 0a739f4..d4d7353 100644
--- a/dirsrvtests/tests/tickets/ticket48784_test.py
+++ b/dirsrvtests/tests/tickets/ticket48784_test.py
@@ -8,7 +8,10 @@
#
import pytest
from lib389.tasks import *
+
from lib389.utils import *
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.5'), reason="Not implemented")
from lib389.topologies import topology_m2
logging.getLogger(__name__).setLevel(logging.DEBUG)
diff --git a/dirsrvtests/tests/tickets/ticket48906_test.py b/dirsrvtests/tests/tickets/ticket48906_test.py
index c388feb..aea4227 100644
--- a/dirsrvtests/tests/tickets/ticket48906_test.py
+++ b/dirsrvtests/tests/tickets/ticket48906_test.py
@@ -13,6 +13,10 @@ import shutil
import pytest
from lib389.tasks import *
from lib389.topologies import topology_st
+from lib389.utils import *
+
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.6'), reason="Not implemented")
log = logging.getLogger(__name__)
diff --git a/dirsrvtests/tests/tickets/ticket48916_test.py b/dirsrvtests/tests/tickets/ticket48916_test.py
index 207b355..24a41b0 100644
--- a/dirsrvtests/tests/tickets/ticket48916_test.py
+++ b/dirsrvtests/tests/tickets/ticket48916_test.py
@@ -11,6 +11,9 @@ else:
logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.5'), reason="Not implemented")
+
def _create_user(inst, idnum):
diff --git a/dirsrvtests/tests/tickets/ticket48961_test.py b/dirsrvtests/tests/tickets/ticket48961_test.py
index 2d92ada..8ee18b9 100644
--- a/dirsrvtests/tests/tickets/ticket48961_test.py
+++ b/dirsrvtests/tests/tickets/ticket48961_test.py
@@ -11,6 +11,9 @@ else:
log = logging.getLogger(__name__)
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.6'), reason="Not implemented")
+
def test_ticket48961_storagescheme(topology_st):
"""
diff --git a/dirsrvtests/tests/tickets/ticket548_test.py b/dirsrvtests/tests/tickets/ticket548_test.py
index 40b8048..6dd426e 100644
--- a/dirsrvtests/tests/tickets/ticket548_test.py
+++ b/dirsrvtests/tests/tickets/ticket548_test.py
@@ -11,6 +11,9 @@ from lib389.tasks import *
from lib389.utils import *
from lib389.topologies import topology_st
+# Skip on older versions
+pytestmark = pytest.mark.skipif(ds_is_older('1.3.6'), reason="Not implemented")
+
log = logging.getLogger(__name__)
# Assuming DEFAULT_SUFFIX is "dc=example,dc=com", otherwise it does not work... :(
7 years, 1 month
configure.ac m4/cmocka.m4 Makefile.am test/libslapd test/main.c test/test_slapd.h
by William Brown
Makefile.am | 31 ++++++++++++++++++++++++++++++-
configure.ac | 1 +
m4/cmocka.m4 | 33 +++++++++++++++++++++++++++++++++
test/libslapd/pblock/analytics.c | 17 +++++++++++++++++
test/libslapd/test.c | 26 ++++++++++++++++++++++++++
test/main.c | 16 ++++++++++++++++
test/test_slapd.h | 31 +++++++++++++++++++++++++++++++
7 files changed, 154 insertions(+), 1 deletion(-)
New commits:
commit dccf277980b6e5f19b4628bdfc03b40c5bf63412
Author: William Brown <firstyear(a)redhat.com>
Date: Wed Feb 1 10:21:42 2017 +1000
Ticket 49111 - Integrate cmocka skeleton to Directory Server
Bug Description: This adds a skeleton cmocka to Directory Server. This is just
the build and configure components, with a minimal test.c that shows how we
can seperate our test cases for best usage.
Fix Description: Add cmocka and a corresponding enable flag.
https://fedorahosted.org/389/ticket/49111
Author: wibrown
Review by: nhosoi (Thanks!)
diff --git a/Makefile.am b/Makefile.am
index 78248e5..7c7ab0a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,6 +38,14 @@ else
WITH_SYSTEMD = 0
endif
+if WITH_CMOCKA
+CMOCKA_INCLUDES = @cmocka_inc@
+CMOCKA_LINKS = @cmocka_lib@
+else
+CMOCKA_INCLUDES =
+CMOCKA_LINKS =
+endif
+
# these paths are dependent on the settings of prefix and exec_prefix which may be specified
# at make time. So we cannot use AC_DEFINE in the configure.ac because that would set the
# values prior to their being defined. Defining them here ensures that they are properly
@@ -54,7 +62,7 @@ PATH_DEFINES = -DLOCALSTATEDIR="\"$(localstatedir)\"" -DSYSCONFDIR="\"$(sysconfd
-DSBINDIR="\"$(sbindir)\"" -DPLUGINDIR="\"$(serverplugindir)\"" \
-DTEMPLATEDIR="\"$(sampledatadir)\"" -DSYSTEMSCHEMADIR="\"$(systemschemadir)\""
-AM_CPPFLAGS = $(DEBUG_DEFINES) $(GCCSEC_DEFINES) $(ASAN_DEFINES) $(DS_DEFINES) $(DS_INCLUDES) $(PATH_DEFINES) $(SYSTEMD_DEFINES)
+AM_CPPFLAGS = $(DEBUG_DEFINES) $(GCCSEC_DEFINES) $(ASAN_DEFINES) $(DS_DEFINES) $(DS_INCLUDES) $(PATH_DEFINES) $(SYSTEMD_DEFINES) $(CMOCKA_INCLUDES)
PLUGIN_CPPFLAGS = $(AM_CPPFLAGS) @openldap_inc@ @ldapsdk_inc@ @nss_inc@ @nspr_inc@ @systemd_inc@
# We need to make sure that libpthread is linked before libc on HP-UX.
if HPUX
@@ -1826,6 +1834,27 @@ rsearch_bin_SOURCES = ldap/servers/slapd/tools/rsearch/nametable.c \
rsearch_bin_CPPFLAGS = $(AM_CPPFLAGS) @openldap_inc@ @ldapsdk_inc@ @nss_inc@ @nspr_inc@
rsearch_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBSOCKET)
+#-------------------------
+# CMOCKA TEST PROGRAMS
+#-------------------------
+if WITH_CMOCKA
+
+check_PROGRAMS = test_slapd
+
+test_slapd_SOURCES = test/main.c \
+ test/libslapd/test.c \
+ test/libslapd/pblock/analytics.c
+test_slapd_LDADD = libslapd.la
+test_slapd_LDFLAGS = $(AM_CPPFLAGS) $(CMOCKA_LINKS)
+test_slapd_CPPFLAGS = $(AM_CPPFLAGS) @nspr_inc@
+
+
+
+endif
+#------------------------
+# end cmocka tests
+#------------------------
+
# these are for the config files and scripts that we need to generate and replace
# the paths and other tokens with the real values set during configure/make
# note that we cannot just use AC_OUTPUT to do this for us, since it will do things like this:
diff --git a/configure.ac b/configure.ac
index d07e00f..38e6480 100644
--- a/configure.ac
+++ b/configure.ac
@@ -688,6 +688,7 @@ m4_include(m4/pcre.m4)
m4_include(m4/selinux.m4)
m4_include(m4/nunc-stans.m4)
m4_include(m4/systemd.m4)
+m4_include(m4/cmocka.m4)
PACKAGE_BASE_VERSION=`echo $PACKAGE_VERSION | awk -F\. '{print $1"."$2}'`
AC_SUBST(PACKAGE_BASE_VERSION)
diff --git a/m4/cmocka.m4 b/m4/cmocka.m4
new file mode 100644
index 0000000..bb7d4d3
--- /dev/null
+++ b/m4/cmocka.m4
@@ -0,0 +1,33 @@
+## BEGIN COPYRIGHT BLOCK
+## Copyright (c) 2016, William Brown <william at blackhats dot net dot au>
+## All rights reserved.
+##
+## License: License: GPL (version 3 or any later version).
+## See LICENSE for details.
+## END COPYRIGHT BLOCK
+
+AC_MSG_CHECKING(for --enable-cmocka)
+AC_ARG_ENABLE(cmocka, AS_HELP_STRING([--enable-cmocka], [Enable cmocka based tests (default: no)]),
+[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([WITH_CMOCKA], [1], [With cmocka unit tests])
+ with_cmocka="yes"
+ AC_MSG_CHECKING(for cmocka)
+ if $PKG_CONFIG --exists cmocka; then
+ cmocka_inc=`$PKG_CONFIG --cflags cmocka`
+ cmocka_lib=`$PKG_CONFIG --libs cmocka`
+ AC_MSG_RESULT([using system cmocka])
+ else
+ AC_MSG_ERROR([pkg-config could not find cmocka!])
+ fi
+],
+[
+ AC_MSG_RESULT(no)
+ with_cmocka="0"
+])
+
+AM_CONDITIONAL([WITH_CMOCKA], [test "$with_cmocka" = "yes"])
+AC_SUBST(cmocka_inc)
+AC_SUBST(cmocka_lib)
+
+
diff --git a/test/libslapd/pblock/analytics.c b/test/libslapd/pblock/analytics.c
new file mode 100644
index 0000000..2493299
--- /dev/null
+++ b/test/libslapd/pblock/analytics.c
@@ -0,0 +1,17 @@
+
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright (C) 2017 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * License: GPL (version 3 or any later version).
+ * See LICENSE for details.
+ * END COPYRIGHT BLOCK **/
+
+#include "../../test_slapd.h"
+
+void
+test_libslapd_pblock_analytics(void **state __attribute__((unused))) {
+ /* It works! */
+ assert_int_equal(1, 1);
+}
+
diff --git a/test/libslapd/test.c b/test/libslapd/test.c
new file mode 100644
index 0000000..62831c6
--- /dev/null
+++ b/test/libslapd/test.c
@@ -0,0 +1,26 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright (C) 2017 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * License: GPL (version 3 or any later version).
+ * See LICENSE for details.
+ * END COPYRIGHT BLOCK **/
+
+#include "../test_slapd.h"
+
+void
+test_libslapd_hello(void **state __attribute__((unused))) {
+ /* It works! */
+ assert_int_equal(1, 1);
+}
+
+int
+run_libslapd_tests (void) {
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_libslapd_hello),
+ cmocka_unit_test(test_libslapd_pblock_analytics),
+ };
+ return cmocka_run_group_tests(tests, NULL, NULL);
+}
+
+
diff --git a/test/main.c b/test/main.c
new file mode 100644
index 0000000..d84f8df
--- /dev/null
+++ b/test/main.c
@@ -0,0 +1,16 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright (C) 2017 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * License: GPL (version 3 or any later version).
+ * See LICENSE for details.
+ * END COPYRIGHT BLOCK **/
+
+#include "test_slapd.h"
+
+int
+main ( int argc __attribute__((unused)), char **argv __attribute__((unused))) {
+ int result = 0;
+ result += run_libslapd_tests();
+ return result;
+}
diff --git a/test/test_slapd.h b/test/test_slapd.h
new file mode 100644
index 0000000..1f35b7f
--- /dev/null
+++ b/test/test_slapd.h
@@ -0,0 +1,31 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright (C) 2017 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * License: GPL (version 3 or any later version).
+ * See LICENSE for details.
+ * END COPYRIGHT BLOCK **/
+
+#pragma once
+
+#include <config.h>
+#include <slapi-plugin.h>
+
+/* For cmocka */
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+/* Test runners */
+int run_libslapd_tests (void);
+
+/* == The tests == */
+
+/* libslapd */
+void test_libslapd_hello(void **state);
+
+/* libslapd-pblock-analytics */
+void test_libslapd_pblock_analytics(void **state);
+
+
7 years, 1 month