mirror of
https://github.com/radareorg/radare2.git
synced 2026-05-29 08:29:51 +09:00
Add REQUIRE=little and fix other 32bit/be tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2020-2025 - pancake, thestr4ng3r */
|
||||
/* radare - LGPL - Copyright 2020-2026 - pancake, thestr4ng3r */
|
||||
|
||||
#include "r2r.h"
|
||||
|
||||
@@ -1901,6 +1901,13 @@ static bool require_check(const char *require) {
|
||||
res &= true;
|
||||
#else
|
||||
res &= false;
|
||||
#endif
|
||||
}
|
||||
if (strstr (require, "little")) {
|
||||
#if R_SYS_ENDIAN == 0
|
||||
res &= true;
|
||||
#else
|
||||
res &= false;
|
||||
#endif
|
||||
}
|
||||
if (strstr (require, "gpl")) {
|
||||
|
||||
@@ -167,7 +167,7 @@ Extra arguments passed directly to r2 before
|
||||
and the command block.
|
||||
.It Cm REQUIRE
|
||||
Skip condition string. Supported tokens are
|
||||
.Dq gas , unix , windows , linux , arm , x86 .
|
||||
.Dq gas , unix , windows , linux , arm , x86 , little .
|
||||
Known host tokens are checked at run time; if unsupported, the test is skipped.
|
||||
.It Cm REPEAT
|
||||
Numeric repeat count.
|
||||
|
||||
@@ -414,8 +414,10 @@ agraph.edge.0x123_0x123.highlight=true
|
||||
EOF
|
||||
RUN
|
||||
|
||||
# wont run on big endian because of a bug in capstone
|
||||
NAME=lowaddr lights
|
||||
FILE=bins/elf/elf_one_symbol_shdr
|
||||
REQUIRE=little
|
||||
ARGS=-n
|
||||
CMDS=<<EOF
|
||||
e asm.var.summary=0
|
||||
|
||||
@@ -446,9 +446,8 @@ RUN
|
||||
|
||||
NAME=o: obj
|
||||
FILE=-
|
||||
ARGS=-a x86 -b 64
|
||||
CMDS=<<EOF
|
||||
e asm.arch=x86
|
||||
e asm.bits=64
|
||||
obj~{}
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
|
||||
@@ -641,6 +641,7 @@ RUN
|
||||
|
||||
NAME=newlined-comment-refline fix (#14627), wayward rip-relative flag fixes
|
||||
FILE=bins/elf/ls
|
||||
REQUIRE=little
|
||||
CMDS=<<EOF
|
||||
e asm.bytes=false
|
||||
e asm.sub.names=true
|
||||
@@ -810,6 +811,7 @@ RUN
|
||||
|
||||
NAME=pi no-color rip-relative addr fix
|
||||
FILE=bins/elf/ls
|
||||
REQUIRE=little
|
||||
CMDS=<<EOF
|
||||
e scr.color=0
|
||||
s 0x000041e0
|
||||
|
||||
@@ -190,9 +190,21 @@ bool test_r2r_fix(void) {
|
||||
mu_end;
|
||||
}
|
||||
|
||||
bool test_r2r_require(void) {
|
||||
mu_assert_true (require_check (NULL), "empty requirement");
|
||||
mu_assert_true (require_check (""), "empty requirement");
|
||||
#if R_SYS_ENDIAN == 0
|
||||
mu_assert_true (require_check ("little"), "little endian requirement");
|
||||
#else
|
||||
mu_assert_false (require_check ("little"), "little endian requirement");
|
||||
#endif
|
||||
mu_end;
|
||||
}
|
||||
|
||||
int all_tests(void) {
|
||||
mu_run_test (test_r2r_database_load_cmd);
|
||||
mu_run_test (test_r2r_fix);
|
||||
mu_run_test (test_r2r_require);
|
||||
return tests_passed != tests_run;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user