From e2ca84b3ee569a77bfe5d385f765720f880d3687 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sun, 22 Jan 2023 11:48:07 +0100 Subject: [PATCH] Add new non regression tests Signed-off-by: Sebastien GODARD --- tests/01390 | 4 ++++ tests/01392 | 1 + tests/01394 | 4 ++++ tests/01396 | 1 + tests/01950 | 2 +- tests/01952 | 1 + tests/01953 | 1 + tests/01957 | 2 +- tests/01970 | 2 +- tests/01972 | 2 +- tests/01973 | 2 +- tests/01975 | 1 + tests/01976 | 1 + tests/01977 | 1 + tests/TLIST | 23 +++++++++++++++++------ tests/expected.sar-oe | 7 +++++++ tests/expected.sar-oe2 | 6 ++++++ tests/expected2.sadf-se | 6 ++++++ tests/expected2.sar-se | 11 +++++++++++ tests/expected3.sar-se | 6 ++++++ 20 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 tests/01390 create mode 100644 tests/01392 create mode 100644 tests/01394 create mode 100644 tests/01396 create mode 100644 tests/01952 create mode 100644 tests/01953 create mode 100644 tests/01975 create mode 100644 tests/01976 create mode 100644 tests/01977 create mode 100644 tests/expected.sar-oe create mode 100644 tests/expected.sar-oe2 create mode 100644 tests/expected2.sadf-se create mode 100644 tests/expected2.sar-se create mode 100644 tests/expected3.sar-se diff --git a/tests/01390 b/tests/01390 new file mode 100644 index 0000000..3e486e7 --- /dev/null +++ b/tests/01390 @@ -0,0 +1,4 @@ +rm -f tests/sa-oe.tmp +rm -f tests/root +ln -s root1 tests/root +LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -o tests/sa-oe.tmp -e 00:00:06 1 10 > /dev/null diff --git a/tests/01392 b/tests/01392 new file mode 100644 index 0000000..20d07da --- /dev/null +++ b/tests/01392 @@ -0,0 +1 @@ +LC_ALL=C TZ=GMT ./sar -f tests/sa-oe.tmp > tests/out.sar-oe.tmp && diff -u tests/expected.sar-oe tests/out.sar-oe.tmp diff --git a/tests/01394 b/tests/01394 new file mode 100644 index 0000000..ddf3b7b --- /dev/null +++ b/tests/01394 @@ -0,0 +1,4 @@ +rm -f tests/sa-oe2.tmp +rm -f tests/root +ln -s root1 tests/root +LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -o tests/sa-oe2.tmp -e 1556755206 2 > /dev/null diff --git a/tests/01396 b/tests/01396 new file mode 100644 index 0000000..7784055 --- /dev/null +++ b/tests/01396 @@ -0,0 +1 @@ +LC_ALL=C TZ=GMT ./sar -f tests/sa-oe2.tmp > tests/out.sar-oe2.tmp && diff -u tests/expected.sar-oe2 tests/out.sar-oe2.tmp diff --git a/tests/01950 b/tests/01950 index f27655b..d391a94 100644 --- a/tests/01950 +++ b/tests/01950 @@ -1 +1 @@ -LC_ALL=C TZ="America/New_York" ./sar -f tests/data.tmp -e 1590933000 > tests/out.sar-e-epoch.tmp && diff -u tests/expected.sar-e-epoch tests/out.sar-e-epoch.tmp +LC_ALL=C TZ="America/New_York" ./sar -f tests/data.tmp -e 1555595349 > tests/out.sar-e-epoch.tmp && diff -u tests/expected.sar-e-epoch tests/out.sar-e-epoch.tmp diff --git a/tests/01952 b/tests/01952 new file mode 100644 index 0000000..649074e --- /dev/null +++ b/tests/01952 @@ -0,0 +1 @@ +LC_ALL=C ./sar -f tests/data.tmp -s 1555594649 -e 1555593629 2>&1 | grep "Usage:" >/dev/null diff --git a/tests/01953 b/tests/01953 new file mode 100644 index 0000000..c57995a --- /dev/null +++ b/tests/01953 @@ -0,0 +1 @@ +LC_ALL=C ./sadf tests/data.tmp -s 1555594649 -e 1555593629 2>&1 | grep "Usage:" >/dev/null diff --git a/tests/01957 b/tests/01957 index c30e167..fd5e2ab 100644 --- a/tests/01957 +++ b/tests/01957 @@ -1 +1 @@ -LC_ALL=C TZ="Europe/Paris" ./sadf -d tests/data.tmp -T -s 1590933000 > tests/out.sadf-T-s-epoch.tmp && diff -u tests/expected.sadf-T-s-epoch tests/out.sadf-T-s-epoch.tmp +LC_ALL=C TZ="Europe/Paris" ./sadf -d tests/data.tmp -T -s 1555595349 > tests/out.sadf-T-s-epoch.tmp && diff -u tests/expected.sadf-T-s-epoch tests/out.sadf-T-s-epoch.tmp diff --git a/tests/01970 b/tests/01970 index a80a10e..19cca12 100644 --- a/tests/01970 +++ b/tests/01970 @@ -1 +1 @@ -LC_ALL=C ./sadf -d -e foXobXar 2>&1 |grep "No such file" >/dev/null +LC_ALL=C ./sadf -d -e foXobXar 2>&1 | grep "No such file" >/dev/null diff --git a/tests/01972 b/tests/01972 index 982135d..17564c4 100644 --- a/tests/01972 +++ b/tests/01972 @@ -1 +1 @@ -LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob 2>&1 |grep "Usage:" >/dev/null +LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob 2>&1 | grep "Usage:" >/dev/null diff --git a/tests/01973 b/tests/01973 index 47af871..00c5b66 100644 --- a/tests/01973 +++ b/tests/01973 @@ -1 +1 @@ -LC_ALL=C ./sadf -d -e fooba 2>&1 |grep "No such file" >/dev/null +LC_ALL=C ./sadf -d -e fooba 2>&1 | grep "No such file" >/dev/null diff --git a/tests/01975 b/tests/01975 new file mode 100644 index 0000000..5a11bae --- /dev/null +++ b/tests/01975 @@ -0,0 +1 @@ +LC_ALL=C TZ=GMT ./sar -f tests/data.tmp -s 13:20:19 -e 13:54:09 > tests/out2.sar-se.tmp && diff -u tests/expected2.sar-se tests/out2.sar-se.tmp diff --git a/tests/01976 b/tests/01976 new file mode 100644 index 0000000..fc158e6 --- /dev/null +++ b/tests/01976 @@ -0,0 +1 @@ +LC_ALL=C TZ=GMT ./sar -f tests/data.tmp -s 13:20:19 -e 13:20:39 > tests/out3.sar-se.tmp && diff -u tests/expected3.sar-se tests/out3.sar-se.tmp diff --git a/tests/01977 b/tests/01977 new file mode 100644 index 0000000..cddb185 --- /dev/null +++ b/tests/01977 @@ -0,0 +1 @@ +LC_ALL=C TZ=GMT ./sadf -d tests/data.tmp -s 13:20:19 -e 1555595649 > tests/out2.sadf-se.tmp && diff -u tests/expected2.sadf-se tests/out2.sadf-se.tmp diff --git a/tests/TLIST b/tests/TLIST index 9dde679..74c8be4 100644 --- a/tests/TLIST +++ b/tests/TLIST @@ -273,6 +273,12 @@ NOTES: 01380 LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -o tests/sa-sigint.tmp 1 10 > /dev/null [Create binary datafile sa-sigint.tmp. Stop with a simulated Ctrl/C] 01382 LC_ALL=C TZ=GMT ./sar -f tests/sa-sigint.tmp -m CPU > tests/out.sar-sigint.tmp +01390 LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -o tests/sa-oe.tmp -e 00:00:06 1 10 > /dev/null + [Create binary datafile sa-oe.tmp. Ending time takes precedence over count parameter] +01392 LC_ALL=C TZ=GMT ./sar -f tests/sa-oe.tmp > tests/out.sar-oe.tmp +01394 LC_ALL=C TZ=GMT ./sar --unix_time=1556755203 -o tests/sa-oe2.tmp -e 1556755206 2 > /dev/null + [Create binary datafile sa-oe2.tmp. Ending time tells sar when to stop collecting] +01396 LC_ALL=C TZ=GMT ./sar -f tests/sa-oe2.tmp > tests/out.sar-oe2.tmp ===== Testing error cases 01400 LC_ALL=C TZ=GMT ./sar -f tests/data-trunc 2>&1 | grep "End of system activity file unexpected" >/dev/null @@ -342,14 +348,19 @@ NOTES: 01920 LC_ALL=C TZ="America/New_York" ./sadf -r tests/data-tz.tmp -- -uw > tests/out.sadf-r-tz.tmp 01925 LC_ALL=C TZ="America/New_York" ./sadf -r tests/data-tz.tmp -T -- -uw > tests/out.sadf-r-T-tz.tmp 01928 LC_ALL=C TZ="America/New_York" ./sadf -r tests/data-tz.tmp -t -- -uw > tests/out.sadf-r-t-tz.tmp -01950 LC_ALL=C TZ="America/New_York" ./sar -f tests/data.tmp -e 1590933000 > tests/out.sar-e-epoch.tmp +01950 LC_ALL=C TZ="America/New_York" ./sar -f tests/data.tmp -e 1555595349 > tests/out.sar-e-epoch.tmp +01952 LC_ALL=C ./sar -f tests/data.tmp -s 1555594649 -e 1555593629 2>&1 | grep "Usage:" >/dev/null +01953 LC_ALL=C ./sadf tests/data.tmp -s 1555594649 -e 1555593629 2>&1 | grep "Usage:" >/dev/null 01955 LC_ALL=C ./sadf -d tests/data.tmp -s 1590939000 > tests/out.sadf-s-epoch.tmp -01957 LC_ALL=C TZ="Europe/Paris" ./sadf -d tests/data.tmp -T -s 1590933000 > tests/out.sadf-T-s-epoch.tmp +01957 LC_ALL=C TZ="Europe/Paris" ./sadf -d tests/data.tmp -T -s 1555595349 > tests/out.sadf-T-s-epoch.tmp 01960 LC_ALL=C ./sadf -d tests/data.tmp -U -s 1555593629 -e 1555594649 > tests/out.sadf-U-se-epoch.tmp -01965 LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob:ar 2>&1 |grep "Usage:" >/dev/null -01970 LC_ALL=C ./sadf -d -e foXobXar 2>&1 |grep "No such file" >/dev/null -01972 LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob 2>&1 |grep "Usage:" >/dev/null -01973 LC_ALL=C ./sadf -d -e fooba 2>&1 |grep "No such file" >/dev/null +01965 LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob:ar 2>&1 | grep "Usage:" >/dev/null +01970 LC_ALL=C ./sadf -d -e foXobXar 2>&1 | grep "No such file" >/dev/null +01972 LC_ALL=C ./sadf -d tests/data.tmp -s fo:ob 2>&1 | grep "Usage:" >/dev/null +01973 LC_ALL=C ./sadf -d -e fooba 2>&1 | grep "No such file" >/dev/null +01975 LC_ALL=C TZ=GMT ./sar -f tests/data.tmp -s 13:20:19 -e 13:54:09 > tests/out2.sar-se.tmp +01976 LC_ALL=C TZ=GMT ./sar -f tests/data.tmp -s 13:20:19 -e 13:20:39 > tests/out3.sar-se.tmp +01977 LC_ALL=C TZ=GMT ./sadf -d tests/data.tmp -s 13:20:19 -e 1555595649 > tests/out2.sadf-se.tmp ===== iostat tests (basic output) 02010 LC_ALL=C TZ=GMT ./iostat 2 3 > tests/out.iostat.tmp diff --git a/tests/expected.sar-oe b/tests/expected.sar-oe new file mode 100644 index 0000000..fefe7eb --- /dev/null +++ b/tests/expected.sar-oe @@ -0,0 +1,7 @@ +Linux 1.2.3-TEST (SYSSTAT.TEST) 05/02/19 _x86_64_ (9 CPU) + +00:00:03 CPU %user %nice %system %iowait %steal %idle +00:00:04 all 2.15 12.50 2.36 0.12 0.00 82.88 +00:00:05 all 2.28 0.00 1.93 0.48 0.00 95.31 +00:00:06 all 2.67 23.08 2.40 0.17 0.00 71.68 +Average: all 2.40 13.65 2.26 0.23 0.00 81.46 diff --git a/tests/expected.sar-oe2 b/tests/expected.sar-oe2 new file mode 100644 index 0000000..c443fae --- /dev/null +++ b/tests/expected.sar-oe2 @@ -0,0 +1,6 @@ +Linux 1.2.3-TEST (SYSSTAT.TEST) 05/02/19 _x86_64_ (9 CPU) + +00:00:03 CPU %user %nice %system %iowait %steal %idle +00:00:05 all 2.15 12.50 2.36 0.12 0.00 82.88 +00:00:07 all 2.28 0.00 1.93 0.48 0.00 95.31 +Average: all 2.20 7.13 2.17 0.27 0.00 88.22 diff --git a/tests/expected2.sadf-se b/tests/expected2.sadf-se new file mode 100644 index 0000000..c2713c5 --- /dev/null +++ b/tests/expected2.sadf-se @@ -0,0 +1,6 @@ +# hostname;interval;timestamp;CPU;%user;%nice;%system;%iowait;%steal;%idle +SYSSTAT.TEST;31;2019-04-18 13:20:29 UTC;-1;2.28;0.00;1.93;0.48;0.00;95.31 +SYSSTAT.TEST;39;2019-04-18 13:20:39 UTC;-1;2.66;23.20;2.27;0.17;0.00;71.70 +SYSSTAT.TEST;22;2019-04-18 13:20:49 UTC;-1;6.80;8.80;7.53;0.49;0.39;75.90 +SYSSTAT.TEST;-1;2019-04-18 13:37:29 UTC;LINUX-RESTART (9 CPU) +SYSSTAT.TEST;-1;2019-04-18 13:54:09 UTC;LINUX-RESTART (10 CPU) diff --git a/tests/expected2.sar-se b/tests/expected2.sar-se new file mode 100644 index 0000000..e8da822 --- /dev/null +++ b/tests/expected2.sar-se @@ -0,0 +1,11 @@ +Linux 1.2.3-TEST (SYSSTAT.TEST) 04/18/19 _x86_64_ (9 CPU) + +13:20:19 CPU %user %nice %system %iowait %steal %idle +13:20:29 all 2.28 0.00 1.93 0.48 0.00 95.31 +13:20:39 all 2.66 23.20 2.27 0.17 0.00 71.70 +13:20:49 all 6.80 8.80 7.53 0.49 0.39 75.90 +Average: all 4.01 13.45 3.02 0.39 0.00 79.13 + +13:37:29 LINUX RESTART (9 CPU) + +13:54:09 LINUX RESTART (10 CPU) diff --git a/tests/expected3.sar-se b/tests/expected3.sar-se new file mode 100644 index 0000000..23f0a62 --- /dev/null +++ b/tests/expected3.sar-se @@ -0,0 +1,6 @@ +Linux 1.2.3-TEST (SYSSTAT.TEST) 04/18/19 _x86_64_ (9 CPU) + +13:20:19 CPU %user %nice %system %iowait %steal %idle +13:20:29 all 2.28 0.00 1.93 0.48 0.00 95.31 +13:20:39 all 2.66 23.20 2.27 0.17 0.00 71.70 +Average: all 2.52 14.28 2.14 0.29 0.00 80.78 -- 2.40.0