Run the json tests when loading no files in r2 ##tests

This commit is contained in:
pancake 2024-06-12 15:16:10 +02:00 committed by pancake
parent f98a9b7559
commit 8c723d1df8
8 changed files with 41 additions and 34 deletions

View File

@ -1403,9 +1403,6 @@ R_API R2RTestResultInfo *r2r_run_test(R2RRunConfig *config, R2RTest *test) {
R2RJsonTest *json_test = test->json_test;
R2RProcessOutput *out = r2r_run_json_test (config, json_test, subprocess_runner, NULL);
success = r2r_check_json_test (out, json_test);
#define TEST_JSON_WITH_NO_FILES 0
#if TEST_JSON_WITH_NO_FILES
// R2_590 - enable these tests
if (strchr (json_test->cmd, '@')) {
// ignore json tests with @ when running r2 with no files
} else {
@ -1416,7 +1413,6 @@ R_API R2RTestResultInfo *r2r_run_test(R2RRunConfig *config, R2RTest *test) {
success = false;
}
}
#endif
ret->proc_out = out;
ret->timeout = out->timeout;
ret->run_failed = !out;

View File

@ -105,6 +105,7 @@ static RCoreHelpMessage help_msg_fd = {
"Usage: fd[d]", " [offset|flag|expression]", " # Describe flags",
"fd", " $$" , "# describe flag + delta for given offset",
"fd.", " $$", "# check flags in current address (no delta)",
"fdj", " $$", "# describe current flag in json",
"fdd", " $$", "# describe flag without space restrictions",
"fdw", " [string]", "# filter closest flag by string for current offset",
NULL
@ -1756,6 +1757,8 @@ rep:
}
}
}
} else if (input[1] == 'j') {
r_cons_println ("{}");
}
}
break;

View File

@ -974,6 +974,8 @@ static void cmd_open_map(RCore *core, const char *input) {
map->delta, r_io_map_begin (map), r_io_map_to (map),
r_str_rwx_i (map->perm), r_str_get (map->name));
}
} else if (input[2] == 'j') {
r_cons_println ("{}");
}
break;
case 'r': // "omr"

View File

@ -4038,6 +4038,9 @@ static bool cmd_print_blocks(RCore *core, const char *input) {
list = r_core_get_boundaries_prot (core, -1, NULL, "search");
if (!list) {
result = true;
if (mode == 'j') {
r_cons_println ("{}");
}
goto cleanup;
}
RListIter *iter;
@ -4057,6 +4060,9 @@ static bool cmd_print_blocks(RCore *core, const char *input) {
ut64 piece = R_MAX ((to - from) / R_MAX (cols, w), 1);
as = r_core_anal_get_stats (core, from, to, piece);
if (!as) {
if (mode == 'j') {
r_cons_println ("{}");
}
goto cleanup;
}

26
test/db/json/cmd_i Normal file
View File

@ -0,0 +1,26 @@
# iSj
icj
idj
iEj
iej
ihj
# iIj
iij
ij
# ilj
iLj
# iMj
# imj
iRj
# irj
# iSj
is.j @ 0xffffffffffffffff
isj
iSj entropy
iSj sha1
# iSSj
# itj
# iVj
# izj
izzj
iZj

View File

@ -1,4 +1,3 @@
iSj
&j
/ad/j push rbp
/adj push rbp

View File

@ -16,7 +16,7 @@ dbj
dbtj
dkj
dLj
dmhj
# dmhj
dmj
dplj
drj
@ -29,8 +29,8 @@ fj
fdj
fd.j
fsj
iaj
iAj
iCj
# iaj
# iAj
# iCj
tj
ttj

View File

@ -1,28 +1,3 @@
icj
idj
iEj
iej
ihj
iIj
iij
ij
ilj
iLj
iMj
imj
iRj
irj
iSj
is.j @ 0xffffffffffffffff
isj
iSj entropy
iSj sha1
iSSj
itj
iVj
izj
izzj
iZj
Lcj
# Lsj
obj