Skip to content
Snippets Groups Projects
Commit f20477a5 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

tests: remove temporary database

parent 184b3270
No related branches found
No related tags found
1 merge request!330Knsupdate pubkey processing fix
......@@ -14,6 +14,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <dirent.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
......@@ -233,7 +234,22 @@ int main(int argc, char *argv[])
namedb_test_set(nkeys, keys, &lmdb_opts, namedb_lmdb_api(), &pool);
namedb_test_set(nkeys, keys, &trie_opts, namedb_trie_api(), &pool);
/* Cleanup */
/* Cleanup. */
mp_delete(pool.ctx);
/* Cleanup temporary DB. */
DIR *dir = opendir(dbid);
struct dirent *dp;
while ((dp = readdir(dir)) != NULL) {
if (dp->d_name[0] == '.') {
continue;
}
char *file = sprintf_alloc("%s/%s", dbid, dp->d_name);
remove(file);
free(file);
}
closedir(dir);
remove(dbid);
return 0;
}
......@@ -14,12 +14,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <dirent.h>
#include <stdlib.h>
#include <time.h>
#include <tap/basic.h>
#include "libknot/internal/namedb/namedb.h"
#include "libknot/internal/namedb/namedb_lmdb.h"
#include "libknot/internal/mem.h"
#include "libknot/errcode.h"
#include "knot/zone/timers.h"
#include "knot/zone/zone.h"
......@@ -119,6 +121,23 @@ int main(int argc, char *argv[])
zone_free(&zone_2);
close_timers_db(db);
// Cleanup temporary DB.
char *timers_dir = sprintf_alloc("%s/timers", dbid);
DIR *dir = opendir(timers_dir);
struct dirent *dp;
while ((dp = readdir(dir)) != NULL) {
if (dp->d_name[0] == '.') {
continue;
}
char *file = sprintf_alloc("%s/%s", timers_dir, dp->d_name);
remove(file);
free(file);
}
closedir(dir);
remove(timers_dir);
free(timers_dir);
remove(dbid);
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment