From 5c40817fa0a2bdef5de880f8d0bbc1eff4d950c2 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Fri, 8 Apr 2022 09:20:01 +0200 Subject: [PATCH] sadc: Add new non regression tests Test ill-formed datafiles. Signed-off-by: Sebastien GODARD --- tests/00730 | 6 ++++++ tests/00732 | 3 +++ tests/TLIST | 4 ++++ tests/data-12.6.0-file_act-MAP_SIZE_types_nr-err | Bin 0 -> 448 bytes tests/data-12.6.0-file_act-nr-0-err | Bin 0 -> 448 bytes tests/data-12.6.0-file_act-nr-err | Bin 0 -> 448 bytes tests/data-12.6.0-file_act-nr-nr_max-err | Bin 0 -> 448 bytes tests/data-12.6.0-file_act-nr2-0-err | Bin 0 -> 448 bytes tests/data-12.6.0-file_act-nr2-err | Bin 0 -> 448 bytes tests/data-12.6.0-file_act-size-0-err | Bin 0 -> 448 bytes tests/data-12.6.0-file_act-size-err | Bin 0 -> 448 bytes tests/data-12.6.0-file_act-types_nr-SARerr | Bin 0 -> 448 bytes ...data-12.6.0-file_hdr-MAP_SIZE_act_types_nr-err | Bin 0 -> 448 bytes ...data-12.6.0-file_hdr-MAP_SIZE_rec_types_nr-err | Bin 0 -> 448 bytes tests/data-12.6.0-file_hdr-act_size-err | Bin 0 -> 448 bytes tests/data-12.6.0-file_hdr-rec_size-err | Bin 0 -> 448 bytes tests/data-12.6.0-file_hdr-sa_act_nr-err | Bin 0 -> 448 bytes 17 files changed, 13 insertions(+) create mode 100755 tests/00730 create mode 100755 tests/00732 create mode 100644 tests/data-12.6.0-file_act-MAP_SIZE_types_nr-err create mode 100644 tests/data-12.6.0-file_act-nr-0-err create mode 100644 tests/data-12.6.0-file_act-nr-err create mode 100644 tests/data-12.6.0-file_act-nr-nr_max-err create mode 100644 tests/data-12.6.0-file_act-nr2-0-err create mode 100644 tests/data-12.6.0-file_act-nr2-err create mode 100644 tests/data-12.6.0-file_act-size-0-err create mode 100644 tests/data-12.6.0-file_act-size-err create mode 100644 tests/data-12.6.0-file_act-types_nr-SARerr create mode 100644 tests/data-12.6.0-file_hdr-MAP_SIZE_act_types_nr-err create mode 100644 tests/data-12.6.0-file_hdr-MAP_SIZE_rec_types_nr-err create mode 100644 tests/data-12.6.0-file_hdr-act_size-err create mode 100644 tests/data-12.6.0-file_hdr-rec_size-err create mode 100644 tests/data-12.6.0-file_hdr-sa_act_nr-err diff --git a/tests/00730 b/tests/00730 new file mode 100755 index 0000000..8b9d882 --- /dev/null +++ b/tests/00730 @@ -0,0 +1,6 @@ +for file in `ls -1 tests/data-*-err`; do + echo -n "Testing ${file}... "; + LC_ALL=C ./sadf -H $file 2>&1 | grep "Invalid system" >/dev/null && echo "OK" || exit 1; +done + + diff --git a/tests/00732 b/tests/00732 new file mode 100755 index 0000000..b76af13 --- /dev/null +++ b/tests/00732 @@ -0,0 +1,3 @@ +# Should be OK with sadf, and generate an error with sar +LC_ALL=C ./sadf -H tests/data-12.6.0-file_act-types_nr-SARerr >/dev/null && ./sar -f tests/data-12.6.0-file_act-types_nr-SARerr 2>&1 | grep "Invalid system" >/dev/null + diff --git a/tests/TLIST b/tests/TLIST index b40772c..191611d 100644 --- a/tests/TLIST +++ b/tests/TLIST @@ -168,6 +168,10 @@ NOTES: 00720 LC_ALL=C TZ=GMT ./sar -w -f tests/data32-ssr.tmp > tests/out.sar32-ssr.tmp 00725 LC_ALL=C TZ=GMT ./sar -A -f tests/data32-ssr.tmp >/dev/null +===== Testing ill-formed datafiles +00730 LC_ALL=C ./sadf -H $file 2>&1 | grep "Invalid system" >/dev/null && echo "OK" || exit 1; +00732 LC_ALL=C ./sadf -H tests/data-12.6.0-file_act-types_nr-SARerr >/dev/null && ./sar -f tests/data-12.6.0-file_act-types_nr-SARerr 2>&1 | grep "Invalid system" >/dev/null + ===== Reading datafile with non printable chrs in comment (created using hexedit) 00740 LC_ALL=C TZ=GMT ./sar -C -f tests/data-non-printable > tests/out.sar-non-printable.tmp diff --git a/tests/data-12.6.0-file_act-MAP_SIZE_types_nr-err b/tests/data-12.6.0-file_act-MAP_SIZE_types_nr-err new file mode 100644 index 0000000000000000000000000000000000000000..a0aa237ebe7df011989582cb6985621d3107c825 GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnHNvpthQ8d9LTIDs_CtSTrUM1jPZpnQ;=3J^;` z`OM55KACx?6;Li&R1U}hT|>Q${M=Ns3^3I*G|@A(&^0tL&`V1;HrA`KFpD=cA>J%f d)nl0K>>2_Q1BFvJ5X0gGBq{*JAaPh20stt^6jlHL literal 0 HcmV?d00001 diff --git a/tests/data-12.6.0-file_act-nr-0-err b/tests/data-12.6.0-file_act-nr-0-err new file mode 100644 index 0000000000000000000000000000000000000000..706c4a1baa673881f4ffb7ad27d11030f63829da GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnHB(>;?w8d9LTIDs_CtSTrUM1jPZpnQ;=3J^;` z`OM55KACx?6;Li&R1U}hT|>Q${M=Ns3^3I*G|@A(&^0tL&`V1;HrA`KFpD=cA>J%f c)nl0K>>2_Q1BFvJR2mdkARqw5AU2E-0BDjFe*gdg literal 0 HcmV?d00001 diff --git a/tests/data-12.6.0-file_act-nr-err b/tests/data-12.6.0-file_act-nr-err new file mode 100644 index 0000000000000000000000000000000000000000..526f14f14169dcb400c9efa37031b519232db5f9 GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnH|8JDhFhMuAyE=er_sR2AJv@n&=r?=o%Ur=%pna8|zhAn8ll!5N{T# f>M=}qb`61ufx@X9h=JiG017J*5CCEj8^#9!tI`w= literal 0 HcmV?d00001 diff --git a/tests/data-12.6.0-file_act-nr-nr_max-err b/tests/data-12.6.0-file_act-nr-nr_max-err new file mode 100644 index 0000000000000000000000000000000000000000..06b57fe2a7c188ab1b17e7dfe8e89e929da7882c GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnI=GCh+(8d9LTIDs_CtSTrUM1jPZpnQ;=3J^;` z`OM55KACx?6;Li&R1U}hT|>Q${M=Ns3^3I*G|@A(&^0tL&`V1;HrA`KFpD=cA>J%f d)nl0K>>2_Q1BFvJ5QAt?Sb=~55QEq-J^)qZ6m$Rp literal 0 HcmV?d00001 diff --git a/tests/data-12.6.0-file_act-nr2-0-err b/tests/data-12.6.0-file_act-nr2-0-err new file mode 100644 index 0000000000000000000000000000000000000000..b15406512549d91ce24b96c8468edf82238bc925 GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnHn8JDhFhMuAyE=er_sR2AJv@n&=r?=o%Ur=%pna8|zhAn8ll!5N{T# c>M=}qb`61ufx@X9h(X~50|Gz>hz}D301kZ=K>z>% literal 0 HcmV?d00001 diff --git a/tests/data-12.6.0-file_act-nr2-err b/tests/data-12.6.0-file_act-nr2-err new file mode 100644 index 0000000000000000000000000000000000000000..50f2e9e8186a2a67d18d4ad4c708b99e3ae196c1 GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnHlGCY$&8d9LTIDs_CtSTrUM1jPZpnQ;=3J^;` z`OM55KACx?6;Li&R1U}hT|>Q${M=Ns3^3I*G|@A(&^0tL&`V1;HrA`KFpD=cA>J%f d)nl0K>>2_Q1BFvJ5QF1H03rsWzQ${M=Ns3^3I*G|@A(&^0tL&`V1;HrA`KFpD=cA>J%f Y)nl0K>>2_Q1BFvJ5X0gGrV^PC0Gs_3lmGw# literal 0 HcmV?d00001 diff --git a/tests/data-12.6.0-file_act-size-err b/tests/data-12.6.0-file_act-size-err new file mode 100644 index 0000000000000000000000000000000000000000..e02c63faae0d4195bbcb49aefcbbf3c5f86a9d34 GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnIvnVv}?4JlAvoIo06Ruz;FqCjFyP(Dab1&Ae} zd}d}2pUk|{3MiK>DhFhMuAyE=er_sR2AJv@n&=r?=o%Ur=%pna8|zhAn8ll!5N{T# a>M=}qb`61ufx@X9h+%O85@lpTQ${M=Ns3^3I*G|@A(&^0tL&`V1;HrA`KFpD=cA>J%f c)nl0K>>2_Q1BFvJ5X0gGBq{(RfB+VT05AI#SpWb4 literal 0 HcmV?d00001 diff --git a/tests/data-12.6.0-file_hdr-MAP_SIZE_act_types_nr-err b/tests/data-12.6.0-file_hdr-MAP_SIZE_act_types_nr-err new file mode 100644 index 0000000000000000000000000000000000000000..fd93b8d43a0d5a4397a799ae144101f1ff836b82 GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnI&QazJE8d9LTIDs_CtSTrCVsim86A*&{h_3>~ z5+Du`Ff()bWagDtKzQVlIUoac4fQheb5qGO!Bo%CM9FSg*puEZ)q7 fc(X`Vk72U2YY0RP6i(eh3<@U@1_1#eM&<(mC3qB4 literal 0 HcmV?d00001 diff --git a/tests/data-12.6.0-file_hdr-MAP_SIZE_rec_types_nr-err b/tests/data-12.6.0-file_hdr-MAP_SIZE_rec_types_nr-err new file mode 100644 index 0000000000000000000000000000000000000000..43134b891ef57bc2437e077343acb373839f8a60 GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnI0sh&w74JlAvoIo06Ruz;FqCjHIKnxOR0%8>) zmH=W9U}om<$;>OQfbhs8b3g{@8tP@_=cbZnf~lUNiJqZ_uAzZ}URtuTv0jCRS-hDE c@n(^#9>Zj3*AR#pD15qs7#1fWQ2{hQ0L-Bj6#xJL literal 0 HcmV?d00001 diff --git a/tests/data-12.6.0-file_hdr-act_size-err b/tests/data-12.6.0-file_hdr-act_size-err new file mode 100644 index 0000000000000000000000000000000000000000..127c05cff14b0f805780b8cc33ffa22791442c36 GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnIA(>#+v8d9LTIDs_CtSTrUM1jPZpnR}hEDQ`1 zP(Cv=hfii+X$6!^7L@}sK-W+&BR@BlECWpS3{CV5Ep!bH4D`~Hjg9pxEX?A~Oo%s& ZRP`7pJG+KJ#6aQH4aBfG0f`Er@c|}J6ixsD literal 0 HcmV?d00001 diff --git a/tests/data-12.6.0-file_hdr-rec_size-err b/tests/data-12.6.0-file_hdr-rec_size-err new file mode 100644 index 0000000000000000000000000000000000000000..5a739c320bfa1e2be79cfd935895a3932643420b GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnIcQ$3SF8d9LTIDs_CtSTrUM1jPZpnQ;=3J^0w z1(=yRd@}P&E1=S3Q8^$3bPe?~@^e$kGQd>N&_vJBLf6p1Krb!X*jTT^!Ytm*gm|+^ ZRgYn^vug-M3=}NgKn#l$kf;C}9{_986n_8! literal 0 HcmV?d00001 diff --git a/tests/data-12.6.0-file_hdr-sa_act_nr-err b/tests/data-12.6.0-file_hdr-sa_act_nr-err new file mode 100644 index 0000000000000000000000000000000000000000..74b0ef6f76e21a6118a6b9e2af1b4e6e1695c21a GIT binary patch literal 448 zcmbPswN#OZje#M6kpT=q6bSP`xFnGh>7Gd-4JlAvoIsipXjm1L528R~Oi(_^9u**# zfbyA{IeaqnN-LmTvZx%80lJ2I8Tq-XWEo(pXK12lXrXIpV4#