[open-ils-commits] [GIT] Evergreen ILS branch master updated. 33b6b485aff2b89312b9f6c3cb7f39e4857e2551
Evergreen Git
git at git.evergreen-ils.org
Thu Aug 1 11:23:31 EDT 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via 33b6b485aff2b89312b9f6c3cb7f39e4857e2551 (commit)
via ace3d994af1b375180fcafc533f12d32a20bc352 (commit)
from 11f04eaa4a97e78d8c8c11a63fff221e4935a13d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 33b6b485aff2b89312b9f6c3cb7f39e4857e2551
Author: Jason Etheridge <jason at esilibrary.com>
Date: Tue Jun 25 16:54:45 2013 -0400
C unit test examples for Evergreen
Building off of Kevin Beswick's work in OpenSRF
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/src/c-apps/Makefile.am b/Open-ILS/src/c-apps/Makefile.am
index 003b5ef..3006373 100644
--- a/Open-ILS/src/c-apps/Makefile.am
+++ b/Open-ILS/src/c-apps/Makefile.am
@@ -4,6 +4,8 @@
# Process this file with automake to generate Makefile.in
#-----------------------------------------------------------
+SUBDIRS = tests
+
AM_CFLAGS = $(DEF_CFLAGS) -DOSRF_LOG_PARAMS -I at top_srcdir@/include/
AM_LDFLAGS = $(DEF_LDFLAGS) -L$(DBI_LIBS) -lopensrf
diff --git a/Open-ILS/src/c-apps/tests/Makefile.am b/Open-ILS/src/c-apps/tests/Makefile.am
new file mode 100644
index 0000000..df9439f
--- /dev/null
+++ b/Open-ILS/src/c-apps/tests/Makefile.am
@@ -0,0 +1,21 @@
+export DEF_LDFLAGS = -L. -L$(TMP) -L$(OPENSRF_LIBS)
+export DEF_CFLAGS = -D_LARGEFILE64_SOURCE -pipe -g -Wall -O2 -fPIC -I at top_srcdir@/include -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) -I$(APR_HEADERS) -I$(LIBXML2_HEADERS)/libxml -I$(TMP) -I$(OPENSRF_HEADERS)
+export DEF_LDLIBS = -lopensrf
+
+COMMON = testsuite.c
+AM_CFLAGS = $(DEF_CFLAGS) -DOSRF_LOG_PARAMS
+AM_LDFLAGS = $(DEF_LDLIBS) -L$(DBI_LIBS)
+
+TESTS = check_util check_idl
+check_PROGRAMS = check_util check_idl
+
+check_util_SOURCES = $(COMMON) check_util.c
+check_util_CFLAGS = $(AM_CFLAGS)
+check_util_LDFLAGS = $(AM_LDFLAGS) -loils_idl -loils_utils -lcheck
+check_util_DEPENDENCIES = ../liboils_idl.la ../liboils_utils.la
+
+check_idl_SOURCES = $(COMMON) check_idl.c
+check_idl_CFLAGS = $(AM_CFLAGS)
+check_idl_LDFLAGS = $(AM_LDFLAGS) -loils_idl -loils_utils -lcheck
+check_idl_DEPENDENCIES = ../liboils_idl.la ../liboils_utils.la
+
diff --git a/Open-ILS/src/c-apps/tests/check_idl.c b/Open-ILS/src/c-apps/tests/check_idl.c
new file mode 100644
index 0000000..65f6d39
--- /dev/null
+++ b/Open-ILS/src/c-apps/tests/check_idl.c
@@ -0,0 +1,46 @@
+#include <check.h>
+#include <ctype.h>
+#include <limits.h>
+#include "openils/oils_utils.h"
+#include "openils/oils_idl.h"
+
+osrfHash * my_idl;
+
+//Set up the test fixture
+void setup (void) {
+ my_idl = oilsInitIDL("../../../examples/fm_IDL.xml");
+}
+
+//Clean up the test fixture
+void teardown (void) {
+ free(my_idl);
+}
+
+//Tests
+
+START_TEST (test_loading_idl)
+{
+ ck_assert(my_idl);
+}
+END_TEST
+
+//END Tests
+
+Suite *idl_suite (void) {
+ //Create test suite, test case, initialize fixture
+ Suite *s = suite_create("idl");
+ TCase *tc_core = tcase_create("Core");
+ tcase_add_checked_fixture(tc_core, setup, teardown);
+
+ //Add tests to test case
+ tcase_add_test(tc_core, test_loading_idl);
+
+ //Add test case to test suite
+ suite_add_tcase(s, tc_core);
+
+ return s;
+}
+
+void run_tests (SRunner *sr) {
+ srunner_add_suite (sr, idl_suite());
+}
diff --git a/Open-ILS/src/c-apps/tests/check_util.c b/Open-ILS/src/c-apps/tests/check_util.c
new file mode 100644
index 0000000..f7342a3
--- /dev/null
+++ b/Open-ILS/src/c-apps/tests/check_util.c
@@ -0,0 +1,46 @@
+#include <check.h>
+#include <ctype.h>
+#include <limits.h>
+#include "openils/oils_utils.h"
+#include "openils/oils_idl.h"
+
+//Set up the test fixture
+void setup (void) {
+}
+
+//Clean up the test fixture
+void teardown (void) {
+}
+
+//Tests
+
+START_TEST (test_oilsUtilsIsDBTrue)
+{
+ ck_assert_msg( ! oilsUtilsIsDBTrue("0"), "oilsUtilIsDBTrue() should be false when passed '0'");
+ ck_assert_msg( oilsUtilsIsDBTrue("1"), "oilsUtilIsDBTrue() should be true when passed '1'");
+ ck_assert_msg( oilsUtilsIsDBTrue("-1"), "oilsUtilIsDBTrue() should be true when passed '-1'");
+ ck_assert_msg( oilsUtilsIsDBTrue("a"), "oilsUtilIsDBTrue() should be true when passed 'a'");
+ ck_assert_msg( ! oilsUtilsIsDBTrue("f"), "oilsUtilIsDBTrue() should be false when passed 'f'");
+}
+END_TEST
+
+//END Tests
+
+Suite *util_suite (void) {
+ //Create test suite, test case, initialize fixture
+ Suite *s = suite_create("util");
+ TCase *tc_core = tcase_create("Core");
+ tcase_add_checked_fixture(tc_core, setup, teardown);
+
+ //Add tests to test case
+ tcase_add_test(tc_core, test_oilsUtilsIsDBTrue);
+
+ //Add test case to test suite
+ suite_add_tcase(s, tc_core);
+
+ return s;
+}
+
+void run_tests (SRunner *sr) {
+ srunner_add_suite (sr, util_suite());
+}
diff --git a/Open-ILS/src/c-apps/tests/testsuite.c b/Open-ILS/src/c-apps/tests/testsuite.c
new file mode 100644
index 0000000..e3fcae0
--- /dev/null
+++ b/Open-ILS/src/c-apps/tests/testsuite.c
@@ -0,0 +1,15 @@
+#include <stdlib.h>
+#include <check.h>
+#include "testsuite.h"
+
+extern void run_tests(SRunner *sr);
+
+int main (int argc, char **argv)
+{
+ SRunner *sr = srunner_create(NULL);
+ run_tests(sr);
+ srunner_run_all(sr, CK_NORMAL);
+ int failed = srunner_ntests_failed(sr);
+ srunner_free(sr);
+ return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/Open-ILS/src/c-apps/tests/testsuite.h b/Open-ILS/src/c-apps/tests/testsuite.h
new file mode 100644
index 0000000..b6ef586
--- /dev/null
+++ b/Open-ILS/src/c-apps/tests/testsuite.h
@@ -0,0 +1,4 @@
+#ifndef __OPENSRF_CHECK_H__
+#define __OPENSRF_CHECK_H__
+
+#endif /* __OPENSRF_CHECK_H__ */
diff --git a/configure.ac b/configure.ac
index d8ac271..99370e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -342,6 +342,7 @@ if test "x$openils_core" = "xtrue"; then
AC_CONFIG_FILES([Open-ILS/examples/Makefile
Open-ILS/src/c-apps/Makefile
+ Open-ILS/src/c-apps/tests/Makefile
Open-ILS/src/extras/Makefile
Open-ILS/src/java/Makefile
Open-ILS/src/python/Makefile])
commit ace3d994af1b375180fcafc533f12d32a20bc352
Author: Jason Etheridge <jason at esilibrary.com>
Date: Tue Jun 25 17:02:37 2013 -0400
The check library for Debian and Fedora
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/src/extras/Makefile.install b/Open-ILS/src/extras/Makefile.install
index c94cf4b..ba27736 100644
--- a/Open-ILS/src/extras/Makefile.install
+++ b/Open-ILS/src/extras/Makefile.install
@@ -59,6 +59,7 @@ DEBS = \
apache2-prefork-dev\
aspell\
aspell-en\
+ check\
libbusiness-creditcard-perl\
libbusiness-onlinepayment-authorizenet-perl\
libbusiness-onlinepayment-perl\
@@ -124,6 +125,8 @@ FEDORA_RPMS = \
aspell \
aspell-en \
bzip2-devel \
+ check \
+ check-devel \
libdbi \
libdbi-dbd-pgsql \
libdbi-devel \
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/c-apps/Makefile.am | 2 +
Open-ILS/src/c-apps/tests/Makefile.am | 21 ++++++++++++++
Open-ILS/src/c-apps/tests/check_idl.c | 46 ++++++++++++++++++++++++++++++++
Open-ILS/src/c-apps/tests/check_util.c | 46 ++++++++++++++++++++++++++++++++
Open-ILS/src/c-apps/tests/testsuite.c | 15 ++++++++++
Open-ILS/src/c-apps/tests/testsuite.h | 4 +++
Open-ILS/src/extras/Makefile.install | 3 ++
configure.ac | 1 +
8 files changed, 138 insertions(+), 0 deletions(-)
create mode 100644 Open-ILS/src/c-apps/tests/Makefile.am
create mode 100644 Open-ILS/src/c-apps/tests/check_idl.c
create mode 100644 Open-ILS/src/c-apps/tests/check_util.c
create mode 100644 Open-ILS/src/c-apps/tests/testsuite.c
create mode 100644 Open-ILS/src/c-apps/tests/testsuite.h
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list