logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: 3deb1abcaf37d703d1fa3512014bb6987685ac12
parent 62f01936f78c90e7c5f04dced6b5ece2eb5f6ca1
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 30 Jan 2022 02:21:35 +0100

test-bin: Add tests for bin/strings

Diffstat:

Mtest-bin/Kyuafile4++--
Atest-bin/inputs/strings/true0
Atest-bin/outputs/strings/all_bytes1+
Atest-bin/outputs/strings/true91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atest-bin/strings60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 154 insertions(+), 2 deletions(-)

diff --git a/test-bin/Kyuafile b/test-bin/Kyuafile @@ -2,8 +2,7 @@ syntax(2) test_suite("utils") --- /BEGIN/,$ --- |LC_ALL=C.UTF-8 sort +-- 5,$|LC_ALL=C.UTF-8 sort atf_test_program{name="args"} atf_test_program{name="basename"} atf_test_program{name="cat"} @@ -13,6 +12,7 @@ atf_test_program{name="false"} atf_test_program{name="humanize"} atf_test_program{name="pwd"} atf_test_program{name="sname"} +atf_test_program{name="strings"} atf_test_program{name="tee"} atf_test_program{name="true"} atf_test_program{name="xcd"} diff --git a/test-bin/inputs/strings/true b/test-bin/inputs/strings/true Binary files differ. diff --git a/test-bin/outputs/strings/all_bytes b/test-bin/outputs/strings/all_bytes @@ -0,0 +1 @@ + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ diff --git a/test-bin/outputs/strings/true b/test-bin/outputs/strings/true @@ -0,0 +1,91 @@ +/lib64/ld-linux-x86-64.so.2 +__cxa_finalize +__libc_start_main +libc.so.6 +GLIBC_2.2.5 +_ITM_deregisterTMCloneTable +__gmon_start__ +_ITM_registerTMCloneTable +AUATI +[]A\A]A^A_ +;*3$" +GCC: (Gentoo Hardened 10.3.0-r2 p3) 10.3.0 +GCC: (Gentoo Hardened 11.2.0 p1) 11.2.0 +/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include +elf-init.c +stddef.h +f.... +GNU C99 11.2.0 -mtune=generic -march=x86-64 -g -O2 -std=c99 +main +long long int +GNU C11 10.3.0 -march=znver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-avx512vpopcntdq -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -mtune=znver1 -m64 -ggdb -ggdb -O2 -O2 -std=gnu11 -fgnu89-inline -fmerge-all-constants -frounding-math -fstack-protector-strong -fmath-errno -fno-stack-protector -fPIC -fstack-protector-strong -ftls-model=initial-exec +size_t +__init_array_start +/var/tmp/portage/sys-libs/glibc-2.33-r7/work/glibc-2.33/csu +envp +elf-init.c +long unsigned int +__libc_csu_fini +char +argc +size +__libc_csu_init +argv +long double +__init_array_end +true.c +/home/haelwenn/Sources/git/hacktivis.me/git/utils/bin +true.c +elf-init.c +__init_array_end +_DYNAMIC +__init_array_start +__GNU_EH_FRAME_HDR +_GLOBAL_OFFSET_TABLE_ +__libc_csu_fini +_ITM_deregisterTMCloneTable +_edata +__libc_start_main@GLIBC_2.2.5 +__data_start +__gmon_start__ +__dso_handle +_IO_stdin_used +__libc_csu_init +__bss_start +main +__TMC_END__ +_ITM_registerTMCloneTable +__cxa_finalize@GLIBC_2.2.5 +.symtab +.strtab +.shstrtab +.interp +.note.ABI-tag +.gnu.hash +.dynsym +.dynstr +.gnu.version +.gnu.version_r +.rela.dyn +.init +.plt +.plt.got +.text +.fini +.rodata +.eh_frame_hdr +.eh_frame +.init_array +.fini_array +.dynamic +.data +.bss +.comment +.debug_aranges +.debug_info +.debug_abbrev +.debug_line +.debug_str +.debug_loc +.debug_line_str +.debug_rnglists diff --git a/test-bin/strings b/test-bin/strings @@ -0,0 +1,60 @@ +#!/usr/bin/env atf-sh +atf_test_case allfile +allfile_body() { + atf_check -o file:outputs/strings/all_bytes ../bin/strings inputs/all_bytes +} + +atf_test_case allinput +allinput_body() { + atf_check -o file:outputs/strings/all_bytes ../bin/strings <inputs/all_bytes +} + +atf_test_case alldashinput +alldashinput_body() { + atf_check -o file:outputs/strings/all_bytes ../bin/strings - <inputs/all_bytes +} + +atf_test_case truefile +truefile_body() { + atf_check -o file:outputs/strings/true ../bin/strings inputs/strings/true +} + +atf_test_case trueinput +trueinput_body() { + atf_check -o file:outputs/strings/true ../bin/strings <inputs/strings/true +} + +atf_test_case truedashinput +truedashinput_body() { + atf_check -o file:outputs/strings/true ../bin/strings - <inputs/strings/true +} + +atf_test_case nullfile +nullfile_body() { + atf_check ../bin/strings /dev/null +} + +atf_test_case nullinput +nullinput_body() { + atf_check ../bin/strings </dev/null +} + +atf_test_case nulldashinput +nulldashinput_body() { + atf_check ../bin/strings - </dev/null +} + +atf_init_test_cases() { + cd "$(atf_get_srcdir)" + atf_add_test_case allfile + atf_add_test_case allinput + atf_add_test_case alldashinput + + #atf_add_test_case truefile + #atf_add_test_case trueinput + #atf_add_test_case truedashinput + + atf_add_test_case nullfile + atf_add_test_case nullinput + atf_add_test_case nulldashinput +}