]> granicus.if.org Git - sysstat/commitdiff
systest.c: Fix GCC warnings
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 19 Dec 2020 08:03:56 +0000 (09:03 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 19 Dec 2020 08:03:56 +0000 (09:03 +0100)
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
20 files changed:
systest.c
tests/00050 [moved from tests/00100 with 100% similarity]
tests/00052 [moved from tests/00110 with 100% similarity]
tests/00054 [moved from tests/00120 with 100% similarity]
tests/00055 [moved from tests/00140 with 100% similarity]
tests/00057 [moved from tests/00150 with 100% similarity]
tests/00060 [moved from tests/01000 with 100% similarity]
tests/00062 [moved from tests/01200 with 100% similarity]
tests/00065 [new file with mode: 0644]
tests/00068 [new file with mode: 0644]
tests/00072 [moved from tests/01750 with 100% similarity]
tests/00074 [moved from tests/01800 with 100% similarity]
tests/00080 [new file with mode: 0644]
tests/00710
tests/00712 [deleted file]
tests/00740 [moved from tests/00720 with 100% similarity]
tests/00980
tests/00982 [deleted file]
tests/01010
tests/01012 [deleted file]

index 7277affeeec5be8171c5df3c599c1c086d3e0c3d..acb094a0fe1a2439482197de31724e940a5aebb0 100644 (file)
--- a/systest.c
+++ b/systest.c
@@ -144,7 +144,7 @@ char *get_env_value(const char *c)
 void next_time_step(void)
 {
        int root_nr = 1;
-       char rootf[64], testf[64];
+       char rootf[64], testf[128];
        char *resolved_name;
 
        __unix_time += interval;
@@ -160,8 +160,11 @@ void next_time_step(void)
                exit(1);
        }
 
-       sprintf(rootf, "%s%d", ROOTFILE, ++root_nr);
-       sprintf(testf, "%s/%s", TESTDIR, rootf);
+       snprintf(rootf, sizeof(rootf), "%s%d", ROOTFILE, ++root_nr);
+       rootf[sizeof(rootf) - 1] = '\0';
+       snprintf(testf, sizeof(testf), "%s/%s", TESTDIR, rootf);
+       testf[sizeof(testf) - 1] = '\0';
+
        if (access(testf, F_OK) < 0) {
                if (errno == ENOENT) {
                        /* No more kernel directories: Simulate a Ctrl/C */
similarity index 100%
rename from tests/00100
rename to tests/00050
similarity index 100%
rename from tests/00110
rename to tests/00052
similarity index 100%
rename from tests/00120
rename to tests/00054
similarity index 100%
rename from tests/00140
rename to tests/00055
similarity index 100%
rename from tests/00150
rename to tests/00057
similarity index 100%
rename from tests/01000
rename to tests/00060
similarity index 100%
rename from tests/01200
rename to tests/00062
diff --git a/tests/00065 b/tests/00065
new file mode 100644 (file)
index 0000000..4885a16
--- /dev/null
@@ -0,0 +1,21 @@
+rm -f tests/data1.tmp
+
+rm -f tests/root
+ln -s root6 tests/root
+TZ=GMT ./sadc --unix_time=1555593609 tests/data1.tmp 1 1 >/dev/null
+
+rm -f tests/root
+ln -s root7 tests/root
+TZ=GMT ./sadc --unix_time=1555593619 tests/data1.tmp 1 1 >/dev/null
+
+rm -f tests/root
+ln -s root1 tests/root
+# LINUX RESTART
+TZ=GMT ./sadc --unix_time=1555593623 tests/data1.tmp >/dev/null
+
+TZ=GMT ./sadc --unix_time=1555593629 tests/data1.tmp 1 1 >/dev/null
+
+rm -f tests/root
+ln -s root2 tests/root
+TZ=GMT ./sadc --unix_time=1555593639 tests/data1.tmp 1 1 >/dev/null
+
diff --git a/tests/00068 b/tests/00068
new file mode 100644 (file)
index 0000000..002e0ac
--- /dev/null
@@ -0,0 +1,21 @@
+rm -f tests/data1.tmp
+
+rm -f tests/root
+ln -s root1 tests/root
+TZ=GMT ./sadc --unix_time=1555593609 tests/data1.tmp 1 1 >/dev/null
+
+rm -f tests/root
+ln -s root2 tests/root
+TZ=GMT ./sadc --unix_time=1555593619 tests/data1.tmp 1 1 >/dev/null
+
+# LINUX RESTART
+TZ=GMT ./sadc --unix_time=1555593623 tests/data1.tmp >/dev/null
+
+rm -f tests/root
+ln -s root6 tests/root
+TZ=GMT ./sadc --unix_time=1555593629 tests/data1.tmp 1 1 >/dev/null
+
+rm -f tests/root
+ln -s root7 tests/root
+TZ=GMT ./sadc --unix_time=1555593639 tests/data1.tmp 1 1 >/dev/null
+
similarity index 100%
rename from tests/01750
rename to tests/00072
similarity index 100%
rename from tests/01800
rename to tests/00074
diff --git a/tests/00080 b/tests/00080
new file mode 100644 (file)
index 0000000..5fad1aa
--- /dev/null
@@ -0,0 +1,17 @@
+. tests/variables
+if [ "${TGLIB32}" = "yes" ]; then
+       rm -f tests/data32.tmp
+
+       rm -f tests/root
+       ln -s root1 tests/root
+       TZ=GMT tests/32bits/sadc32 --unix_time=1555593609 -S XALL,-A_PWR_FAN,-A_PWR_IN,-A_PWR_TEMP,-A_PWR_FREQ tests/data32.tmp
+       TZ=GMT tests/32bits/sadc32 --unix_time=1555593619 -C "32 bit datafile" tests/data32.tmp
+
+       TZ=GMT tests/32bits/sadc32 --unix_time=1555593629 -S XALL tests/data32.tmp 1 1 >/dev/null
+
+       rm -f tests/root
+       ln -s root2 tests/root
+       TZ=GMT tests/32bits/sadc32 --unix_time=1555593639 -S XALL tests/data32.tmp 1 1 >/dev/null
+else
+       echo Skipped
+fi
index 5fad1aa1ced4858acf8e57f68e7e60331d0c963c..df6f6ac7b2fb59fa1afb891d3f8780ce371ed703 100644 (file)
@@ -1,17 +1,6 @@
 . tests/variables
 if [ "${TGLIB32}" = "yes" ]; then
-       rm -f tests/data32.tmp
-
-       rm -f tests/root
-       ln -s root1 tests/root
-       TZ=GMT tests/32bits/sadc32 --unix_time=1555593609 -S XALL,-A_PWR_FAN,-A_PWR_IN,-A_PWR_TEMP,-A_PWR_FREQ tests/data32.tmp
-       TZ=GMT tests/32bits/sadc32 --unix_time=1555593619 -C "32 bit datafile" tests/data32.tmp
-
-       TZ=GMT tests/32bits/sadc32 --unix_time=1555593629 -S XALL tests/data32.tmp 1 1 >/dev/null
-
-       rm -f tests/root
-       ln -s root2 tests/root
-       TZ=GMT tests/32bits/sadc32 --unix_time=1555593639 -S XALL tests/data32.tmp 1 1 >/dev/null
+       LC_ALL=C TZ=GMT ./sar -C -A -f tests/data32.tmp > tests/out.sar32-A.tmp && diff -u tests/expected.sar32-A tests/out.sar32-A.tmp
 else
        echo Skipped
 fi
diff --git a/tests/00712 b/tests/00712
deleted file mode 100644 (file)
index df6f6ac..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-. tests/variables
-if [ "${TGLIB32}" = "yes" ]; then
-       LC_ALL=C TZ=GMT ./sar -C -A -f tests/data32.tmp > tests/out.sar32-A.tmp && diff -u tests/expected.sar32-A tests/out.sar32-A.tmp
-else
-       echo Skipped
-fi
similarity index 100%
rename from tests/00720
rename to tests/00740
index 002e0aca4c5aa36b5b73592ea8151ddcb1264b06..134b74bf6962e25066442799afb242bd1ba946e5 100644 (file)
@@ -1,21 +1 @@
-rm -f tests/data1.tmp
-
-rm -f tests/root
-ln -s root1 tests/root
-TZ=GMT ./sadc --unix_time=1555593609 tests/data1.tmp 1 1 >/dev/null
-
-rm -f tests/root
-ln -s root2 tests/root
-TZ=GMT ./sadc --unix_time=1555593619 tests/data1.tmp 1 1 >/dev/null
-
-# LINUX RESTART
-TZ=GMT ./sadc --unix_time=1555593623 tests/data1.tmp >/dev/null
-
-rm -f tests/root
-ln -s root6 tests/root
-TZ=GMT ./sadc --unix_time=1555593629 tests/data1.tmp 1 1 >/dev/null
-
-rm -f tests/root
-ln -s root7 tests/root
-TZ=GMT ./sadc --unix_time=1555593639 tests/data1.tmp 1 1 >/dev/null
-
+LC_ALL=C TZ=GMT ./sar -f tests/data1.tmp -q ALL > tests/out2.sar-q.tmp && diff -u tests/expected2.sar-q tests/out2.sar-q.tmp
diff --git a/tests/00982 b/tests/00982
deleted file mode 100644 (file)
index 134b74b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-LC_ALL=C TZ=GMT ./sar -f tests/data1.tmp -q ALL > tests/out2.sar-q.tmp && diff -u tests/expected2.sar-q tests/out2.sar-q.tmp
index 4885a16bb05d9243b479fc9e534ad6ea0f0b1d2d..bfe681dd15098f75bb3392f659684ab8b2f9e8f6 100644 (file)
@@ -1,21 +1 @@
-rm -f tests/data1.tmp
-
-rm -f tests/root
-ln -s root6 tests/root
-TZ=GMT ./sadc --unix_time=1555593609 tests/data1.tmp 1 1 >/dev/null
-
-rm -f tests/root
-ln -s root7 tests/root
-TZ=GMT ./sadc --unix_time=1555593619 tests/data1.tmp 1 1 >/dev/null
-
-rm -f tests/root
-ln -s root1 tests/root
-# LINUX RESTART
-TZ=GMT ./sadc --unix_time=1555593623 tests/data1.tmp >/dev/null
-
-TZ=GMT ./sadc --unix_time=1555593629 tests/data1.tmp 1 1 >/dev/null
-
-rm -f tests/root
-ln -s root2 tests/root
-TZ=GMT ./sadc --unix_time=1555593639 tests/data1.tmp 1 1 >/dev/null
-
+LC_ALL=C TZ=GMT ./sar -f tests/data1.tmp -q ALL > tests/out2.sar-qALL.tmp && diff -u tests/expected2.sar-qALL tests/out2.sar-qALL.tmp
diff --git a/tests/01012 b/tests/01012
deleted file mode 100644 (file)
index bfe681d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-LC_ALL=C TZ=GMT ./sar -f tests/data1.tmp -q ALL > tests/out2.sar-qALL.tmp && diff -u tests/expected2.sar-qALL tests/out2.sar-qALL.tmp