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;
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 */
--- /dev/null
+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
+
--- /dev/null
+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
+
--- /dev/null
+. 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
. 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
+++ /dev/null
-. 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
-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
+++ /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
-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
+++ /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