perf: Make -t following_perf respect the usual db path rules.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 33m33s

This commit is contained in:
Cory McWilliams 2025-05-12 12:41:13 -04:00
parent 35941a7ddc
commit ef58749ce3
3 changed files with 14 additions and 2 deletions

View File

@ -186,8 +186,10 @@ const command_t k_commands[] = {
static int _tf_command_test(const char* file, int argc, char* argv[])
{
#if !defined(__ANDROID__)
const char* default_db_path = _get_db_path();
tf_test_options_t test_options = {
.exe_path = file,
.db_path = default_db_path,
};
bool show_usage = false;
@ -195,10 +197,11 @@ static int _tf_command_test(const char* file, int argc, char* argv[])
{
static const struct option k_options[] = {
{ "tests", required_argument, NULL, 't' },
{ "db-path", required_argument, NULL, 'd' },
{ "help", no_argument, NULL, 'h' },
{ 0 },
};
int c = getopt_long(argc, argv, "t:h", k_options, NULL);
int c = getopt_long(argc, argv, "t:d:h", k_options, NULL);
if (c == -1)
{
break;
@ -214,6 +217,9 @@ static int _tf_command_test(const char* file, int argc, char* argv[])
case 't':
test_options.tests = optarg;
break;
case 'd':
test_options.db_path = optarg;
break;
}
}
@ -229,10 +235,12 @@ static int _tf_command_test(const char* file, int argc, char* argv[])
tf_printf("options\n");
tf_printf(" -t, --tests tests Comma-separated list of tests to run. (default: all)\n");
tf_printf(" -h, --help Show this usage information.\n");
tf_free((void*)default_db_path);
return EXIT_FAILURE;
}
tf_tests(&test_options);
tf_free((void*)default_db_path);
return EXIT_SUCCESS;
#else
return EXIT_FAILURE;

View File

@ -1613,7 +1613,9 @@ void tf_ssb_test_following_perf(const tf_test_options_t* options)
uv_loop_t loop = { 0 };
uv_loop_init(&loop);
tf_ssb_t* ssb = tf_ssb_create(&loop, NULL, "db.sqlite", NULL);
tf_printf("Testing following_perf.\n");
tf_printf("Using %s.\n", options->db_path);
tf_ssb_t* ssb = tf_ssb_create(&loop, NULL, options->db_path, NULL);
uint64_t start = uv_hrtime();
const char** ids = tf_ssb_db_get_all_visible_identities(ssb, 2);

View File

@ -15,6 +15,8 @@ typedef struct _tf_test_options_t
const char* exe_path;
/** A comma-separated list of tests to run, or NULL. */
const char* tests;
/** Path to the actual local database for running performance tests against. */
const char* db_path;
} tf_test_options_t;
/**