Convert ONE_STREAM tests to EXPECT_ERR (#15979)

This commit is contained in:
Khairul Azhar Kasmiran 2020-02-16 22:41:09 +08:00 committed by GitHub
parent cf09972367
commit 20c642ceb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 18 deletions

View File

@ -1037,8 +1037,7 @@ pd 1 @ 0x00400463
EOF
RUN
NAME=bin.str.enc alias and error handling
ONE_STREAM=1
NAME=bin.str.enc alias
FILE=../bins/elf/strenc
CMDS=<<EOF
e asm.filter=false
@ -1053,11 +1052,9 @@ e str.escbslash=true
pd 1 @ 0x004016c0
.(test_str.enc utf32-le)
pd 1 @ 0x004016ed
.(test_str.enc cat_sat_on_keyboard)
?e
.(test_str.enc UTF32BE)
.(test_str.enc UTF16-LE)
.(test_str.enc CAT_SAT_ON_KEYBOARD)
EOF
EXPECT=<<EOF
guess
@ -1066,13 +1063,30 @@ utf16le
0x004016c0 mov edi, 0x40230c ; u"\u2520\u2542\u2500\u2500\u2542\u2528 is a fence with embedded zeros\n"
utf32le
0x004016ed mov edi, 0x40258c ; U"utf32le> \\u00a2\\u20ac\\U00010348 in cyan:\x1b[36m \xa2\u20ac\U00010348 \x1b[0m\n"
Unknown encoding: cat_sat_on_keyboard
utf32le
utf32be
utf16le
EOF
RUN
NAME=bin.str.enc error handling
# Unbreak this and r2r.v goes XX
BROKEN=1
FILE=-
CMDS=<<EOF
(test_str.enc enc, e bin.str.enc=$0, e bin.str.enc)
.(test_str.enc UTF-32LE)
.(test_str.enc cat_sat_on_keyboard)
.(test_str.enc CAT_SAT_ON_KEYBOARD)
EOF
EXPECT=<<EOF
utf32le
utf32le
utf32le
EOF
EXPECT_ERR=<<EOF
Unknown encoding: cat_sat_on_keyboard
Unknown encoding: CAT_SAT_ON_KEYBOARD
utf16le
EOF
RUN

View File

@ -455,20 +455,23 @@ RUN
NAME=pf?
FILE=-
ONE_STREAM=1
CMDS=<<EOF
pfo elf32
pf?elf_header
pf? elf_header
pf?pe_header
EOF
EXPECT=<<EOF
?[2]E[2]E[4]Exxxxwwwwww (elf_ident)ident (elf_type)type (elf_machine)machine (elf_obj_version)version entry phoff shoff flags ehsize phentsize phnum shentsize shnum shstrndx
?[2]E[2]E[4]Exxxxwwwwww (elf_ident)ident (elf_type)type (elf_machine)machine (elf_obj_version)version entry phoff shoff flags ehsize phentsize phnum shentsize shnum shstrndx
Struct pe_header is not defined
EOF
RUN
NAME=pf? struct not defined
FILE=-
CMDS=pf?cat_sat_on_keyboard
EXPECT_ERR=Struct cat_sat_on_keyboard is not defined
RUN
NAME=-nn filename with @
FILE=../bins/elf/analysis/tiny1@invalid_addr
ARGS=-nn

View File

@ -49,7 +49,6 @@ RUN
NAME=@@= `prz` fix
FILE=-
ONE_STREAM=1
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -62,4 +61,6 @@ EXPECT=<<EOF
0x00000003 2033 and byte [rbx], dh
0x00000004 3320 xor esp, dword [rax]
EOF
EXPECT_ERR=<<EOF
EOF
RUN

View File

@ -89,13 +89,6 @@ EXPECT=<<EOF
EOF
RUN
NAME=ONE_STREAM sets scr.onestream
FILE=-
ONE_STREAM=1
CMDS=e scr.onestream
EXPECT=true
RUN
NAME=no-nl-at-eof script
FILE=-
CMDS=!radare2 -i scripts/no-nl-at-eof.r2 -NQ -

29
test/new/db/tools/r2r Normal file
View File

@ -0,0 +1,29 @@
NAME=Only EXPECT_ERR<<EOF
# Unbreak this and r2r.v goes XX
BROKEN=1
FILE=-
CMDS=<<EOF
pf?cat_sat_on_keyboard
pf?CAT_SAT_ON_KEYBOARD
EOF
EXPECT_ERR=<<EOF
Struct cat_sat_on_keyboard is not defined
Struct CAT_SAT_ON_KEYBOARD is not defined
EOF
RUN
NAME=EXPECT<<EOF empty and EXPECT_ERR<<EOF non-empty
# Unbreak this and r2r.v goes XX
BROKEN=1
FILE=-
CMDS=<<EOF
pf?cat_sat_on_keyboard
pf?CAT_SAT_ON_KEYBOARD
EOF
EXPECT=<<EOF
EOF
EXPECT_ERR=<<EOF
Struct cat_sat_on_keyboard is not defined
Struct CAT_SAT_ON_KEYBOARD is not defined
EOF
RUN