Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-binbin committed Nov 20, 2024
1 parent 4986310 commit 2332728
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
14 changes: 0 additions & 14 deletions src/unit/test_files.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,5 @@ struct unitTestSuite {
char *filename;
unitTest *tests;
} unitTestSuite[] = {
{"test_crc64.c", __test_crc64_c},
{"test_crc64combine.c", __test_crc64combine_c},
{"test_dict.c", __test_dict_c},
{"test_endianconv.c", __test_endianconv_c},
{"test_intset.c", __test_intset_c},
{"test_kvstore.c", __test_kvstore_c},
{"test_listpack.c", __test_listpack_c},
{"test_quicklist.c", __test_quicklist_c},
{"test_rax.c", __test_rax_c},
{"test_sds.c", __test_sds_c},
{"test_sha1.c", __test_sha1_c},
{"test_util.c", __test_util_c},
{"test_ziplist.c", __test_ziplist_c},
{"test_zipmap.c", __test_zipmap_c},
{"test_zmalloc.c", __test_zmalloc_c},
};
11 changes: 10 additions & 1 deletion src/unit/test_util.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#define _BSD_SOURCE
#define _DEFAULT_SOURCE /* For usleep */

#include <sys/mman.h>
#include <string.h>
#include <unistd.h>
Expand Down Expand Up @@ -298,7 +301,13 @@ int test_reclaimFilePageCache(int argc, char **argv, int flags) {
TEST_ASSERT(write(fd, buf, sizeof(buf)) > 0);
TEST_ASSERT(cache_exist(fd));
TEST_ASSERT(valkey_fsync(fd) == 0);
TEST_ASSERT(reclaimFilePageCache(fd, 0, 0) == 0);

for (int i = 0; i < 100; i++) {
int res = reclaimFilePageCache(fd, 0, 0);
printf("reclaimFilePageCache i: %d res: %d\n", i, res);
if (res == 0) break;
usleep(1000000);
}
TEST_ASSERT(!cache_exist(fd));

/* test read file */
Expand Down

0 comments on commit 2332728

Please sign in to comment.