From: Greg KH <gregkh@linuxfoundation.org>
To: trix@redhat.com
Cc: stable <stable@vger.kernel.org>,
linux-fpga@vger.kernel.org, shuah@kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 1/1] selftests: fpga: dfl: A test for afu interrupt support
Date: Tue, 9 Jun 2020 16:20:07 +0200 [thread overview]
Message-ID: <20200609142007.GA831428@kroah.com> (raw)
In-Reply-To: <20200609130208.27390-2-trix@redhat.com>
On Tue, Jun 09, 2020 at 06:02:08AM -0700, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Check that the ioctl DFL_FPGA_PORT_ERR_GET_IRQ_NUM returns
> an expected result.
>
> Tested on vf device 0xbcc1
>
> Sample run with
> $ sudo make -C tools/testing/selftests TARGETS=drivers/fpga run_tests
> ...
> ok 1 selftests: drivers/fpga: afu_intr
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> tools/testing/selftests/Makefile | 1 +
> tools/testing/selftests/drivers/fpga/Makefile | 9 +++++
> .../testing/selftests/drivers/fpga/afu_intr.c | 38 +++++++++++++++++++
> tools/testing/selftests/drivers/fpga/config | 1 +
> 4 files changed, 49 insertions(+)
> create mode 100644 tools/testing/selftests/drivers/fpga/Makefile
> create mode 100644 tools/testing/selftests/drivers/fpga/afu_intr.c
> create mode 100644 tools/testing/selftests/drivers/fpga/config
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 1195bd85af38..4c6eda659125 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -9,6 +9,7 @@ TARGETS += clone3
> TARGETS += cpufreq
> TARGETS += cpu-hotplug
> TARGETS += drivers/dma-buf
> +TARGETS += drivers/fpga
> TARGETS += efivarfs
> TARGETS += exec
> TARGETS += filesystems
> diff --git a/tools/testing/selftests/drivers/fpga/Makefile b/tools/testing/selftests/drivers/fpga/Makefile
> new file mode 100644
> index 000000000000..0a472e8c67c5
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/fpga/Makefile
> @@ -0,0 +1,9 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +CFLAGS += -I../../../../../usr/include/
> +CFLAGS += -I../../../../../include/uapi/
> +
> +TEST_GEN_PROGS := afu_intr
> +
> +top_srcdir ?=../../../../..
> +
> +include ../../lib.mk
> diff --git a/tools/testing/selftests/drivers/fpga/afu_intr.c b/tools/testing/selftests/drivers/fpga/afu_intr.c
> new file mode 100644
> index 000000000000..aa1efba94605
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/fpga/afu_intr.c
> @@ -0,0 +1,38 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <stdint.h>
> +#include <string.h>
> +#include <linux/fcntl.h>
> +#include <linux/fpga-dfl.h>
> +
> +#define TEST_PREFIX "drivers/fpga/afu_intr"
> +
> +int main(int argc, char *argv[])
> +{
> + int devfd, status;
> + struct dfl_fpga_port_info port_info;
> + uint32_t irq_num;
> +
> + devfd = open("/dev/dfl-port.0", O_RDONLY);
> + if (devfd < 0) {
> + printf("%s: [skip,no-ufpgaintr]\n", TEST_PREFIX);
> + exit(77);
> + }
> +
> + /*
> + * From fpga-dl.h :
> + * Currently hardware supports up to 1 irq.
> + * Return: 0 on success, -errno on failure.
> + */
> + irq_num = -1;
> + status = ioctl(devfd, DFL_FPGA_PORT_ERR_GET_IRQ_NUM, &irq_num);
> + if (status != 0 || irq_num > 255) {
> + printf("%s: [FAIL,err-get-irq-num]\n", TEST_PREFIX);
> + close(devfd);
> + exit(1);
> + }
> +
> + close(devfd);
> + return 0;
> +}
Why not use the ksft_* functions and frameworks to properly print out
the test status and results so that tools can correctly parse it?
It's generally bad-form to make up your own format.
thanks,
gre gk-h
next prev parent reply other threads:[~2020-06-09 14:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-09 13:02 [PATCH 0/1] selftests for drivers/fpga trix
2020-06-09 13:02 ` [PATCH 1/1] selftests: fpga: dfl: A test for afu interrupt support trix
2020-06-09 14:20 ` Greg KH [this message]
2020-06-09 14:45 ` Tom Rix
2020-06-09 15:01 ` Shuah Khan
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=20200609142007.GA831428@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=stable@vger.kernel.org \
--cc=trix@redhat.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.