Example 'make check'

This commit is contained in:
Ruben Laguna 2015-02-06 17:10:11 +01:00
parent 507e3c4213
commit 0a60c39c32
4 changed files with 31 additions and 4 deletions

12
.gitignore vendored
View File

@ -1,4 +1,5 @@
INSTALL
.deps
.dirstamp
Makefile
Makefile.in
aclocal.m4
@ -12,7 +13,6 @@ configure
depcomp
install-sh
missing
src/.deps/
src/Makefile
src/Makefile.in
src/*.o
@ -20,5 +20,9 @@ src/myexecutable
stamp-h1
*~
myexecutable
.dirstamp
test-driver
test-suite.log
tests/*.o
testsuite
testsuite.log
testsuite.trs

View File

@ -4,3 +4,14 @@ bin_PROGRAMS = myexecutable
myexecutable_SOURCES = \
src/main.c
myexecutable_CFLAGS = #--std=c11 # CFLAGS applicable to myexecutable_SOURCES
# Tests
# 'check' comes from 'make check'
check_PROGRAMS = testsuite # will generate and run testsuite exec
testsuite_CFLAGS = $(DEPS_CFLAGS) # DEPS_* are filled by PKG_CHECK_MODULES
testsuite_LIBS = $(DEPS_LIBS) # in configure.ac
testsuite_SOURCES = tests/test.c
TESTS = testsuite

View File

@ -44,5 +44,7 @@ AC_CHECK_HEADER([stdlib.h])
# Checks for library functions.
PKG_CHECK_MODULES([DEPS], [glib-2.0 >= 2.24.1]) # use pkg-config to fill DEPS_CFLAGS and DEPS_LIBS
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

10
tests/test.c Normal file
View File

@ -0,0 +1,10 @@
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
printf("Write some tests!!! Failing!\n");
exit(EXIT_FAILURE);
return 0;
}