Re: [libgpiod v2][PATCH v3 3/3] tests: rewrite core C tests using libgpiosim

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 03, 2022 at 10:18:36AM +0100, Bartosz Golaszewski wrote:
> This replaces the old tests for the C API v1 based on gpio-mockup with
> a test suite based on gpio-sim that covers around 95% of the libgpiod v2
> codebase.
> 
> The test harness has been rebuilt and shrank significantly as well. The
> libgpiosim API has been wrapped in a gobject interface.
> 
> Signed-off-by: Bartosz Golaszewski <brgl@xxxxxxxx>
> ---
>  configure.ac                 |    8 +-
>  tests/Makefile.am            |   24 +-
>  tests/gpiod-test-helpers.c   |   49 ++
>  tests/gpiod-test-helpers.h   |  139 +++++
>  tests/gpiod-test-sim.c       |  308 ++++++++++
>  tests/gpiod-test-sim.h       |   42 ++
>  tests/gpiod-test.c           |  233 +-------
>  tests/gpiod-test.h           |   83 +--
>  tests/gpiosim/gpiosim.c      |    1 +
>  tests/mockup/Makefile.am     |   11 -
>  tests/mockup/gpio-mockup.c   |  496 ----------------
>  tests/mockup/gpio-mockup.h   |   36 --
>  tests/tests-chip.c           |  282 ++++-----
>  tests/tests-edge-event.c     |  490 +++++++++++++++
>  tests/tests-event.c          |  908 ----------------------------
>  tests/tests-info-event.c     |  301 ++++++++++
>  tests/tests-line-config.c    |  503 ++++++++++++++++
>  tests/tests-line-info.c      |  318 ++++++++++
>  tests/tests-line-request.c   |  526 ++++++++++++++++
>  tests/tests-line.c           | 1091 ----------------------------------
>  tests/tests-misc.c           |   80 ++-
>  tests/tests-request-config.c |   90 +++
>  22 files changed, 2995 insertions(+), 3024 deletions(-)
>  create mode 100644 tests/gpiod-test-helpers.c
>  create mode 100644 tests/gpiod-test-helpers.h
>  create mode 100644 tests/gpiod-test-sim.c
>  create mode 100644 tests/gpiod-test-sim.h
>  delete mode 100644 tests/mockup/Makefile.am
>  delete mode 100644 tests/mockup/gpio-mockup.c
>  delete mode 100644 tests/mockup/gpio-mockup.h
>  create mode 100644 tests/tests-edge-event.c
>  delete mode 100644 tests/tests-event.c
>  create mode 100644 tests/tests-info-event.c
>  create mode 100644 tests/tests-line-config.c
>  create mode 100644 tests/tests-line-info.c
>  create mode 100644 tests/tests-line-request.c
>  delete mode 100644 tests/tests-line.c
>  create mode 100644 tests/tests-request-config.c
> 
> diff --git a/configure.ac b/configure.ac
> index cb4c1fd..f8d34ed 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -28,9 +28,8 @@ AC_SUBST(VERSION_STR, [$PACKAGE_VERSION$EXTRA_VERSION])
>  AC_SUBST(ABI_VERSION, [4.1.2])
>  # Have a separate ABI version for C++ bindings:
>  AC_SUBST(ABI_CXX_VERSION, [2.1.1])
> -# ABI version for libgpiomockup (we need this since it can be installed if we
> +# ABI version for libgpiosim (we need this since it can be installed if we
>  # enable install-tests).
> -AC_SUBST(ABI_MOCKUP_VERSION, [0.1.0])
>  AC_SUBST(ABI_GPIOSIM_VERSION, [0.1.0])
>  
>  AC_CONFIG_AUX_DIR([autostuff])
> @@ -138,14 +137,14 @@ AC_DEFUN([FUNC_NOT_FOUND_TESTS],
>  
>  if test "x$with_tests" = xtrue
>  then
> -	# For libgpiomockup & libgpiosim
> +	# For libgpiosim
>  	AC_CHECK_FUNC([qsort], [], [FUNC_NOT_FOUND_TESTS([qsort])])
>  	PKG_CHECK_MODULES([KMOD], [libkmod >= 18])
> -	PKG_CHECK_MODULES([UDEV], [libudev >= 215])
>  	PKG_CHECK_MODULES([MOUNT], [mount >= 2.33.1])
>  
>  	# For core library tests
>  	PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.50])
> +	PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.50])
>  
>  	if test "x$with_tools" = xtrue
>  	then
> @@ -236,7 +235,6 @@ AC_CONFIG_FILES([Makefile
>  		 lib/libgpiod.pc
>  		 tools/Makefile
>  		 tests/Makefile
> -		 tests/mockup/Makefile
>  		 tests/gpiosim/Makefile
>  		 bindings/cxx/libgpiodcxx.pc
>  		 bindings/Makefile
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 2b1e082..dce9a5a 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -1,24 +1,32 @@
>  # SPDX-License-Identifier: GPL-2.0-or-later
>  # SPDX-FileCopyrightText: 2017-2022 Bartosz Golaszewski <brgl@xxxxxxxx>
>  
> -SUBDIRS = mockup gpiosim
> -
> +SUBDIRS = gpiosim
> + 

Whitespace error.

Other than that all good.

Good to see the randomness removed from the gpio-sim naming.
I would like to see the option removed from libgpiosim as well, but that
is outside the scope of this patch series.

Cheers,
Kent.



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux