From: Thomas Huth <thuth@redhat.com>
To: Tommy Wu <tommy.wu@sifive.com>,
qemu-devel@nongnu.org, qemu-riscv@nongnu.org
Cc: alistair.francis@wdc.com, palmer@dabbelt.com,
bin.meng@windriver.com, jim.shu@sifive.com,
frank.chang@sifive.com
Subject: Re: [PATCH v3 3/3] tests/qtest: sifive-e-aon-watchdog-test.c : Add QTest of watchdog of sifive_e
Date: Wed, 30 Nov 2022 12:29:31 +0100 [thread overview]
Message-ID: <db28b205-4797-4bc0-09c9-53d54c0ce268@redhat.com> (raw)
In-Reply-To: <20221130015444.1459842-4-tommy.wu@sifive.com>
On 30/11/2022 02.54, Tommy Wu wrote:
> Add some simple tests of the watchdog timer in the always-on domain device
> of HiFive 1 rev b.
>
> Signed-off-by: Tommy Wu <tommy.wu@sifive.com>
> ---
...
> diff --git a/tests/qtest/sifive-e-aon-watchdog-test.c b/tests/qtest/sifive-e-aon-watchdog-test.c
> new file mode 100644
> index 0000000000..1f454c266a
> --- /dev/null
> +++ b/tests/qtest/sifive-e-aon-watchdog-test.c
> @@ -0,0 +1,650 @@
I'd suggest to add at least add a SPDX identifier so that people know which
license this file has. A short comment on what is being tested here would
also be nice (though it is already quite obvious from the file name).
> +#include "qemu/osdep.h"
> +#include "qemu/timer.h"
> +#include "qemu/bitops.h"
> +#include "libqtest-single.h"
Note that libqtest-single.h restricts your code to testing with one QEMU
binary. If you want to write code that is a little bit more future-proof
(e.g. if some of the functions should be used with migration testing later
etc.), I'd suggest to get along without libqtest-single.h and pass the
QTestState around as a parameter of the functions.
[...]
> +static void test_wdogcfg(void)
> +{
> + uint32_t tmp_cfg;
> +
> + test_init();
> +
> + tmp_cfg = readl(WDOG_BASE + WDOGCFG);
> + writel(WDOG_BASE + WDOGCFG, 0xFFFFFFFF);
> + g_assert(readl(WDOG_BASE + WDOGCFG) == tmp_cfg);
> +
> + writel(WDOG_BASE + WDOGKEY, SIFIVE_E_AON_WDOGKEY);
> + writel(WDOG_BASE + WDOGCFG, 0xFFFFFFFF);
> + g_assert(0xFFFFFFFF == readl(WDOG_BASE + WDOGCFG));
> +
> + tmp_cfg = readl(WDOG_BASE + WDOGCFG);
> + g_assert(15 ==
> + FIELD_EX32(tmp_cfg,
> + AON_WDT_WDOGCFG,
> + SCALE));
> + g_assert(1 ==
> + FIELD_EX32(tmp_cfg,
> + AON_WDT_WDOGCFG,
> + RSTEN));
> + g_assert(1 ==
> + FIELD_EX32(tmp_cfg,
> + AON_WDT_WDOGCFG,
> + ZEROCMP));
> + g_assert(1 ==
> + FIELD_EX32(tmp_cfg,
> + AON_WDT_WDOGCFG,
> + EN_ALWAYS));
> + g_assert(1 ==
> + FIELD_EX32(tmp_cfg,
> + AON_WDT_WDOGCFG,
> + EN_CORE_AWAKE));
> + g_assert(1 ==
> + FIELD_EX32(tmp_cfg,
> + AON_WDT_WDOGCFG,
> + IP0));
Just a matter of taste, but at least I would prefer the statements on one
line as long as they still fit into 80 columns.
Thomas
next prev parent reply other threads:[~2022-11-30 11:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 1:54 [PATCH v3 0/3] Implement the watchdog timer of HiFive 1 rev b Tommy Wu
2022-11-30 1:54 ` [PATCH v3 1/3] hw/misc: sifive_e_aon: Support " Tommy Wu
2022-12-07 4:02 ` Alistair Francis
2023-05-23 7:59 ` Tommy Wu
2022-11-30 1:54 ` [PATCH v3 2/3] hw/riscv: sifive_e: " Tommy Wu
2022-12-06 7:03 ` Alistair Francis
2022-11-30 1:54 ` [PATCH v3 3/3] tests/qtest: sifive-e-aon-watchdog-test.c : Add QTest of watchdog of sifive_e Tommy Wu
2022-11-30 11:29 ` Thomas Huth [this message]
2023-05-23 7:59 ` Tommy Wu
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=db28b205-4797-4bc0-09c9-53d54c0ce268@redhat.com \
--to=thuth@redhat.com \
--cc=alistair.francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=frank.chang@sifive.com \
--cc=jim.shu@sifive.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=tommy.wu@sifive.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).