summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2009-12-15 10:37:27 +0100
committerStephen Gallagher <sgallagh@redhat.com>2009-12-15 15:37:29 -0500
commit15419ddafb9af79cce99a80ad3d0503d07ada55d (patch)
tree53537e7bbe73b2993654e2b10c769032a3fe0823
parentb6cfa269d29db06855ecad0484315efbd5b97143 (diff)
downloadsssd-15419ddafb9af79cce99a80ad3d0503d07ada55d.tar.gz
sssd-15419ddafb9af79cce99a80ad3d0503d07ada55d.tar.bz2
sssd-15419ddafb9af79cce99a80ad3d0503d07ada55d.zip
Cleanup db files after test run
-rw-r--r--server/Makefile.am2
-rw-r--r--server/tests/sysdb-tests.c21
2 files changed, 21 insertions, 2 deletions
diff --git a/server/Makefile.am b/server/Makefile.am
index 95d78ef8..a7fd8c42 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -417,6 +417,8 @@ sss_groupmod_LDADD = \
# Feature Tests #
#################
if HAVE_CHECK
+sysdb_tests_DEPENDENCIES = \
+ $(ldblib_LTLIBRARIES)
sysdb_tests_SOURCES = \
tests/sysdb-tests.c \
$(SSSD_UTIL_OBJ)
diff --git a/server/tests/sysdb-tests.c b/server/tests/sysdb-tests.c
index 70972cad..ace03439 100644
--- a/server/tests/sysdb-tests.c
+++ b/server/tests/sysdb-tests.c
@@ -31,6 +31,7 @@
#include "db/sysdb_private.h"
#define TESTS_PATH "tests_sysdb"
+#define TEST_CONF_FILE "tests_conf.ldb"
#define TEST_ATTR_NAME "test_attr_name"
#define TEST_ATTR_VALUE "test_attr_value"
@@ -86,7 +87,7 @@ static int setup_sysdb_tests(struct sysdb_test_ctx **ctx)
return EIO;
}
- conf_db = talloc_asprintf(test_ctx, "%s/tests_conf.ldb", TESTS_PATH);
+ conf_db = talloc_asprintf(test_ctx, "%s/%s", TESTS_PATH, TEST_CONF_FILE);
if (conf_db == NULL) {
fail("Out of memory, aborting!");
talloc_free(test_ctx);
@@ -3066,5 +3067,21 @@ int main(int argc, const char *argv[]) {
srunner_run_all(sr, CK_ENV);
failure_count = srunner_ntests_failed(sr);
srunner_free(sr);
- return (failure_count==0 ? EXIT_SUCCESS : EXIT_FAILURE);
+ if (failure_count == 0) {
+ ret = unlink(TESTS_PATH"/"TEST_CONF_FILE);
+ if (ret != EOK) {
+ fprintf(stderr, "Could not delete the test config ldb file (%d) (%s)\n",
+ errno, strerror(errno));
+ return EXIT_FAILURE;
+ }
+ ret = unlink(TESTS_PATH"/"LOCAL_SYSDB_FILE);
+ if (ret != EOK) {
+ fprintf(stderr, "Could not delete the test config ldb file (%d) (%s)\n",
+ errno, strerror(errno));
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
+ }
+ return EXIT_FAILURE;
}