Handle return code in r2r.v and fix crashing unit test

This commit is contained in:
pancake 2020-02-17 13:54:29 +01:00 committed by radare
parent 306b6f11cd
commit f55c51443d
3 changed files with 14 additions and 2 deletions

View File

@ -355,6 +355,9 @@ R_API bool r_anal_block_merge(RAnalBlock *a, RAnalBlock *b) {
}
R_API void r_anal_block_unref(RAnalBlock *bb) {
if (!bb) {
return;
}
assert (bb->ref > 0);
bb->ref--;
assert (bb->ref >= r_list_length (bb->fcns)); // all of the block's functions must hold a reference to it

View File

@ -1,6 +1,6 @@
-include ../../config-user.mk
VCOMMIT=26cfaa150eae176e64df21566bf86e3d98ec5b17
VCOMMIT=bc977f8d4a86c8e7f4b7a0403a724d0ff6b48bf5
BINDIR=$(shell r2 -H R2_PREFIX)/bin
CWD=$(shell pwd)
V=v/v

View File

@ -52,7 +52,7 @@ pub fn main() {
show_help := fp.bool_('help', `h`, false, 'Show this help screen')
r2r.jobs = fp.int_('jobs', `j`, default_jobs, 'Spawn N jobs in parallel to run tests ($default_jobs).' +
' Set to 0 for 1 job per test.')
r2r.timeout = fp.int_('timeout', `t`, default_timeout, 'How much time to wait to consider a fail ($default_timeout}')
r2r.timeout = fp.int_('timeout', `t`, default_timeout, 'How much time to wait to consider a fail ($default_timeout)')
show_version := fp.bool_('version', `v`, false, 'Show version information')
r2r.r2r_home = r2r_home()
r2r.show_quiet = fp.bool_('quiet', `q`, false, 'Silent output of OK tests')
@ -109,6 +109,8 @@ pub fn main() {
r2r.run_tests()
r2r.show_report()
}
rc := r2r.return_code()
exit(rc)
}
fn (r2r mut R2R) run_tests() {
@ -162,6 +164,13 @@ mut:
filter_by_files []string
}
fn (r2r R2R)return_code() int {
if r2r.failed == 0 {
return 0
}
return 1
}
struct R2RCmdTest {
mut:
name string