* [LTP] [PATCH 0/3] Convert sysinfo tests to new library
@ 2026-03-04 14:12 Cyril Hrubis
2026-03-04 14:12 ` [LTP] [PATCH 1/3] tst_test_macros: Add TST_EXP_LE_LU*() Cyril Hrubis
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Cyril Hrubis @ 2026-03-04 14:12 UTC (permalink / raw)
To: ltp
Cyril Hrubis (3):
tst_test_macros: Add TST_EXP_LE_LU*()
syscalls: sysinfo01: Rewrite
syscalls: sysinfo02: Convert to the new library
include/tst_test_macros.h | 45 ++++
testcases/kernel/syscalls/sysinfo/sysinfo01.c | 218 +++++-------------
testcases/kernel/syscalls/sysinfo/sysinfo02.c | 138 ++---------
3 files changed, 119 insertions(+), 282 deletions(-)
--
2.52.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
* [LTP] [PATCH 1/3] tst_test_macros: Add TST_EXP_LE_LU*()
2026-03-04 14:12 [LTP] [PATCH 0/3] Convert sysinfo tests to new library Cyril Hrubis
@ 2026-03-04 14:12 ` Cyril Hrubis
2026-03-04 15:17 ` Andrea Cervesato via ltp
2026-03-04 14:12 ` [LTP] [PATCH 2/3] syscalls: sysinfo01: Rewrite Cyril Hrubis
2026-03-04 14:12 ` [LTP] [PATCH 3/3] syscalls: sysinfo02: Convert to the new library Cyril Hrubis
2 siblings, 1 reply; 9+ messages in thread
From: Cyril Hrubis @ 2026-03-04 14:12 UTC (permalink / raw)
To: ltp
For less or equal comparsions.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
include/tst_test_macros.h | 45 +++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
index ee6599df2..3d2287753 100644
--- a/include/tst_test_macros.h
+++ b/include/tst_test_macros.h
@@ -693,6 +693,51 @@ const char *tst_errno_names(char *buf, const int *exp_errs, int exp_errs_cnt);
} \
} while (0)
+#define TST_EXP_LE_SILENT_(VAL_A, SVAL_A, VAL_B, SVAL_B, TYPE, PFS) do { \
+ TYPE tst_tmp_a__ = VAL_A; \
+ TYPE tst_tmp_b__ = VAL_B; \
+ \
+ TST_PASS = 0; \
+ \
+ if (tst_tmp_a__ > tst_tmp_b__) { \
+ tst_res_(__FILE__, __LINE__, TFAIL, \
+ SVAL_A " (" PFS ") > " SVAL_B " (" PFS ")", \
+ tst_tmp_a__, tst_tmp_b__); \
+ } else { \
+ TST_PASS = 1; \
+ } \
+} while (0)
+
+/**
+ * TST_EXP_LE_LU() - Compare two unsigned long long values, expect A <= B.
+ *
+ * @VAL_A: unsigned long long value A.
+ * @VAL_B: unsigned long long value B.
+ *
+ * Reports a pass if A <= B and a fail otherwise.
+ */
+#define TST_EXP_LE_LU(VAL_A, VAL_B) do { \
+ TST_EXP_LE_SILENT_(VAL_A, #VAL_A, VAL_B, #VAL_B, unsigned long long, "%llu"); \
+ \
+ if (TST_PASS) { \
+ tst_res_(__FILE__, __LINE__, TPASS, \
+ #VAL_A " <= " #VAL_B " (%llu <= %llu)", \
+ (unsigned long long)VAL_A, (unsigned long long)VAL_B); \
+ } \
+} while (0)
+
+/**
+ * TST_EXP_LE_LU_SILENT() - Compare two unsigned long long values, silent variant.
+ *
+ * @VAL_A: unsigned long long value A.
+ * @VAL_B: unsigned long long value B.
+ *
+ * Unlike TST_EXP_LE_LU() does not print :c:enum:`TPASS <tst_res_flags>` on
+ * success, only prints :c:enum:`TFAIL <tst_res_flags>` on failure.
+ */
+#define TST_EXP_LE_LU_SILENT(VAL_A, VAL_B) \
+ TST_EXP_LE_SILENT_(VAL_A, #VAL_A, VAL_B, #VAL_B, unsigned long long, "%llu")
+
/**
* TST_EXP_EQ_LI() - Compare two long long values.
*
--
2.52.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [LTP] [PATCH 2/3] syscalls: sysinfo01: Rewrite
2026-03-04 14:12 [LTP] [PATCH 0/3] Convert sysinfo tests to new library Cyril Hrubis
2026-03-04 14:12 ` [LTP] [PATCH 1/3] tst_test_macros: Add TST_EXP_LE_LU*() Cyril Hrubis
@ 2026-03-04 14:12 ` Cyril Hrubis
2026-03-04 15:29 ` Andrea Cervesato via ltp
2026-03-04 15:32 ` Andrea Cervesato via ltp
2026-03-04 14:12 ` [LTP] [PATCH 3/3] syscalls: sysinfo02: Convert to the new library Cyril Hrubis
2 siblings, 2 replies; 9+ messages in thread
From: Cyril Hrubis @ 2026-03-04 14:12 UTC (permalink / raw)
To: ltp
Rewrite sysinfo01 into a proper syscall test. Now the test asserts that
the values we get in the sysinfo buffer make sense.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
testcases/kernel/syscalls/sysinfo/sysinfo01.c | 218 +++++-------------
1 file changed, 59 insertions(+), 159 deletions(-)
diff --git a/testcases/kernel/syscalls/sysinfo/sysinfo01.c b/testcases/kernel/syscalls/sysinfo/sysinfo01.c
index 2ea44a2be..9e7ff4ad6 100644
--- a/testcases/kernel/syscalls/sysinfo/sysinfo01.c
+++ b/testcases/kernel/syscalls/sysinfo/sysinfo01.c
@@ -1,176 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Copyright (c) International Business Machines Corp., 2001
+ * Copyright (c) 2026 Cyril Hrubis <chrubis@suse.cz>
*/
-/*
- * Test Name : sysinfo01
- *
- * Test description
- * Verify that sysinfo() succeeds to get the system information and fills
- * the structure passed.
- *
- * Expected Result :
- * sysinfo() returns value 0 on success and the sysinfo structure should
- * be filled with the system information.
- *
- * Algorithm:
- * Setup :
- * Setup for signal handling.
- * Create temporary directory.
- * Pause for SIGUSR1 if option specified.
- * Test:
- * Loop if the proper option is given.
- * Execute the system call.
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise,
- * if we are being called by another sysinfo test.
- * Print the infomation that was returned for use by the calling
- * test.
- * otherwise,
- * Report success.
- * Cleanup:
- * Print errno log and/or timing stats if options given
- * Delete the temporary directory created.
- *
- * USAGE: <for command-line>
- * sysinfo01 [-c n] [-i n] [-I x] [-P x] [-t]
- * where, -c n : Run n copies concurrently.
- * -i n : Execute test n times.
- * -I x : Execute test for x seconds.
- * -P x : Pause for x seconds between iterations.
- * -t : Turn on syscall timing.
- * History
- * 07/2001 John George
- * -Ported
- *
- * Restrictions:
- * None
- *
+/*\
+ * Verify that sysinfo() succeeds to get the system information and fills the
+ * structure passed. We do sanity checks on the returned values, either
+ * comparing it againts values from /proc/ files or by checking that the values
+ * are in sane e.g. free RAM <= total RAM.
*/
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/signal.h>
+#include <stdlib.h>
+#include <math.h>
#include <sys/sysinfo.h>
+#include "tst_test.h"
-#include "test.h"
-
-void setup();
-void cleanup();
-
-char *TCID = "sysinfo01";
-int TST_TOTAL = 1;
+static struct sysinfo *sys_buf;
-int main(int ac, char **av)
+static void run(void)
{
- struct sysinfo *sys_buf;
- int lc;
- float l1, l2, l3;
- unsigned long l1_up, l2_up, l3_up;
-
- sys_buf = malloc(sizeof(struct sysinfo));
-
- tst_parse_opts(ac, av, NULL, NULL);
-
- setup(); /* Global setup */
-
- /* The following loop checks looping state if -i option given */
- for (lc = 0; TEST_LOOPING(lc); lc++) {
-
- /* reset tst_count in case we are looping */
- tst_count = 0;
-
- TEST(sysinfo(sys_buf));
- /* check return code */
- if (TEST_RETURN == -1) {
- /* To gather stats on errnos returned, log the errno */
- tst_brkm(TFAIL, cleanup, "sysinfo() Failed, errno=%d"
- " : %s", TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /* Test succeeded */
-
- /* This portion of the code generates information
- * used by sysinfo03 to test the functionality of
- * sysinfo.
- */
-
- if (ac == 2 && !strncmp(av[1], "TEST3", 5)) {
- tst_resm(TINFO, "Generating info for "
- "sysinfo03");
- l1 = sys_buf->loads[0] / 60000.0;
- l2 = sys_buf->loads[1] / 60000.0;
- l3 = sys_buf->loads[2] / 60000.0;
- l1_up = l1 * 100;
- l2_up = l2 * 100;
- l3_up = l3 * 100;
- sys_buf->loads[0] = sys_buf->loads[0] / 10;
- sys_buf->loads[1] = sys_buf->loads[1] / 10;
- sys_buf->loads[2] = sys_buf->loads[2] / 10;
- printf("uptime %lu\n", sys_buf->uptime);
- printf("load1 %lu\n", sys_buf->loads[0]);
- printf("load2 %lu\n", sys_buf->loads[1]);
- printf("load3 %lu\n", sys_buf->loads[2]);
- printf("l1 %lu\n", l1_up);
- printf("l2 %lu\n", l2_up);
- printf("l3 %lu\n", l3_up);
- printf("totalram %lu\n", sys_buf->totalram);
- printf("freeram %lu\n", sys_buf->freeram);
- printf("sharedram %lu\n", sys_buf->sharedram);
- printf("bufferram %lu\n", sys_buf->bufferram);
- printf("totalswap %lu\n",
- sys_buf->totalswap / (1024 * 1024));
- printf("freeswap %lu\n", sys_buf->freeswap);
- printf("procs %lu\n",
- (unsigned long)sys_buf->procs);
- } else {
- tst_resm(TPASS,
- "Test to check the return code PASSED");
- }
- }
+ long uptime;
+ float load1, load5, load15;
+ float sys_load1, sys_load5, sys_load15;
+ unsigned long totalswap, totalswap_kb;
+ unsigned long totalram, totalram_kb;
+
+ TST_EXP_PASS(sysinfo(sys_buf));
+
+ if (!TST_PASS)
+ return;
+
+ SAFE_FILE_SCANF("/proc/uptime", "%ld", &uptime);
+ SAFE_FILE_SCANF("/proc/loadavg", "%f %f %f", &load1, &load5, &load15);
+ totalram = SAFE_READ_MEMINFO("MemTotal:");
+ totalswap = SAFE_READ_MEMINFO("SwapTotal:");
+
+ if (sys_buf->uptime < uptime || sys_buf->uptime - uptime > 2) {
+ tst_res(TFAIL, "uptime: %ld, expected between %ld and %ld",
+ sys_buf->uptime, uptime, uptime + 2);
+ } else {
+ tst_res(TPASS, "uptime: %ld (>= %ld)", sys_buf->uptime, uptime);
}
- cleanup();
- tst_exit();
+ sys_load1 = sys_buf->loads[0] / 65536.0;
+ sys_load5 = sys_buf->loads[1] / 65536.0;
+ sys_load15 = sys_buf->loads[2] / 65536.0;
-}
-
-/*
- * setup()
- * performs one time setup
- *
- */
-void setup(void)
-{
+ /* Compare loads with tolerance */
+ if (fabs(sys_load1 - load1) > 0.1 || fabs(sys_load5 - load5) > 0.1 || fabs(sys_load15 - load15) > 0.1) {
+ tst_res(TFAIL, "loadavg: %.2f %.2f %.2f, expected ~%.2f %.2f %.2f",
+ sys_load1, sys_load5, sys_load15, load1, load5, load15);
+ } else {
+ tst_res(TPASS, "loadavg: %.2f %.2f %.2f", sys_load1, sys_load5, sys_load15);
+ }
- tst_sig(FORK, DEF_HANDLER, cleanup);
+ totalram_kb = ((unsigned long long)sys_buf->totalram * sys_buf->mem_unit) / 1024;
+ totalswap_kb = ((unsigned long long)sys_buf->totalswap * sys_buf->mem_unit) / 1024;
- umask(0);
+ TST_EXP_EQ_LU(totalram_kb, totalram);
+ TST_EXP_EQ_LU(totalswap_kb, totalswap);
- TEST_PAUSE;
+ TST_EXP_LE_LU(sys_buf->freeram, sys_buf->totalram);
+ TST_EXP_LE_LU(sys_buf->sharedram, sys_buf->totalram);
+ TST_EXP_LE_LU(sys_buf->bufferram, sys_buf->totalram);
+ TST_EXP_LE_LU(sys_buf->freeswap, sys_buf->totalswap);
}
-/*
- * cleanup()
- *
- */
-void cleanup(void)
-{
-}
+static struct tst_test test = {
+ .test_all = run,
+ .bufs = (struct tst_buffers[]) {
+ {&sys_buf, .size = sizeof(*sys_buf)},
+ {}
+ }
+};
--
2.52.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [LTP] [PATCH 3/3] syscalls: sysinfo02: Convert to the new library
2026-03-04 14:12 [LTP] [PATCH 0/3] Convert sysinfo tests to new library Cyril Hrubis
2026-03-04 14:12 ` [LTP] [PATCH 1/3] tst_test_macros: Add TST_EXP_LE_LU*() Cyril Hrubis
2026-03-04 14:12 ` [LTP] [PATCH 2/3] syscalls: sysinfo01: Rewrite Cyril Hrubis
@ 2026-03-04 14:12 ` Cyril Hrubis
2026-03-04 15:31 ` Andrea Cervesato via ltp
2 siblings, 1 reply; 9+ messages in thread
From: Cyril Hrubis @ 2026-03-04 14:12 UTC (permalink / raw)
To: ltp
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
testcases/kernel/syscalls/sysinfo/sysinfo02.c | 138 ++----------------
1 file changed, 15 insertions(+), 123 deletions(-)
diff --git a/testcases/kernel/syscalls/sysinfo/sysinfo02.c b/testcases/kernel/syscalls/sysinfo/sysinfo02.c
index 4ce06e0a7..5bbbdc35c 100644
--- a/testcases/kernel/syscalls/sysinfo/sysinfo02.c
+++ b/testcases/kernel/syscalls/sysinfo/sysinfo02.c
@@ -1,137 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
- *
- * Copyright (c) International Business Machines Corp., 2001
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Copyright (c) International Business Machines Corp., 2001
+ * Copyright (c) 2026 Cyril Hrubis <chrubis@suse.cz>
*/
-/*
- * Test Name : sysinfo02
- *
- * Test description
- * Verify that sysinfo() returns the correct error for an invalid address structure.
- *
- * Expected Result :
- * sysinfo() returns value 0 on success and the sysinfo structure should
- * be filled with the system information.
- *
- * Algorithm:
- * Setup :
- * Setup for signal handling.
- * Create temporary directory.
- * Pause for SIGUSR1 if option specified.
- * Test:
- * Loop if the proper option is given.
- * Execute the system call.
- * Pass an invalid address to the structure.
- * Check return code, if system call failed (return=-1)
- * Test case passed, Issue functionality pass message
- * Otherwise,
- * Issue Functionality-Fail message.
- * Cleanup:
- * Print errno log and/or timing stats if options given
- * Delete the temporary directory created.
- *
- * USAGE: <for command-line>
- * sysinfo02 [-c n] [-i n] [-I x] [-P x] [-t]
- * where, -c n : Run n copies concurrently.
- * -i n : Execute test n times.
- * -I x : Execute test for x seconds.
- * -P x : Pause for x seconds between iterations.
- * -t : Turn on syscall timing.
- * History
- * 07/2001 John George
- * -Ported
- *
- * Restrictions:
- * None
- *
+/*\
+ * Verify that sysinfo() returns EFAULT for an invalid address structure.
*/
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/signal.h>
#include <sys/sysinfo.h>
-#include <stdint.h>
-
-#include "test.h"
-
-#define INVALID_ADDRESS ((uintptr_t)-1)
+#include "tst_test.h"
-void setup();
-void cleanup();
+static struct sysinfo *bad_info;
-char *TCID = "sysinfo02";
-int TST_TOTAL = 1;
-
-int main(int ac, char **av)
+static void setup(void)
{
- struct sysinfo *sysinfo_buf;
- int lc;
-
- sysinfo_buf = (void *)INVALID_ADDRESS;
-
- tst_parse_opts(ac, av, NULL, NULL);
-
- setup(); /* Global setup */
-
- /* The following loop checks looping state if -i option given */
- for (lc = 0; TEST_LOOPING(lc); lc++) {
-
- /* reset tst_count in case we are looping */
- tst_count = 0;
-
- TEST(sysinfo(sysinfo_buf));
- /* check return code */
- if (TEST_RETURN != 0 && TEST_ERRNO == EFAULT) {
- /* Test succeeded as it was supposed to return -1 */
- tst_resm(TPASS,
- "Test to check the error code %d PASSED",
- TEST_ERRNO);
- } else {
- /* Test Failed */
- tst_brkm(TFAIL, cleanup, "sysinfo() Failed, Expected -1 "
- "returned %d/n", TEST_ERRNO);
- }
- }
- cleanup();
- tst_exit();
-
+ bad_info = tst_get_bad_addr(NULL);
}
-/*
- * setup()
- * performs one time setup
- *
- */
-void setup(void)
+static void run(void)
{
-
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- umask(0);
-
- TEST_PAUSE;
+ TST_EXP_FAIL(sysinfo(bad_info), EFAULT);
}
-/*
- * cleanup()
- *
- */
-void cleanup(void)
-{
-}
+static struct tst_test test = {
+ .setup = setup,
+ .test_all = run,
+};
--
2.52.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 1/3] tst_test_macros: Add TST_EXP_LE_LU*()
2026-03-04 14:12 ` [LTP] [PATCH 1/3] tst_test_macros: Add TST_EXP_LE_LU*() Cyril Hrubis
@ 2026-03-04 15:17 ` Andrea Cervesato via ltp
0 siblings, 0 replies; 9+ messages in thread
From: Andrea Cervesato via ltp @ 2026-03-04 15:17 UTC (permalink / raw)
To: Cyril Hrubis, ltp
Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 2/3] syscalls: sysinfo01: Rewrite
2026-03-04 14:12 ` [LTP] [PATCH 2/3] syscalls: sysinfo01: Rewrite Cyril Hrubis
@ 2026-03-04 15:29 ` Andrea Cervesato via ltp
2026-04-07 12:16 ` Cyril Hrubis
2026-03-04 15:32 ` Andrea Cervesato via ltp
1 sibling, 1 reply; 9+ messages in thread
From: Andrea Cervesato via ltp @ 2026-03-04 15:29 UTC (permalink / raw)
To: Cyril Hrubis, ltp
Hi!
> + sys_load1 = sys_buf->loads[0] / 65536.0;
> + sys_load5 = sys_buf->loads[1] / 65536.0;
> + sys_load15 = sys_buf->loads[2] / 65536.0;
I would go for:
sys_load1 = sys_buf->loads[0] / (float)(1 << SI_LOAD_SHIFT);
That "magic value" needs at least to be explained on a comment
otherwise. With this fixed:
Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 3/3] syscalls: sysinfo02: Convert to the new library
2026-03-04 14:12 ` [LTP] [PATCH 3/3] syscalls: sysinfo02: Convert to the new library Cyril Hrubis
@ 2026-03-04 15:31 ` Andrea Cervesato via ltp
0 siblings, 0 replies; 9+ messages in thread
From: Andrea Cervesato via ltp @ 2026-03-04 15:31 UTC (permalink / raw)
To: Cyril Hrubis, ltp
Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 2/3] syscalls: sysinfo01: Rewrite
2026-03-04 14:12 ` [LTP] [PATCH 2/3] syscalls: sysinfo01: Rewrite Cyril Hrubis
2026-03-04 15:29 ` Andrea Cervesato via ltp
@ 2026-03-04 15:32 ` Andrea Cervesato via ltp
1 sibling, 0 replies; 9+ messages in thread
From: Andrea Cervesato via ltp @ 2026-03-04 15:32 UTC (permalink / raw)
To: Cyril Hrubis, ltp
> + totalram_kb = ((unsigned long long)sys_buf->totalram * sys_buf->mem_unit) / 1024;
> + totalswap_kb = ((unsigned long long)sys_buf->totalswap * sys_buf->mem_unit) / 1024;
This 1024 can change into TST_KB also.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 2/3] syscalls: sysinfo01: Rewrite
2026-03-04 15:29 ` Andrea Cervesato via ltp
@ 2026-04-07 12:16 ` Cyril Hrubis
0 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2026-04-07 12:16 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi!
> > + sys_load1 = sys_buf->loads[0] / 65536.0;
> > + sys_load5 = sys_buf->loads[1] / 65536.0;
> > + sys_load15 = sys_buf->loads[2] / 65536.0;
>
> I would go for:
>
> sys_load1 = sys_buf->loads[0] / (float)(1 << SI_LOAD_SHIFT);
>
> That "magic value" needs at least to be explained on a comment
> otherwise. With this fixed:
I've fixed the test to use SI_LOAD_SHIFT and TST_KB and also to use
:manpage:`sysinfo(2)` in the doc comment and pushed, thanks for the
reviews.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-04-07 12:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 14:12 [LTP] [PATCH 0/3] Convert sysinfo tests to new library Cyril Hrubis
2026-03-04 14:12 ` [LTP] [PATCH 1/3] tst_test_macros: Add TST_EXP_LE_LU*() Cyril Hrubis
2026-03-04 15:17 ` Andrea Cervesato via ltp
2026-03-04 14:12 ` [LTP] [PATCH 2/3] syscalls: sysinfo01: Rewrite Cyril Hrubis
2026-03-04 15:29 ` Andrea Cervesato via ltp
2026-04-07 12:16 ` Cyril Hrubis
2026-03-04 15:32 ` Andrea Cervesato via ltp
2026-03-04 14:12 ` [LTP] [PATCH 3/3] syscalls: sysinfo02: Convert to the new library Cyril Hrubis
2026-03-04 15:31 ` Andrea Cervesato via ltp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox