MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / main

Function main

src/server.cpp:7456–7849  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7454#endif
7455
7456int main(int argc, char **argv) {
7457 struct timeval tv;
7458 int j;
7459 char config_from_stdin = 0;
7460
7461 std::set_terminate(OnTerminate);
7462
7463 {
7464 SymVer version;
7465 version = parseVersion(KEYDB_REAL_VERSION);
7466 serverAssert(version.major >= 0 && version.minor >= 0 && version.build >= 0);
7467 serverAssert(compareVersion(&version) == VersionCompareResult::EqualVersion);
7468 }
7469
7470#ifdef USE_MEMKIND
7471 storage_init(NULL, 0);
7472#endif
7473
7474#ifdef REDIS_TEST
7475 if (argc >= 3 && !strcasecmp(argv[1], "test")) {
7476 int accurate = 0;
7477 for (j = 3; j < argc; j++) {
7478 if (!strcasecmp(argv[j], "--accurate")) {
7479 accurate = 1;
7480 }
7481 }
7482
7483 if (!strcasecmp(argv[2], "all")) {
7484 int numtests = sizeof(redisTests)/sizeof(struct redisTest);
7485 for (j = 0; j < numtests; j++) {
7486 redisTests[j].failed = (redisTests[j].proc(argc,argv,accurate) != 0);
7487 }
7488
7489 /* Report tests result */
7490 int failed_num = 0;
7491 for (j = 0; j < numtests; j++) {
7492 if (redisTests[j].failed) {
7493 failed_num++;
7494 printf("[failed] Test - %s\n", redisTests[j].name);
7495 } else {
7496 printf("[ok] Test - %s\n", redisTests[j].name);
7497 }
7498 }
7499
7500 printf("%d tests, %d passed, %d failed\n", numtests,
7501 numtests-failed_num, failed_num);
7502
7503 return failed_num == 0 ? 0 : 1;
7504 } else {
7505 redisTestProc *proc = getTestProcByName(argv[2]);
7506 if (!proc) return -1; /* test not found */
7507 return proc(argc,argv,accurate);
7508 }
7509
7510 return 0;
7511 }
7512#endif
7513

Callers

nothing calls this directly

Calls 15

parseVersionFunction · 0.85
compareVersionFunction · 0.85
getTestProcByNameFunction · 0.85
spt_initFunction · 0.85
zmalloc_set_oom_handlerFunction · 0.85
init_genrand64Function · 0.85
crc64_initFunction · 0.85
getRandomHexCharsFunction · 0.85
dictSetHashFunctionSeedFunction · 0.85
checkForSentinelModeFunction · 0.85
initServerConfigFunction · 0.85
aeThreadOnlineFunction · 0.85

Tested by

no test coverage detected