Sum version, tests disabled
This commit is contained in:
parent
bbce30caa0
commit
fc8a947691
22
.gitignore
vendored
22
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
# original
|
||||
.deps
|
||||
.dirstamp
|
||||
Makefile
|
||||
|
@ -16,10 +17,8 @@ missing
|
|||
src/Makefile
|
||||
src/Makefile.in
|
||||
src/*.o
|
||||
src/myexecutable
|
||||
stamp-h1
|
||||
*~
|
||||
myexecutable
|
||||
test-driver
|
||||
test-suite.log
|
||||
tests/*.o
|
||||
|
@ -34,4 +33,23 @@ full-package-name-VERSION/
|
|||
*-coverage/
|
||||
*.gcda
|
||||
*.gcno
|
||||
# Added
|
||||
libtool
|
||||
.libs
|
||||
*.lo
|
||||
*.la
|
||||
main_executable
|
||||
|
||||
|
||||
# M4???
|
||||
m4/libtool.m4
|
||||
m4/ltoptions.m4
|
||||
m4/ltsugar.m4
|
||||
m4/ltversion.m4
|
||||
m4/lt~obsolete.m4
|
||||
|
||||
# build-aux
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
build-aux/ltmain.sh
|
||||
|
||||
|
|
6
AUTHORS
6
AUTHORS
|
@ -1,6 +0,0 @@
|
|||
Example: http://git.savannah.gnu.org/cgit/make.git/tree/AUTHORS
|
||||
|
||||
GNU Coding Standards 6.3: Recording Contributors
|
||||
http://www.gnu.org/prep/maintain/html_node/Recording-Contributors.html
|
||||
|
||||
First version of all files by Ruben Laguna <ruben.laguna at gmail.com>
|
17
Makefile.am
17
Makefile.am
|
@ -10,10 +10,7 @@ libtest_la_LDFLAGS = -version-info 0:0:0
|
|||
bin_PROGRAMS = main_executable
|
||||
|
||||
#include .c and .h in SOURCES so that both appear in dist
|
||||
main_executable_SOURCES = \
|
||||
src/add.c \
|
||||
src/add.h \
|
||||
src/main.c
|
||||
main_executable_SOURCES = src/main.c
|
||||
main_executable_CFLAGS = $(AM_CFLAGS) $(CODE_COVERAGE_CFLAGS) #--std=c11 # CFLAGS applicable to myexecutable_SOURCES
|
||||
main_executable_LDADD = libtest.la
|
||||
main_executable_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
|
||||
|
@ -31,13 +28,13 @@ main_executable_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
|
|||
CODE_COVERAGE_IGNORE_PATTERN = tests/*
|
||||
CODE_COVERAGE_IGNORE_PATTERN += stdio2.h
|
||||
|
||||
TESTS = add.ctaptest
|
||||
check_PROGRAMS = add.ctaptest
|
||||
#TESTS = add.ctaptest
|
||||
#check_PROGRAMS = add.ctaptest
|
||||
|
||||
add_ctaptest_SOURCES = tests/add.c src/add.c src/add.h
|
||||
add_ctaptest_CPPFLAGS = $(AM_CPPFLAGS) # so that tests find the header files
|
||||
add_ctaptest_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
|
||||
add_ctaptest_CFLAGS = $(CODE_COVERAGE_CFLAGS)
|
||||
#add_ctaptest_SOURCES = tests/add.c src/add.c src/add.h
|
||||
#add_ctaptest_CPPFLAGS = $(AM_CPPFLAGS) # so that tests find the header files
|
||||
#add_ctaptest_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
|
||||
#add_ctaptest_CFLAGS = $(CODE_COVERAGE_CFLAGS)
|
||||
|
||||
|
||||
# See http://www.gnu.org/software/automake/manual/html_node/Use-TAP-with-the-Automake-test-harness.html
|
||||
|
|
19
NEWS
19
NEWS
|
@ -1,19 +0,0 @@
|
|||
Read GNU Coding Standards 6.7
|
||||
http://www.gnu.org/prep/standards/html_node/NEWS-File.html#NEWS-File
|
||||
|
||||
Example: http://git.savannah.gnu.org/cgit/make.git/tree/NEWS
|
||||
|
||||
YourProject NEWS
|
||||
History of user-visible changes
|
||||
25 Jan 2015
|
||||
|
||||
See the end of this file for copyrights and conditions.
|
||||
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
* New features: XXXX
|
||||
Description of the feature
|
||||
|
||||
|
||||
|
76
README
76
README
|
@ -1,76 +0,0 @@
|
|||
# autotools-template
|
||||
Template for an autotools (autoconf, automake) project
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
Setting up an `Autotools` build system can be daunting. So I decided to
|
||||
create a template with the basics to use as the basis for my projects.
|
||||
|
||||
It may be surprising to the novice that there is no `./configure` but
|
||||
`./configure` is a generated file that it's shipped with the
|
||||
distribution of your software (the tarball that you get `make dist`).
|
||||
As such the `./configure` doesn't belong in the source control
|
||||
repository. Running `autoreconf -f` will generate `./configure` and a
|
||||
bunch of other files.
|
||||
|
||||
To build from scrath you need to perform:
|
||||
|
||||
autoreconf -i # Only needed if configure.ac or Makefile.am changes
|
||||
./configure # generates Makefiles and config.h
|
||||
make # build
|
||||
make check # run the tests
|
||||
|
||||
|
||||
I'm not an autotools expert by any means. So take my advice with a grain
|
||||
of salt.
|
||||
|
||||
There are two input files:
|
||||
|
||||
* `configure.ac`: The `./configure` script will be generated from
|
||||
from it. Here is were you check for libraries,
|
||||
headers, etc.
|
||||
* `Makefile.am`: This file will be transformed into `Makefile.in` that
|
||||
`./configure` will use to generate the `Makefile`.
|
||||
|
||||
Regarding tests, the basic aproach is to have multiple is to run some
|
||||
programs with the test and just check the exit code for those. This is
|
||||
simple and functional but you only get a PASS / FAIL per executable. To
|
||||
be able to get the individual tests results (asusming that there are
|
||||
several , potentially hundreds, of test on a single executable) you need
|
||||
to use the TAP.
|
||||
|
||||
The TAP aproach is that the executables that you use for test will
|
||||
output the test result on standard out so that `make check` will parse
|
||||
it, collect the results, and present them in a nice way.
|
||||
|
||||
I opted to go for the TAP approach although it requires a more complex
|
||||
setup.
|
||||
|
||||
What to do after cloning the repository
|
||||
=======================================
|
||||
|
||||
configure.ac
|
||||
------------
|
||||
|
||||
Edit configure.ac to change the FULL-PACKAGE-NAME, VERSION and
|
||||
BUG-REPORT-ADDRESS fields to match your project.
|
||||
|
||||
Makefile.am
|
||||
-----------
|
||||
|
||||
Edit src/Makefile.am to say which "products" (executables, binaries)
|
||||
will be generated and what are the source files for each one.
|
||||
|
||||
bin_PROGRAMS = executable1 executable2
|
||||
executable1_SOURCES = sourcefile1.c sourcefile2.c
|
||||
executable1_CFLAGS =
|
||||
executable2_SOURCES = sourcefile3.c sourcefile4.c
|
||||
executable2_CFLAGS =
|
||||
|
||||
|
||||
Reference material
|
||||
==================
|
||||
|
||||
Autotools: A Practitioner's Guide to GNU Autoconf, Automake, and Libtool by John Calcote
|
||||
Autotools Mythbuster https://autotools.io/index.html
|
|
@ -33,7 +33,6 @@ if test "x${enable_myerror}" == "xyes"; then
|
|||
Results won't be real!
|
||||
-----------------------------------------------------------------------------------
|
||||
])
|
||||
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef ADD_H
|
||||
#define ADD_H
|
||||
|
||||
int add(int a,int b);
|
||||
|
||||
#endif /* ADD_H */
|
10
src/main.c
10
src/main.c
|
@ -1,19 +1,13 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "test.h"
|
||||
#include <assert.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf ("Hello world\n");
|
||||
printf ("PACKAGE " PACKAGE "\n");
|
||||
printf ("PACKAGE_BUGREPORT " PACKAGE_BUGREPORT "\n");
|
||||
printf ("PACKAGE_NAME "PACKAGE_NAME "\n");
|
||||
printf ("PACKAGE_STRING " PACKAGE_STRING "\n");
|
||||
printf ("PACKAGE_TARNAME " PACKAGE_TARNAME "\n");
|
||||
assert( 1 > 0);
|
||||
printf("14 + 5 = %d\n", mysum(14, 5));
|
||||
return 0;
|
||||
}
|
||||
|
|
12
src/test.c
12
src/test.c
|
@ -1,6 +1,12 @@
|
|||
#include <stdio.h>
|
||||
#include "test.h"
|
||||
void myfunc()
|
||||
{
|
||||
printf("myfunc() called\n");
|
||||
|
||||
int mysum(int a, int b){
|
||||
#ifdef MYERROR
|
||||
return 42;
|
||||
#endif
|
||||
|
||||
return a + b;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#define TEST_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#include <config.h>
|
||||
#endif
|
||||
void myfunc();
|
||||
int mysum(int a, int b);
|
||||
|
||||
#endif /* TEST_H */
|
||||
|
|
Loading…
Reference in New Issue
Block a user