From: Petr Vorel <pvorel@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4 1/2] tst_memutils.c: Add tst_print_meminfo function
Date: Mon, 18 Dec 2023 14:24:59 +0100 [thread overview]
Message-ID: <20231218132459.GA199735@pevik> (raw)
In-Reply-To: <20231218122236.24917-2-wegao@suse.com>
Hi Wei,
> +void safe_print_file(const char *file, const int lineno, char *path)
> +{
> + FILE *pfile;
> + char line[PATH_MAX];
> +
> + pfile = safe_fopen(file, lineno, NULL, path, "r");
> +
I'd expect here TINFO message:
tst_res(TINFO, "=== %s ===", path);
> + while (fgets(line, sizeof(line), pfile))
> + tst_resm_(file, lineno, TINFO, "%s", line);
This will not work, that's legacy API.
Please next time pay attention with warnings:
tst_safe_macros.c: In function ‘safe_print_file’:
tst_safe_macros.c:622:17: warning: implicit declaration of function ‘tst_resm_’; did you mean ‘tst_res_’? [-Wimplicit-function-declaration]
622 | tst_resm_(file, lineno, TINFO, "%s", line);
| ^~~~~~~~~
| tst_res_
Also, if you push to github, you see this is fatal for CI, where we compile with
-Werror=implicit-function-declaration.
Please next time push to github first, so that you save reviewer time.
Also, when you run the test, the output contains extra new line:
tst_kconfig.c:87: TINFO: Parsing kernel config '/proc/config.gz'
tst_test.c:1690: TINFO: LTP version: 20230929-201-ge32735252
tst_test.c:1574: TINFO: Timeout per run is 0h 10m 30s
tst_safe_macros.c:619: TINFO: === /proc/meminfo ===
swapping01.c:88: TINFO: MemTotal: 7700224 kB
swapping01.c:88: TINFO: MemFree: 4058996 kB
swapping01.c:88: TINFO: MemAvailable: 4172736 kB
...
We could remove it, but actually printing it via fprintf is actually better:
tst_kconfig.c:87: TINFO: Parsing kernel config '/proc/config.gz'
tst_test.c:1690: TINFO: LTP version: 20230929-201-ge32735252
tst_test.c:1574: TINFO: Timeout per run is 0h 10m 30s
tst_safe_macros.c:619: TINFO: === /proc/meminfo ===
MemTotal: 1467180 kB
MemFree: 820040 kB
MemAvailable: 1143320 kB
...
Anyway, fixed and merged this patch.
Kind regards,
Petr
> +
> + safe_fclose(file, lineno, NULL, pfile);
> +}
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-12-18 13:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-10 9:43 [LTP] [PATCH v1] swapping01.c: Reporting /proc/meminfo before test and at the moment of the failure Wei Gao via ltp
2023-12-12 17:29 ` Petr Vorel
2023-12-14 6:33 ` [LTP] [PATCH v2 0/2] Add tst_print_meminfo function in swapping01 Wei Gao via ltp
2023-12-14 6:33 ` [LTP] [PATCH v2 1/2] tst_memutils.c: Add tst_print_meminfo function Wei Gao via ltp
2023-12-14 6:33 ` [LTP] [PATCH v2 2/2] swapping01.c: Reporting /proc/meminfo during test Wei Gao via ltp
2023-12-14 7:13 ` [LTP] [PATCH v3 0/2] Add tst_print_meminfo function into swapping01 Wei Gao via ltp
2023-12-14 7:13 ` [LTP] [PATCH v3 1/2] tst_memutils.c: Add tst_print_meminfo function Wei Gao via ltp
2023-12-15 18:57 ` Petr Vorel
2023-12-18 3:41 ` Li Wang
2023-12-18 3:51 ` Li Wang
2023-12-18 4:39 ` Petr Vorel
2023-12-18 4:30 ` Petr Vorel
2023-12-18 7:20 ` Li Wang
2023-12-14 7:13 ` [LTP] [PATCH v3 2/2] swapping01.c: Reporting /proc/meminfo during test Wei Gao via ltp
2023-12-18 7:37 ` Li Wang
2023-12-18 12:22 ` [LTP] [PATCH v4 0/2] Add tst_print_meminfo function into swapping01 Wei Gao via ltp
2023-12-18 12:22 ` [LTP] [PATCH v4 1/2] tst_memutils.c: Add tst_print_meminfo function Wei Gao via ltp
2023-12-18 13:24 ` Petr Vorel [this message]
2023-12-18 12:22 ` [LTP] [PATCH v4 2/2] swapping01.c: Reporting /proc/meminfo during test Wei Gao via ltp
2023-12-18 13:34 ` Petr Vorel
2023-12-18 13:47 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231218132459.GA199735@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=wegao@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.