Skip to content

Commit

Permalink
Merge pull request #61 from larsewi/bogus
Browse files Browse the repository at this point in the history
Make building test binary an option in configure script
  • Loading branch information
larsewi authored Apr 29, 2024
2 parents e213f83 + 6331e27 commit 7614a68
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 19 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ jobs:
- name: Bootstrap project
run: ./bootstrap.sh
- name: Configure project
run: ./configure --enable-debug=yes --with-csv-module=yes --with-psql-module=yes
run: >
./configure
--enable-debug
--with-test-binary
--with-csv-module
--with-psql-module
- name: Compile project
run: make
- name: Run acceptance tests
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,25 @@ jobs:
- name: Bootstrap project
run: ./bootstrap.sh
- name: Configure project with gcc compiler (all options enabled)
run: ./configure CC=gcc --enable-debug=yes --with-check=yes --with-csv-module=yes --with-psql-module=yes
run: >
./configure CC=gcc
--enable-debug=yes
--with-test-binary=yes
--with-check-framework=yes
--with-csv-module=yes
--with-psql-module=yes
- name: Compile project (all options enabled)
run: make
- name: Run tests (all options enabled)
run: make check
- name: Configure project with gcc compiler (all options disabled)
run: ./configure CC=gcc --enable-debug=no --with-check=yes --with-csv-module=no --with-psql-module=no
run: >
./configure CC=gcc
--enable-debug=no
--with-test-binary=no
--with-check-framework=yes
--with-csv-module=no
--with-psql-module=no
- name: Compile project (all options disabled)
run: make
- name: Run tests (all options disabled)
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,25 @@ jobs:
- name: Bootstrap project
run: ./bootstrap.sh
- name: Configure project with g++ compiler (all options enabled)
run: ./configure CC=g++ --enable-debug=yes --with-check=yes --with-psql-module=no --with-csv-module=no
run: >
./configure CC=g++
--enable-debug=yes
--with-test-binary=yes
--with-check-framework=yes
--with-psql-module=yes
--with-csv-module=yes
- name: Compile project (all options enabled)
run: make
- name: Run tests (all options enabled)
run: make check
- name: Configure project with g++ compiler (all options disabled)
run: ./configure CC=g++ --enable-debug=yes --with-check=yes --with-psql-module=no --with-csv-module=no
run: >
./configure CC=g++
--enable-debug=no
--with-test-binary=no
--with-check-framework=yes
--with-psql-module=no
--with-csv-module=no
- name: Compile project (all options disabled)
run: make
- name: Run tests (all options disabled)
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ jobs:
- name: Bootstrap project
run: ./bootstrap.sh
- name: Configure project
run: ./configure --enable-debug=yes --with-csv-module=yes --with-psql-module=yes
run: >
./configure
--enable-debug
--with-test-binary
--with-csv-module
--with-psql-module
- name: Compile project
run: make
- name: Run pytest
Expand Down
6 changes: 5 additions & 1 deletion bin/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
AM_CFLAGS = -Wall -Wextra -Werror
AM_CPPFLAGS = -include config.h

noinst_PROGRAMS = leech
noinst_PROGRAMS =

if BUILD_TEST_BINARY
noinst_PROGRAMS += leech

leech_SOURCES = main.c \
common.c common.h \
Expand All @@ -13,3 +16,4 @@ leech_SOURCES = main.c \
purge.c purge.h
leech_LDADD = @PSQL_LIBS@ $(top_builddir)/lib/libleech.la
leech_CFLAGS = @PSQL_CFLAGS@
endif
12 changes: 8 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])
AC_INIT([leech], [0.1.7], [https://github.com/larsewi/leech/issues], [leech],
AC_INIT([leech], [0.1.8], [https://github.com/larsewi/leech/issues], [leech],
[https://github.com/larsewi/leech])
AC_CONFIG_SRCDIR([lib/leech.h])

Expand Down Expand Up @@ -71,9 +71,13 @@ else
fi

# Compile with check test framework
AC_ARG_WITH([check], AS_HELP_STRING([--with-check], [use check test framework]))
AM_CONDITIONAL([USE_CHECK], [test "x$with_check" = "xyes"])
AS_IF([test "x$with_check" = "xyes"], [PKG_CHECK_MODULES([CHECK], [check])])
AC_ARG_WITH([check], AS_HELP_STRING([--with-check-framework], [use check framework]))
AM_CONDITIONAL([WITH_CHECK], [test "x$with_check_framework" = "xyes"])
AS_IF([test "x$with_check_framework" = "xyes"], [PKG_CHECK_MODULES([CHECK], [check])])

# Compile test binary
AC_ARG_WITH([test-binary], AS_HELP_STRING([--with-test-binary], [compile test binary (not intended for production)]))
AM_CONDITIONAL([BUILD_TEST_BINARY], [test "x$with_test_binary" = "xyes"])

# Compile CSV module
AC_ARG_WITH([csv-module], AS_HELP_STRING([--with-csv-module],
Expand Down
16 changes: 9 additions & 7 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ include_HEADERS = $(top_builddir)/lib/leech.h
lib_LTLIBRARIES = libleech.la

pkglib_LTLIBRARIES =

if BUILD_CSV_MODULE
pkglib_LTLIBRARIES += leech_csv.la
leech_csv_la_SOURCES = leech_csv.c
leech_csv_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
pkglib_LTLIBRARIES += leech_csv.la
leech_csv_la_SOURCES = leech_csv.c
leech_csv_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
endif

if BUILD_PSQL_MODULE
pkglib_LTLIBRARIES += leech_psql.la
leech_psql_la_SOURCES = leech_psql.c
leech_psql_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
leech_psql_la_CFLAGS = @PSQL_CFLAGS@
pkglib_LTLIBRARIES += leech_psql.la
leech_psql_la_SOURCES = leech_psql.c
leech_psql_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
leech_psql_la_CFLAGS = @PSQL_CFLAGS@
endif

libleech_la_SOURCES = leech.c \
Expand Down
2 changes: 1 addition & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AM_CFLAGS = -Wall -Wextra -Werror
AM_CPPFLAGS = -include config.h

if USE_CHECK
if WITH_CHECK
TESTS = unit_test leak_test
EXTRA_DIST = leak_test
check_PROGRAMS = unit_test
Expand Down

0 comments on commit 7614a68

Please sign in to comment.