Skip to content

Commit 385ff2a

Browse files
committed
test_store: unlink test files during teardown
…rather than doing it at creation. Fixes: #249
1 parent 45dd26a commit 385ff2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/test_store.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#define TEST_CONTENT_DIR "/dev/shm/clip_store_content_dir_test"
4747

4848
static int create_test_snip_fd(void) {
49-
shm_unlink(TEST_SNIP_FILE);
5049
int snip_fd = shm_open(TEST_SNIP_FILE, O_RDWR | O_CREAT | O_EXCL, 0600);
5150
assert(snip_fd >= 0);
5251
return snip_fd;
@@ -104,7 +103,6 @@ static void remove_test_content_dir(const char *path) {
104103
}
105104

106105
static int create_test_content_dir_fd(void) {
107-
remove_test_content_dir(TEST_CONTENT_DIR);
108106
int ret = mkdir(TEST_CONTENT_DIR, 0700);
109107
assert(ret == 0);
110108
int dir_fd = open(TEST_CONTENT_DIR, O_RDONLY);
@@ -146,7 +144,9 @@ static void drop_teardown_test(struct clip_store *cs) {
146144
int ret = cs_destroy(cs);
147145
assert(ret == 0);
148146
close(snip_fd);
147+
shm_unlink(TEST_SNIP_FILE);
149148
close(content_dir_fd);
149+
remove_test_content_dir(TEST_CONTENT_DIR);
150150
}
151151

152152
static void add_ten_snips(struct clip_store *cs) {

0 commit comments

Comments
 (0)