From 715791a3a37278594e27ad5701863ae0cd015f71 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Thu, 11 May 2017 12:59:08 +0200 Subject: [PATCH] tests: remove the unit subdirectory Initially we planned to have different subdirectories for different kinds of tests (unit, tools etc.) but since it was decided that we'll reuse the already existing framework for all tests (in order to avoid having to reimplement the same functionality) we can get rid of the unit subdirectory. Signed-off-by: Bartosz Golaszewski --- README.md | 2 +- configure.ac | 3 +-- tests/Makefile.am | 28 ++++++++++++++++++++++- tests/{unit => }/gpiod-unit.c | 0 tests/{unit => }/gpiod-unit.h | 0 tests/{unit => }/tests-chip.c | 0 tests/{unit => }/tests-event.c | 0 tests/{unit => }/tests-iter.c | 0 tests/{unit => }/tests-line.c | 0 tests/{unit => }/tests-misc.c | 0 tests/{unit => }/tests-simple-api.c | 0 tests/unit/Makefile.am | 35 ----------------------------- 12 files changed, 29 insertions(+), 39 deletions(-) rename tests/{unit => }/gpiod-unit.c (100%) rename tests/{unit => }/gpiod-unit.h (100%) rename tests/{unit => }/tests-chip.c (100%) rename tests/{unit => }/tests-event.c (100%) rename tests/{unit => }/tests-iter.c (100%) rename tests/{unit => }/tests-line.c (100%) rename tests/{unit => }/tests-misc.c (100%) rename tests/{unit => }/tests-simple-api.c (100%) delete mode 100644 tests/unit/Makefile.am diff --git a/README.md b/README.md index 9443355..5860c06 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ As opposed to standard autotools projects, libgpiod doesn't execute any tests when invoking 'make check'. Instead the user must run them manually with superuser privileges: - sudo ./tests/unit/gpiod-unit + sudo ./tests/gpiod-unit CONTRIBUTING ------------ diff --git a/configure.ac b/configure.ac index f08d00d..02144dd 100644 --- a/configure.ac +++ b/configure.ac @@ -120,7 +120,6 @@ AC_CONFIG_FILES([Makefile src/Makefile src/lib/Makefile src/tools/Makefile - tests/Makefile - tests/unit/Makefile]) + tests/Makefile]) AC_OUTPUT diff --git a/tests/Makefile.am b/tests/Makefile.am index fe02e4a..4772216 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,4 +6,30 @@ # as published by the Free Software Foundation. # -SUBDIRS = . unit +AM_CFLAGS = -I$(top_srcdir)/include/ -include $(top_builddir)/config.h +AM_CFLAGS += -Wall -Wextra -g $(KMOD_CFLAGS) $(UDEV_CFLAGS) +AM_LDFLAGS = -pthread +LDADD = ../src/lib/libgpiod.la $(KMOD_LIBS) $(UDEV_LIBS) + +check_PROGRAMS = gpiod-unit + +gpiod_unit_SOURCES = gpiod-unit.c \ + gpiod-unit.h \ + tests-chip.c \ + tests-event.c \ + tests-iter.c \ + tests-line.c \ + tests-misc.c \ + tests-simple-api.c + +check: check-am + @echo " ********************************************************" + @echo " * Unit tests have been built as tests/gpio-unit. *" + @echo " * *" + @echo " * They require linux kernel version >=v4.11 and the *" + @echo " * gpio-mockup module (must not be built-in). *" + @echo " * *" + @echo " * Run the test executable with superuser privileges or *" + @echo " * make sure /dev/gpiochipX files are readable and *" + @echo " * writable by normal users. *" + @echo " ********************************************************" diff --git a/tests/unit/gpiod-unit.c b/tests/gpiod-unit.c similarity index 100% rename from tests/unit/gpiod-unit.c rename to tests/gpiod-unit.c diff --git a/tests/unit/gpiod-unit.h b/tests/gpiod-unit.h similarity index 100% rename from tests/unit/gpiod-unit.h rename to tests/gpiod-unit.h diff --git a/tests/unit/tests-chip.c b/tests/tests-chip.c similarity index 100% rename from tests/unit/tests-chip.c rename to tests/tests-chip.c diff --git a/tests/unit/tests-event.c b/tests/tests-event.c similarity index 100% rename from tests/unit/tests-event.c rename to tests/tests-event.c diff --git a/tests/unit/tests-iter.c b/tests/tests-iter.c similarity index 100% rename from tests/unit/tests-iter.c rename to tests/tests-iter.c diff --git a/tests/unit/tests-line.c b/tests/tests-line.c similarity index 100% rename from tests/unit/tests-line.c rename to tests/tests-line.c diff --git a/tests/unit/tests-misc.c b/tests/tests-misc.c similarity index 100% rename from tests/unit/tests-misc.c rename to tests/tests-misc.c diff --git a/tests/unit/tests-simple-api.c b/tests/tests-simple-api.c similarity index 100% rename from tests/unit/tests-simple-api.c rename to tests/tests-simple-api.c diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am deleted file mode 100644 index 33847ef..0000000 --- a/tests/unit/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (C) 2017 Bartosz Golaszewski -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of version 2.1 of the GNU Lesser General Public License -# as published by the Free Software Foundation. -# - -AM_CFLAGS = -I$(top_srcdir)/include/ -include $(top_builddir)/config.h -AM_CFLAGS += -Wall -Wextra -g $(KMOD_CFLAGS) $(UDEV_CFLAGS) -AM_LDFLAGS = -pthread -LDADD = ../../src/lib/libgpiod.la $(KMOD_LIBS) $(UDEV_LIBS) - -check_PROGRAMS = gpiod-unit - -gpiod_unit_SOURCES = gpiod-unit.c \ - gpiod-unit.h \ - tests-chip.c \ - tests-event.c \ - tests-iter.c \ - tests-line.c \ - tests-misc.c \ - tests-simple-api.c - -check: check-am - @echo " ********************************************************" - @echo " * Unit tests have been built as tests/unit/gpio-unit. *" - @echo " * *" - @echo " * They require linux kernel version >=v4.11 and the *" - @echo " * gpio-mockup module (must not be built-in). *" - @echo " * *" - @echo " * Run the test executable with superuser privileges or *" - @echo " * make sure /dev/gpiochipX files are readable and *" - @echo " * writable by normal users. *" - @echo " ********************************************************" -- 2.30.2