From fc8a947691b68a4313c6c952f5868ae41d82cd54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Val=C3=AD=C4=8Dek?= Date: Sun, 14 Jun 2020 22:49:42 +0200 Subject: [PATCH] Sum version, tests disabled --- .gitignore | 22 +++++++++++++-- AUTHORS | 6 ----- Makefile.am | 17 +++++------- NEWS | 19 ------------- README | 76 ---------------------------------------------------- configure.ac | 1 - src/add.c | 5 ---- src/add.h | 6 ----- src/main.c | 10 ++----- src/test.c | 12 ++++++--- src/test.h | 4 +-- 11 files changed, 40 insertions(+), 138 deletions(-) delete mode 100644 AUTHORS delete mode 100644 NEWS delete mode 100644 README delete mode 100644 src/add.c delete mode 100644 src/add.h diff --git a/.gitignore b/.gitignore index 6f4411e..795c7ff 100644 --- a/.gitignore +++ b/.gitignore @@ -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 + diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 25cda79..0000000 --- a/AUTHORS +++ /dev/null @@ -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 diff --git a/Makefile.am b/Makefile.am index f7141a7..654b3a2 100644 --- a/Makefile.am +++ b/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 diff --git a/NEWS b/NEWS deleted file mode 100644 index 9e5cd13..0000000 --- a/NEWS +++ /dev/null @@ -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 - - - diff --git a/README b/README deleted file mode 100644 index bd5aa6c..0000000 --- a/README +++ /dev/null @@ -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 diff --git a/configure.ac b/configure.ac index 87be282..44d6183 100644 --- a/configure.ac +++ b/configure.ac @@ -33,7 +33,6 @@ if test "x${enable_myerror}" == "xyes"; then Results won't be real! ----------------------------------------------------------------------------------- ]) - fi AC_CONFIG_FILES([Makefile]) diff --git a/src/add.c b/src/add.c deleted file mode 100644 index f9049d6..0000000 --- a/src/add.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "add.h" - -int add(int a, int b) { - return a + b; -} diff --git a/src/add.h b/src/add.h deleted file mode 100644 index 085b06e..0000000 --- a/src/add.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef ADD_H -#define ADD_H - -int add(int a,int b); - -#endif /* ADD_H */ diff --git a/src/main.c b/src/main.c index a5112cb..feed65e 100644 --- a/src/main.c +++ b/src/main.c @@ -1,19 +1,13 @@ #ifdef HAVE_CONFIG_H -# include +#include #endif #include #include "test.h" -#include 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; } diff --git a/src/test.c b/src/test.c index f345fc3..b9c653f 100644 --- a/src/test.c +++ b/src/test.c @@ -1,6 +1,12 @@ #include #include "test.h" -void myfunc() -{ - printf("myfunc() called\n"); + +int mysum(int a, int b){ +#ifdef MYERROR + return 42; +#endif + + return a + b; + } + diff --git a/src/test.h b/src/test.h index 4e63e39..8997188 100644 --- a/src/test.h +++ b/src/test.h @@ -2,8 +2,8 @@ #define TEST_H #ifdef HAVE_CONFIG_H -# include +#include #endif -void myfunc(); +int mysum(int a, int b); #endif /* TEST_H */