summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tests/common_dom.c8
-rw-r--r--src/tests/simple_access-tests.c14
-rw-r--r--src/tests/sysdb-tests.c17
3 files changed, 12 insertions, 27 deletions
diff --git a/src/tests/common_dom.c b/src/tests/common_dom.c
index 00e7f5ae..661271d3 100644
--- a/src/tests/common_dom.c
+++ b/src/tests/common_dom.c
@@ -156,6 +156,14 @@ void test_dom_suite_cleanup(const char *tests_path,
errno, strerror(errno)));
}
+ errno = 0;
+ ret = rmdir(tests_path);
+ if (ret != 0) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Could not delete the test dir (%d) (%s)\n",
+ errno, strerror(errno)));
+ }
+
talloc_free(conf_db);
talloc_free(sys_db);
}
diff --git a/src/tests/simple_access-tests.c b/src/tests/simple_access-tests.c
index 4c784002..48ebea6f 100644
--- a/src/tests/simple_access-tests.c
+++ b/src/tests/simple_access-tests.c
@@ -540,7 +540,6 @@ int main(int argc, const char *argv[])
int opt;
poptContext pc;
int number_failed;
- int ret;
struct poptOption long_options[] = {
POPT_AUTOHELP
@@ -573,17 +572,8 @@ int main(int argc, const char *argv[])
number_failed = 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;
+ if (number_failed == 0) {
+ test_dom_suite_cleanup(TESTS_PATH, TEST_CONF_FILE, LOCAL_SYSDB_FILE);
}
return (number_failed==0 ? EXIT_SUCCESS : EXIT_FAILURE);
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index b30f2ed4..db2d903d 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -5293,20 +5293,7 @@ int main(int argc, const char *argv[]) {
failure_count = srunner_ntests_failed(sr);
srunner_free(sr);
if (failure_count == 0 && !no_cleanup) {
- 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;
+ test_dom_suite_cleanup(TESTS_PATH, TEST_CONF_FILE, LOCAL_SYSDB_FILE);
}
- return EXIT_FAILURE;
+ return (failure_count==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}