[SSSD] [PATCH] Cleanup db files after test run

Sumit Bose sbose at redhat.com
Tue Dec 15 11:38:24 UTC 2009


Hi,

with this patch the two ldb files created by the sysdb test are deleted
at the end of the test run. With this and the other two distcheck
patches applied 'make distcheck' should run flawlessly (again?).

bye,
Sumit
-------------- next part --------------
>From 10c799457a1161b35c722fc37af9791b9750534a Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Tue, 15 Dec 2009 10:37:27 +0100
Subject: [PATCH] Cleanup db files after test run

---
 server/tests/sysdb-tests.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/server/tests/sysdb-tests.c b/server/tests/sysdb-tests.c
index 70972ca..20808ae 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,17 @@ int main(int argc, const char *argv[]) {
     srunner_run_all(sr, CK_ENV);
     failure_count = srunner_ntests_failed(sr);
     srunner_free(sr);
+    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 (failure_count==0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
-- 
1.6.5.2



More information about the sssd-devel mailing list