diff options
author | alcoheca <alcoheca@svn> | 2010-03-26 13:35:35 +0000 |
---|---|---|
committer | alcoheca <alcoheca@svn> | 2010-03-26 13:35:35 +0000 |
commit | b632a42d5cacdda7bb07a3fee995a4f0de1deba9 (patch) | |
tree | b174ecd7ce4830785293fa6d18ab65d30c0cc375 /lib/cpluff/test | |
parent | 5ccef76d00e1dc22d6ae5d1c08172630f5972e58 (diff) |
copied cpluff-0.1.3 from vendor branch
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@28834 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'lib/cpluff/test')
61 files changed, 5236 insertions, 0 deletions
diff --git a/lib/cpluff/test/Makefile.am b/lib/cpluff/test/Makefile.am new file mode 100644 index 0000000000..3c05d2f9fc --- /dev/null +++ b/lib/cpluff/test/Makefile.am @@ -0,0 +1,111 @@ +## Process this file with automake to produce Makefile.in. + +# Copyright 2007 Johannes Lehtinen +# This Makefile is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + +# This can be defined to a debugging wrapper program such as Valgrind. +TEST_WRAPPER = + +# This can be defined to a subset of test cases to be performed +SELECTED_TESTS = all + +DIST_SUBDIRS = plugins-source + +EXTRA_DIST = tests.txt + +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS += -DCP_HOST="\"$(host)\"" + +LIBS = @LIBS_OTHER@ @LIBS@ + +check_PROGRAMS = testsuite + +testsuite_SOURCES = psymbolusage.c extcfg.c pdependencies.c pcallbacks.c pscanning.c pinstallation.c ploading.c loggers.c collections.c initdestroy.c fatalerror.c cpinfo.c testmain.c test.h +testsuite_LDFLAGS = -dlopen self + +tmpinstalldir = $(CURDIR)/tmp/install + +check-local: install-plugins + @numf=0; numt=0; \ + run_test () { \ + local test="$$1"; \ + if test -x "$(srcdir)/test-$$test"; then \ + srcdir='$(srcdir)' TEST_WRAPPER='$(TEST_WRAPPER)' "$(srcdir)/test-$$test"; \ + rc=$$?; \ + else \ + eval srcdir='$(srcdir)' libtool --mode=execute $(TEST_WRAPPER) ./testsuite "\$$test"; \ + rc=$$?; \ + fi; \ + case $$rc in \ + 77) \ + echo "SKIPPED: $$test"; \ + ;; \ + 0) \ + echo "OK: $$test"; \ + numt=$$(($$numt + 1)); \ + ;; \ + *) \ + echo "FAIL: $$test"; \ + numt=$$(($$numt + 1)); \ + numf=$$(($$numf + 1)); \ + ;; \ + esac; \ + }; \ + echo; \ + echo '===================================================================='; \ + echo 'C-Pluff Test Suite'; \ + echo '===================================================================='; \ + if test '$(SELECTED_TESTS)' = all; then \ + while read test; do \ + run_test "$$test"; \ + done < '$(srcdir)/tests.txt'; \ + else \ + for test in $(SELECTED_TESTS); do \ + run_test "$$test"; \ + done; \ + fi; \ + echo '===================================================================='; \ + if test $$numf -gt 0; then \ + echo "FAILED: $$numf/$$numt"; \ + else \ + echo 'ALL OK!'; \ + fi; \ + echo '===================================================================='; \ + echo; \ + test $$numf -eq 0 + +clean-local: + rm -rf tmp + test ! -f plugins-source/Makefile || (cd plugins-source && $(MAKE) $(AM_MAKEFLAGS) clean) + +dist-hook: + $(MKDIR_P) '$(distdir)' + cp -p '$(srcdir)'/test-* '$(distdir)' + $(MKDIR_P) '$(distdir)/expected' + cp -p '$(srcdir)'/expected/*.txt '$(distdir)'/expected + $(MKDIR_P) '$(distdir)'/plugins + cd '$(srcdir)'/plugins && \ + for d in *; do \ + ( mkdir '$(distdir)'/plugins/"$$d" && \ + cp -p "$$d/plugin.xml" '$(distdir)'/plugins/"$$d" ) \ + || exit 1; \ + done + $(MKDIR_P) '$(distdir)'/pcollections + cd '$(srcdir)'/pcollections && \ + for d in */*; do \ + ( $(MKDIR_P) '$(distdir)'/pcollections/"$$d" && \ + cp -p "$$d/plugin.xml" '$(distdir)'/pcollections/"$$d" ) \ + || exit 1; \ + done + +install-plugins: build-plugins install-libcpluff + cd plugins-source && $(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(tmpinstalldir)' install + +build-plugins: + cd plugins-source && $(MAKE) + +install-libcpluff: + cd ../libcpluff && $(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(tmpinstalldir)' install + +.PHONY: build-plugins install-plugins install-libcpluff diff --git a/lib/cpluff/test/Makefile.in b/lib/cpluff/test/Makefile.in new file mode 100644 index 0000000000..8d7dacb27a --- /dev/null +++ b/lib/cpluff/test/Makefile.in @@ -0,0 +1,693 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2007 Johannes Lehtinen +# This Makefile is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = testsuite$(EXEEXT) +subdir = test +SUBDIRS = +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am_testsuite_OBJECTS = psymbolusage.$(OBJEXT) extcfg.$(OBJEXT) \ + pdependencies.$(OBJEXT) pcallbacks.$(OBJEXT) \ + pscanning.$(OBJEXT) pinstallation.$(OBJEXT) ploading.$(OBJEXT) \ + loggers.$(OBJEXT) collections.$(OBJEXT) initdestroy.$(OBJEXT) \ + fatalerror.$(OBJEXT) cpinfo.$(OBJEXT) testmain.$(OBJEXT) +testsuite_OBJECTS = $(am_testsuite_OBJECTS) +testsuite_LDADD = $(LDADD) +testsuite_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(testsuite_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/auxliary/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(testsuite_SOURCES) +DIST_SOURCES = $(testsuite_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPLUFF_LOADER = @CPLUFF_LOADER@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ -DCP_HOST="\"$(host)\"" +CP_CXX_LIB_VERSION = @CP_CXX_LIB_VERSION@ +CP_C_LIB_VERSION = @CP_C_LIB_VERSION@ +CP_VERSION_MAJOR = @CP_VERSION_MAJOR@ +CP_VERSION_MINOR = @CP_VERSION_MINOR@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS_OTHER@ @LIBS@ +LIBS_LIBCPLUFF = @LIBS_LIBCPLUFF@ +LIBS_OTHER = @LIBS_OTHER@ +LIBTOOL = @LIBTOOL@ +LIB_READLINE = @LIB_READLINE@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This can be defined to a debugging wrapper program such as Valgrind. +TEST_WRAPPER = + +# This can be defined to a subset of test cases to be performed +SELECTED_TESTS = all +DIST_SUBDIRS = plugins-source +EXTRA_DIST = tests.txt +testsuite_SOURCES = psymbolusage.c extcfg.c pdependencies.c pcallbacks.c pscanning.c pinstallation.c ploading.c loggers.c collections.c initdestroy.c fatalerror.c cpinfo.c testmain.c test.h +testsuite_LDFLAGS = -dlopen self +tmpinstalldir = $(CURDIR)/tmp/install +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +testsuite$(EXEEXT): $(testsuite_OBJECTS) $(testsuite_DEPENDENCIES) + @rm -f testsuite$(EXEEXT) + $(testsuite_LINK) $(testsuite_OBJECTS) $(testsuite_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collections.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extcfg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fatalerror.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/initdestroy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loggers.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcallbacks.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdependencies.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pinstallation.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ploading.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pscanning.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psymbolusage.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmain.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am check-local clean \ + clean-checkPROGRAMS clean-generic clean-libtool clean-local \ + ctags ctags-recursive dist-hook distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am + + +check-local: install-plugins + @numf=0; numt=0; \ + run_test () { \ + local test="$$1"; \ + if test -x "$(srcdir)/test-$$test"; then \ + srcdir='$(srcdir)' TEST_WRAPPER='$(TEST_WRAPPER)' "$(srcdir)/test-$$test"; \ + rc=$$?; \ + else \ + eval srcdir='$(srcdir)' libtool --mode=execute $(TEST_WRAPPER) ./testsuite "\$$test"; \ + rc=$$?; \ + fi; \ + case $$rc in \ + 77) \ + echo "SKIPPED: $$test"; \ + ;; \ + 0) \ + echo "OK: $$test"; \ + numt=$$(($$numt + 1)); \ + ;; \ + *) \ + echo "FAIL: $$test"; \ + numt=$$(($$numt + 1)); \ + numf=$$(($$numf + 1)); \ + ;; \ + esac; \ + }; \ + echo; \ + echo '===================================================================='; \ + echo 'C-Pluff Test Suite'; \ + echo '===================================================================='; \ + if test '$(SELECTED_TESTS)' = all; then \ + while read test; do \ + run_test "$$test"; \ + done < '$(srcdir)/tests.txt'; \ + else \ + for test in $(SELECTED_TESTS); do \ + run_test "$$test"; \ + done; \ + fi; \ + echo '===================================================================='; \ + if test $$numf -gt 0; then \ + echo "FAILED: $$numf/$$numt"; \ + else \ + echo 'ALL OK!'; \ + fi; \ + echo '===================================================================='; \ + echo; \ + test $$numf -eq 0 + +clean-local: + rm -rf tmp + test ! -f plugins-source/Makefile || (cd plugins-source && $(MAKE) $(AM_MAKEFLAGS) clean) + +dist-hook: + $(MKDIR_P) '$(distdir)' + cp -p '$(srcdir)'/test-* '$(distdir)' + $(MKDIR_P) '$(distdir)/expected' + cp -p '$(srcdir)'/expected/*.txt '$(distdir)'/expected + $(MKDIR_P) '$(distdir)'/plugins + cd '$(srcdir)'/plugins && \ + for d in *; do \ + ( mkdir '$(distdir)'/plugins/"$$d" && \ + cp -p "$$d/plugin.xml" '$(distdir)'/plugins/"$$d" ) \ + || exit 1; \ + done + $(MKDIR_P) '$(distdir)'/pcollections + cd '$(srcdir)'/pcollections && \ + for d in */*; do \ + ( $(MKDIR_P) '$(distdir)'/pcollections/"$$d" && \ + cp -p "$$d/plugin.xml" '$(distdir)'/pcollections/"$$d" ) \ + || exit 1; \ + done + +install-plugins: build-plugins install-libcpluff + cd plugins-source && $(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(tmpinstalldir)' install + +build-plugins: + cd plugins-source && $(MAKE) + +install-libcpluff: + cd ../libcpluff && $(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(tmpinstalldir)' install + +.PHONY: build-plugins install-plugins install-libcpluff +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/cpluff/test/collections.c b/lib/cpluff/test/collections.c new file mode 100644 index 0000000000..7c1c7405ba --- /dev/null +++ b/lib/cpluff/test/collections.c @@ -0,0 +1,99 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include "test.h" + +void nocollections(void) { + cp_context_t *ctx; + cp_plugin_info_t **plugins; + cp_status_t status; + int errors; + int i; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_scan_plugins(ctx, 0) == CP_OK); + check((plugins = cp_get_plugins_info(ctx, &status, &i)) != NULL && status == CP_OK && i == 0); + cp_release_info(ctx, plugins); + cp_destroy(); + check(errors == 0); +} + +void onecollection(void) { + cp_context_t *ctx; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); + cp_destroy(); + check(errors == 0); +} + +void twocollections(void) { + cp_context_t *ctx; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); + check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_INSTALLED); + cp_destroy(); + check(errors == 0); +} + +void unregcollection(void) { + cp_context_t *ctx; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); + check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); + cp_unregister_pcollection(ctx, pcollectiondir("collection2")); + check(cp_scan_plugins(ctx, 0) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_UNINSTALLED); + check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_UNINSTALLED); + cp_destroy(); + check(errors == 0); +} + +void unregcollections(void) { + cp_context_t *ctx; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); + check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); + cp_unregister_pcollections(ctx); + check(cp_scan_plugins(ctx, 0) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_UNINSTALLED); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_UNINSTALLED); + check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_UNINSTALLED); + cp_destroy(); + check(errors == 0); +} diff --git a/lib/cpluff/test/cpinfo.c b/lib/cpluff/test/cpinfo.c new file mode 100644 index 0000000000..10c1bb89fc --- /dev/null +++ b/lib/cpluff/test/cpinfo.c @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <string.h> +#include "test.h" +#include <cpluff.h> + +void getversion(void) { + check(cp_get_version() != NULL); + check(!strcmp(cp_get_version(), CP_VERSION)); +} + +void gethosttype(void) { + check(cp_get_host_type() != NULL); + check(!strcmp(cp_get_host_type(), CP_HOST)); +} diff --git a/lib/cpluff/test/expected/output-extensions.txt b/lib/cpluff/test/expected/output-extensions.txt new file mode 100644 index 0000000000..8dbd4d4aa1 --- /dev/null +++ b/lib/cpluff/test/expected/output-extensions.txt @@ -0,0 +1,7 @@ +Installed extensions: + IDENTIFIER NAME + maximal.ext1 Extension 1 + maximal.<anonymous> + maximal.<anonymous> Extension 3 + maximal.ext2 +C-Pluff Console > diff --git a/lib/cpluff/test/expected/output-extpoints.txt b/lib/cpluff/test/expected/output-extpoints.txt new file mode 100644 index 0000000000..f422aa5159 --- /dev/null +++ b/lib/cpluff/test/expected/output-extpoints.txt @@ -0,0 +1,7 @@ +Installed extension points: + IDENTIFIER NAME + maximal.extpt4 + maximal.extpt2 Extension Point 2 + maximal.extpt1 Extension Point 1 + maximal.extpt3 +C-Pluff Console > diff --git a/lib/cpluff/test/expected/output-loadmaximal.txt b/lib/cpluff/test/expected/output-loadmaximal.txt new file mode 100644 index 0000000000..7369863054 --- /dev/null +++ b/lib/cpluff/test/expected/output-loadmaximal.txt @@ -0,0 +1,93 @@ +{ + identifier = "maximal", + name = "Maximal", + version = "1.0.0.max", + provider_name = "Maximal Provider", + abi_bw_compatibility = "1.0", + api_bw_compatibility = "0.8", + req_cpluff_version = "999.3.4", + imports = {{ + plugin_id = "dependency1", + version = "0.1", + optional = 1, + }, { + plugin_id = "dependency2", + version = "0.2", + optional = 0, + }, { + plugin_id = "dependency3", + version = NULL, + optional = 1, + }, { + plugin_id = "dependency4", + version = NULL, + optional = 0, + }}, + runtime_lib_name = "nonexisting", + runtime_funcs_symbol = "funcs", + ext_points = {{ + local_id = "extpt1", + identifier = "maximal.extpt1", + name = "Extension Point 1", + schema_path = "ext1.xsd", + }, { + local_id = "extpt2", + identifier = "maximal.extpt2", + name = "Extension Point 2", + schema_path = NULL, + }, { + local_id = "extpt3", + identifier = "maximal.extpt3", + name = NULL, + schema_path = "extpt3.xsd", + }, { + local_id = "extpt4", + identifier = "maximal.extpt4", + name = NULL, + schema_path = NULL, + }}, + extensions = {{ + ext_point_id = "nonexisting.extptA", + local_id = "ext1", + identifier = "maximal.ext1", + name = "Extension 1", + configuration = { + <extension point="nonexisting.extptA" id="ext1" name="Extension 1">Extension data begins + <structure>Structure ends + <parameter>parameter</parameter> + <parameter>param2</parameter> + <assertion>1<2</assertion> + <deeper> + <struct> + <is>here</is> + </struct> + </deeper> + </structure> + </extension> + }, + }, { + ext_point_id = "nonexisting.extptB", + local_id = "ext2", + identifier = "maximal.ext2", + name = NULL, + configuration = { + <extension point="nonexisting.extptB" id="ext2"/> + }, + }, { + ext_point_id = "maximal.extpt1", + local_id = NULL, + identifier = NULL, + name = "Extension 3", + configuration = { + <extension point="maximal.extpt1" name="Extension 3"/> + }, + }, { + ext_point_id = "maximal.extpt2", + local_id = NULL, + identifier = NULL, + name = NULL, + configuration = { + <extension point="maximal.extpt2"/> + }, + }} +} diff --git a/lib/cpluff/test/expected/output-loadminimal.txt b/lib/cpluff/test/expected/output-loadminimal.txt new file mode 100644 index 0000000000..8064a25f30 --- /dev/null +++ b/lib/cpluff/test/expected/output-loadminimal.txt @@ -0,0 +1,14 @@ +{ + identifier = "minimal", + name = NULL, + version = NULL, + provider_name = NULL, + abi_bw_compatibility = NULL, + api_bw_compatibility = NULL, + req_cpluff_version = NULL, + imports = {}, + runtime_lib_name = NULL, + runtime_funcs_symbol = NULL, + ext_points = {}, + extensions = {}, +} diff --git a/lib/cpluff/test/extcfg.c b/lib/cpluff/test/extcfg.c new file mode 100644 index 0000000000..9e55289ee6 --- /dev/null +++ b/lib/cpluff/test/extcfg.c @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <string.h> +#include "test.h" + +void extcfgutils(void) { + cp_context_t *ctx; + cp_plugin_info_t *plugin; + cp_extension_t *ext; + cp_cfg_element_t *ce, *cebase; + const char *str; + int errors; + cp_status_t status; + int i; + + ctx = init_context(CP_LOG_ERROR, &errors); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("maximal"), &status)) != NULL && status == CP_OK); + for (i = 0, ext = NULL; ext == NULL && i < plugin->num_extensions; i++) { + cp_extension_t *e = plugin->extensions + i; + if (e->identifier != NULL && !strcmp(e->local_id, "ext1")) { + ext = e; + } + } + check(ext != NULL); + + // Look up using forward path + check((ce = cp_lookup_cfg_element(ext->configuration, "structure/parameter")) != NULL && ce->value != NULL && strcmp(ce->value, "parameter") == 0); + check((ce = cebase = cp_lookup_cfg_element(ext->configuration, "structure/deeper/struct/is")) != NULL && ce->value != NULL && strcmp(ce->value, "here") == 0); + check((str = cp_lookup_cfg_value(ext->configuration, "structure/parameter")) != NULL && strcmp(str, "parameter") == 0); + check((str = cp_lookup_cfg_value(ext->configuration, "@name")) != NULL && strcmp(str, "Extension 1") == 0); + + // Look up using reverse path + check((ce = cp_lookup_cfg_element(cebase, "../../../parameter/../deeper")) != NULL && strcmp(ce->name, "deeper") == 0); + check((str = cp_lookup_cfg_value(cebase, "../../../../@name")) != NULL && strcmp(str, "Extension 1") == 0); + + // Look up nonexisting components + check(cp_lookup_cfg_element(ext->configuration, "non/existing") == NULL); + check(cp_lookup_cfg_element(ext->configuration, "structure/../..") == NULL); + check(cp_lookup_cfg_value(ext->configuration, "non/existing") == NULL); + check(cp_lookup_cfg_value(ext->configuration, "structure/../..") == NULL); + check(cp_lookup_cfg_value(ext->configuration, "structure@nonexisting") == NULL); + + cp_release_info(ctx, plugin); + cp_destroy_context(ctx); + check(errors == 0); +} diff --git a/lib/cpluff/test/fatalerror.c b/lib/cpluff/test/fatalerror.c new file mode 100644 index 0000000000..fbfc443182 --- /dev/null +++ b/lib/cpluff/test/fatalerror.c @@ -0,0 +1,59 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include "test.h" + +static int testvar; + +static void cause_fatal_error(void) { + cp_context_t *ctx; + + cp_init(); + ctx = init_context(CP_LOG_ERROR + 1, NULL); + cp_release_info(ctx, &testvar); + cp_destroy(); +} + +void fatalerrordefault(void) { + cause_fatal_error(); +} + +static void error_handler(const char *msg) { + free_test_resources(); + exit(0); +} + +void fatalerrorhandled(void) { + cp_set_fatal_error_handler(error_handler); + cause_fatal_error(); + free_test_resources(); + exit(1); +} + +void fatalerrorreset(void) { + cp_set_fatal_error_handler(error_handler); + cp_set_fatal_error_handler(NULL); + cause_fatal_error(); +} diff --git a/lib/cpluff/test/initdestroy.c b/lib/cpluff/test/initdestroy.c new file mode 100644 index 0000000000..9f0ae57401 --- /dev/null +++ b/lib/cpluff/test/initdestroy.c @@ -0,0 +1,125 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include "test.h" +#include <cpluff.h> + +void initdestroy(void) { + int i; + + for (i = 0; i < 10; i++) { + check(cp_init() == CP_OK); + cp_destroy(); + } +} + +void initcreatedestroy(void) { + int i; + + for (i = 0; i < 3; i++) { + int errors; + + init_context(CP_LOG_ERROR, &errors); + cp_destroy(); + check(errors == 0); + } +} + +void initloaddestroy(void) { + int i; + + for (i = 0; i < 3; i++) { + cp_context_t *ctx; + cp_plugin_info_t *pi; + cp_status_t status; + const char *pdir = plugindir("minimal"); + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check((pi = cp_load_plugin_descriptor(ctx, pdir, &status)) != NULL && status == CP_OK); + cp_release_info(ctx, pi); + cp_destroy(); + check(errors == 0); + } +} + +void initinstalldestroy(void) { + int i; + + for (i = 0; i < 3; i++) { + cp_context_t *ctx; + cp_plugin_info_t *pi; + cp_status_t status; + const char *pdir = plugindir("minimal"); + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check((pi = cp_load_plugin_descriptor(ctx, pdir, &status)) != NULL && status == CP_OK); + check(cp_install_plugin(ctx, pi) == CP_OK); + cp_release_info(ctx, pi); + cp_destroy(); + check(errors == 0); + } +} + +void initstartdestroy(void) { + int i; + + for (i = 0; i < 3; i++) { + cp_context_t *ctx; + cp_plugin_info_t *pi; + cp_status_t status; + const char *pdir = plugindir("minimal"); + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check((pi = cp_load_plugin_descriptor(ctx, pdir, &status)) != NULL && status == CP_OK); + check(cp_install_plugin(ctx, pi) == CP_OK); + cp_release_info(ctx, pi); + check(cp_start_plugin(ctx, "minimal") == CP_OK); + cp_destroy(); + check(errors == 0); + } +} + +void initstartdestroyboth(void) { + int i; + + for (i = 0; i < 3; i++) { + cp_context_t *ctx; + cp_plugin_info_t *pi; + cp_status_t status; + const char *pdir = plugindir("minimal"); + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check((pi = cp_load_plugin_descriptor(ctx, pdir, &status)) != NULL && status == CP_OK); + check(cp_install_plugin(ctx, pi) == CP_OK); + cp_release_info(ctx, pi); + check(cp_start_plugin(ctx, "minimal") == CP_OK); + cp_destroy_context(ctx); + cp_destroy(); + check(errors == 0); + } +} diff --git a/lib/cpluff/test/loggers.c b/lib/cpluff/test/loggers.c new file mode 100644 index 0000000000..36f83e353f --- /dev/null +++ b/lib/cpluff/test/loggers.c @@ -0,0 +1,247 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "test.h" + +void errorlogger(void) { + cp_context_t *ctx; + cp_status_t status; + int errors; + + ctx = init_context(CP_LOG_ERROR + 1, &errors); + check(cp_load_plugin_descriptor(ctx, "nonexisting", &status) == NULL && status != CP_OK); + cp_destroy(); + check(errors > 0); +} + +struct log_count_t { + cp_log_severity_t max_severity; + int count_max; + int count_above_max; +}; + +static void counting_logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { + struct log_count_t *lc = user_data; + + if (severity <= lc->max_severity) { + lc->count_max++; + } else { + lc->count_above_max++; + } +} + +void warninglogger(void) { + cp_context_t *ctx; + struct log_count_t lc = { CP_LOG_WARNING, 0, 0 }; + + ctx = init_context(CP_LOG_ERROR, NULL); + check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_WARNING) == CP_OK); + check(cp_start_plugin(ctx, "nonexisting") == CP_ERR_UNKNOWN); + cp_destroy(); + check(lc.count_max > 0 && lc.count_above_max == 0); +} + +void infologger(void) { + cp_context_t *ctx; + cp_plugin_info_t *plugin; + cp_status_t status; + struct log_count_t lc = { CP_LOG_INFO, 0, 0 }; + + ctx = init_context(CP_LOG_WARNING, NULL); + check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_INFO) == CP_OK); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); + check(cp_install_plugin(ctx, plugin) == CP_OK); + cp_release_info(ctx, plugin); + cp_destroy(); + check(lc.count_max > 0 && lc.count_above_max == 0); +} + +void debuglogger(void) { + cp_context_t *ctx; + struct log_count_t lc = { CP_LOG_DEBUG, 0, 0 }; + + ctx = init_context(CP_LOG_INFO, NULL); + check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_DEBUG) == CP_OK); + cp_destroy(); + check(lc.count_max > 0 && lc.count_above_max == 0); +} + +static void increment_logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { + (*((int *) user_data))++; +} + +void twologgers(void) { + cp_context_t *ctx; + cp_plugin_info_t *plugin; + cp_status_t status; + struct log_count_t lc = { CP_LOG_DEBUG, 0, 0 }; + int count = 0; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_DEBUG) == CP_OK); + check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); + check(cp_register_logger(ctx, increment_logger, &count, CP_LOG_INFO) == CP_OK); + check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); + check(cp_install_plugin(ctx, plugin) == CP_OK); + cp_release_info(ctx, plugin); + check(count > 0 && lc.count_max > 0 && lc.count_above_max > 0); + cp_destroy(); + check(errors == 0); +} + +void unreglogger(void) { + cp_context_t *ctx; + cp_plugin_info_t *plugin; + cp_status_t status; + struct log_count_t lc = { CP_LOG_DEBUG, 0, 0 }; + int count = 0; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_DEBUG) == CP_OK); + check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); + check(cp_register_logger(ctx, increment_logger, &count, CP_LOG_INFO) == CP_OK); + check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); + cp_unregister_logger(ctx, counting_logger); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); + check(cp_install_plugin(ctx, plugin) == CP_OK); + cp_release_info(ctx, plugin); + check(count > 0 && lc.count_max > 0 && lc.count_above_max == 0); + cp_destroy(); + check(errors == 0); +} + +void updatelogger(void) { + cp_context_t *ctx; + cp_plugin_info_t *plugin; + cp_status_t status; + struct log_count_t lc = { CP_LOG_DEBUG, 0, 0 }; + struct log_count_t lc2 = { CP_LOG_INFO, 0, 0 }; + int count = 0; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_DEBUG) == CP_OK); + check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); + check(cp_register_logger(ctx, increment_logger, &count, CP_LOG_INFO) == CP_OK); + check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); + check(cp_register_logger(ctx, counting_logger, &lc2, CP_LOG_DEBUG) == CP_OK); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); + check(cp_install_plugin(ctx, plugin) == CP_OK); + cp_release_info(ctx, plugin); + check(count > 0 && lc.count_max > 0 && lc.count_above_max == 0); + cp_destroy(); + check(errors == 0); +} + +struct log_info_t { + cp_log_severity_t severity; + char *msg; + char *apid; +}; + +static void store_logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { + struct log_info_t *li = user_data; + + // Free previous data + if (li->msg != NULL) { + free(li->msg); + li->msg = NULL; + } + if (li->apid != NULL) { + free(li->apid); + li->apid = NULL; + } + + // Copy information + li->severity = severity; + if (msg != NULL) { + check((li->msg = strdup(msg)) != NULL); + } + if (apid != NULL) { + check((li->apid = strdup(apid)) != NULL); + } +} + +static void logmsg_sev(cp_context_t *ctx, cp_log_severity_t severity, const char *msg) { + struct log_info_t li = { -1, NULL, NULL }; + + check(cp_register_logger(ctx, store_logger, &li, CP_LOG_DEBUG) == CP_OK); + cp_log(ctx, severity, msg); + check(li.severity == severity); + check(li.msg != NULL && !strcmp(li.msg, msg)); + check(li.apid == NULL); + free(li.msg); + li.msg = NULL; + cp_unregister_logger(ctx, store_logger); +} + +void logmsg(void) { + cp_context_t *ctx; + + ctx = init_context(CP_LOG_ERROR + 1, NULL); + logmsg_sev(ctx, CP_LOG_DEBUG, "debug"); + logmsg_sev(ctx, CP_LOG_INFO, "info"); + logmsg_sev(ctx, CP_LOG_WARNING, "warning"); + logmsg_sev(ctx, CP_LOG_ERROR, "error"); + cp_destroy(); +} + +static void islogged_sev(cp_context_t *ctx, cp_log_severity_t severity) { + int count = 0; + + check(!cp_is_logged(ctx, severity)); + check(cp_register_logger(ctx, increment_logger, &count, severity) == CP_OK); + check(cp_is_logged(ctx, CP_LOG_ERROR)); + check(cp_is_logged(ctx, severity)); + switch (severity) { + case CP_LOG_DEBUG: + break; + case CP_LOG_INFO: + check(!cp_is_logged(ctx, CP_LOG_DEBUG)); + break; + case CP_LOG_WARNING: + check(!cp_is_logged(ctx, CP_LOG_INFO)); + break; + case CP_LOG_ERROR: + check(!cp_is_logged(ctx, CP_LOG_WARNING)); + break; + } + cp_unregister_logger(ctx, increment_logger); +} + +void islogged(void) { + cp_context_t *ctx; + + ctx = init_context(CP_LOG_ERROR + 1, NULL); + islogged_sev(ctx, CP_LOG_DEBUG); + islogged_sev(ctx, CP_LOG_INFO); + islogged_sev(ctx, CP_LOG_WARNING); + islogged_sev(ctx, CP_LOG_ERROR); + cp_destroy(); +} diff --git a/lib/cpluff/test/pcallbacks.c b/lib/cpluff/test/pcallbacks.c new file mode 100644 index 0000000000..0a2340c4ae --- /dev/null +++ b/lib/cpluff/test/pcallbacks.c @@ -0,0 +1,119 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "plugins-source/callbackcounter/callbackcounter.h" +#include "test.h" + +static char *argv[] = { "testarg0", NULL }; + +void plugincallbacks(void) { + cp_context_t *ctx; + cp_status_t status; + cp_plugin_info_t *plugin; + int errors; + cbc_counters_t *counters; + + ctx = init_context(CP_LOG_ERROR, &errors); + cp_set_context_args(ctx, argv); + check((plugin = cp_load_plugin_descriptor(ctx, "tmp/install/plugins/callbackcounter", &status)) != NULL && status == CP_OK); + check(cp_install_plugin(ctx, plugin) == CP_OK); + cp_release_info(ctx, plugin); + + // Start plug-in implicitly by resolving a symbol + check((counters = cp_resolve_symbol(ctx, "callbackcounter", "cbc_counters", &status)) != NULL && status == CP_OK); + check(counters->create == 1); + check(counters->start == 1); + check(counters->logger == 0); + check(counters->listener == 1); + check(counters->run == 0); + check(counters->stop == 0); + check(counters->destroy == 0); + check(counters->context_arg_0 != NULL && strcmp(counters->context_arg_0, argv[0]) == 0); + + // Cause warning + check(cp_start_plugin(ctx, "nonexisting") == CP_ERR_UNKNOWN); + check(counters->create == 1); + check(counters->start == 1); + check(counters->logger == 1); + check(counters->listener == 1); + check(counters->run == 0); + check(counters->stop == 0); + check(counters->destroy == 0); + + // Run run function once + check(cp_run_plugins_step(ctx)); + check(counters->create == 1); + check(counters->start == 1); + check(counters->logger == 1); + check(counters->listener == 1); + check(counters->run == 1); + check(counters->stop == 0); + check(counters->destroy == 0); + + // Run run function until no more work to be done (run = 3) + cp_run_plugins(ctx); + check(counters->create == 1); + check(counters->start == 1); + check(counters->logger == 1); + check(counters->listener == 1); + check(counters->run == 3); + check(counters->stop == 0); + check(counters->destroy == 0); + + /* + * Normally symbols must not be accessed after they have been released. + * We still access counters here because we know that the plug-in + * implementation does not free the counter data. + */ + cp_release_symbol(ctx, counters); + + // Stop plug-in + check(cp_stop_plugin(ctx, "callbackcounter") == CP_OK); + check(counters->create == 1); + check(counters->start == 1); + check(counters->logger == 1); + check(counters->listener == 2); + check(counters->run == 3); + check(counters->stop == 1); + // for now 1 but might be 0 in future (delay destroy) + check(counters->destroy == 0 || counters->destroy == 1); + + // Uninstall plugin + check(cp_uninstall_plugin(ctx, "callbackcounter") == CP_OK); + check(counters->create == 1); + check(counters->start == 1); + check(counters->logger == 1); + check(counters->listener == 2); + check(counters->run == 3); + check(counters->stop == 1); + check(counters->destroy == 1); + + cp_destroy(); + check(errors == 0); + + /* Free the counter data that was intentionally leaked by the plug-in */ + free(counters); +} diff --git a/lib/cpluff/test/pcollections/collection1/plugin1/plugin.xml b/lib/cpluff/test/pcollections/collection1/plugin1/plugin.xml new file mode 100644 index 0000000000..f35bd7add8 --- /dev/null +++ b/lib/cpluff/test/pcollections/collection1/plugin1/plugin.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<plugin id="plugin1"/> diff --git a/lib/cpluff/test/pcollections/collection1v2/plugin1/plugin.xml b/lib/cpluff/test/pcollections/collection1v2/plugin1/plugin.xml new file mode 100644 index 0000000000..d3858009b6 --- /dev/null +++ b/lib/cpluff/test/pcollections/collection1v2/plugin1/plugin.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<plugin id="plugin1" version="2"/> diff --git a/lib/cpluff/test/pcollections/collection1v3/plugin1/plugin.xml b/lib/cpluff/test/pcollections/collection1v3/plugin1/plugin.xml new file mode 100644 index 0000000000..f4f2eedbb6 --- /dev/null +++ b/lib/cpluff/test/pcollections/collection1v3/plugin1/plugin.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<plugin id="plugin1" version="3"/> diff --git a/lib/cpluff/test/pcollections/collection2/plugin2a/plugin.xml b/lib/cpluff/test/pcollections/collection2/plugin2a/plugin.xml new file mode 100644 index 0000000000..2f8796a3d4 --- /dev/null +++ b/lib/cpluff/test/pcollections/collection2/plugin2a/plugin.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<plugin id="plugin2a"/> diff --git a/lib/cpluff/test/pcollections/collection2/plugin2b/plugin.xml b/lib/cpluff/test/pcollections/collection2/plugin2b/plugin.xml new file mode 100644 index 0000000000..2d24170610 --- /dev/null +++ b/lib/cpluff/test/pcollections/collection2/plugin2b/plugin.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<plugin id="plugin2b"/> diff --git a/lib/cpluff/test/pcollections/dependencies/chain1/plugin.xml b/lib/cpluff/test/pcollections/dependencies/chain1/plugin.xml new file mode 100644 index 0000000000..674622a2d1 --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/chain1/plugin.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<plugin id="chain1"> + <requires> + <import plugin="chain2"/> + </requires> +</plugin>
\ No newline at end of file diff --git a/lib/cpluff/test/pcollections/dependencies/chain2/plugin.xml b/lib/cpluff/test/pcollections/dependencies/chain2/plugin.xml new file mode 100644 index 0000000000..a2b3af51cd --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/chain2/plugin.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<plugin id="chain2"> + <requires> + <import plugin="chain3"/> + </requires> +</plugin>
\ No newline at end of file diff --git a/lib/cpluff/test/pcollections/dependencies/chain3/plugin.xml b/lib/cpluff/test/pcollections/dependencies/chain3/plugin.xml new file mode 100644 index 0000000000..1825ff9151 --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/chain3/plugin.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<plugin id="chain3"/> diff --git a/lib/cpluff/test/pcollections/dependencies/chainmissingdep/plugin.xml b/lib/cpluff/test/pcollections/dependencies/chainmissingdep/plugin.xml new file mode 100644 index 0000000000..ad9ec9a646 --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/chainmissingdep/plugin.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<plugin id="chainmissingdep"> + <requires> + <import plugin="missingdep"/> + </requires> +</plugin>
\ No newline at end of file diff --git a/lib/cpluff/test/pcollections/dependencies/loop1/plugin.xml b/lib/cpluff/test/pcollections/dependencies/loop1/plugin.xml new file mode 100644 index 0000000000..aa9d2f386c --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/loop1/plugin.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<plugin id="loop1"> + <requires> + <import plugin="loop2"/> + </requires> +</plugin> diff --git a/lib/cpluff/test/pcollections/dependencies/loop2/plugin.xml b/lib/cpluff/test/pcollections/dependencies/loop2/plugin.xml new file mode 100644 index 0000000000..efdf5013f0 --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/loop2/plugin.xml @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<plugin id="loop2"> + <requires> + <import plugin="loop3"/> + <import plugin="loop4"/> + </requires> +</plugin> diff --git a/lib/cpluff/test/pcollections/dependencies/loop3/plugin.xml b/lib/cpluff/test/pcollections/dependencies/loop3/plugin.xml new file mode 100644 index 0000000000..2e003936d1 --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/loop3/plugin.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<plugin id="loop3"> + <requires> + <import plugin="loop1"/> + </requires> +</plugin> diff --git a/lib/cpluff/test/pcollections/dependencies/loop4/plugin.xml b/lib/cpluff/test/pcollections/dependencies/loop4/plugin.xml new file mode 100644 index 0000000000..138c6db891 --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/loop4/plugin.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<plugin id="loop4"/> diff --git a/lib/cpluff/test/pcollections/dependencies/loop5/plugin.xml b/lib/cpluff/test/pcollections/dependencies/loop5/plugin.xml new file mode 100644 index 0000000000..bcb42019cc --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/loop5/plugin.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<plugin id="loop5"> + <requires> + <import plugin="loop3"/> + </requires> +</plugin> diff --git a/lib/cpluff/test/pcollections/dependencies/missingdep/plugin.xml b/lib/cpluff/test/pcollections/dependencies/missingdep/plugin.xml new file mode 100644 index 0000000000..dbdfd6b235 --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/missingdep/plugin.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<plugin id="missingdep"> + <requires> + <import plugin="nonexisting"/> + </requires> +</plugin>
\ No newline at end of file diff --git a/lib/cpluff/test/pcollections/dependencies/sloop1/plugin.xml b/lib/cpluff/test/pcollections/dependencies/sloop1/plugin.xml new file mode 100644 index 0000000000..e8c48eec53 --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/sloop1/plugin.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<plugin id="sloop1"> + <requires> + <import plugin="sloop2"/> + </requires> +</plugin> diff --git a/lib/cpluff/test/pcollections/dependencies/sloop2/plugin.xml b/lib/cpluff/test/pcollections/dependencies/sloop2/plugin.xml new file mode 100644 index 0000000000..e32b1a4361 --- /dev/null +++ b/lib/cpluff/test/pcollections/dependencies/sloop2/plugin.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<plugin id="sloop2"> + <requires> + <import plugin="sloop1"/> + </requires> +</plugin>
\ No newline at end of file diff --git a/lib/cpluff/test/pdependencies.c b/lib/cpluff/test/pdependencies.c new file mode 100644 index 0000000000..9610ea177b --- /dev/null +++ b/lib/cpluff/test/pdependencies.c @@ -0,0 +1,159 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <string.h> +#include "test.h" + +static int active(cp_context_t *ctx, const char * const * const plugins) { + cp_plugin_info_t **pis; + cp_status_t status; + int i; + int errors = 0; + + check((pis = cp_get_plugins_info(ctx, &status, NULL)) != NULL && status == CP_OK); + for (i = 0; !errors && pis[i] != NULL; i++) { + int j; + int should_be_active = 0; + cp_plugin_state_t state; + + for (j = 0; !should_be_active && plugins[j] != NULL; j++) { + if (!strcmp(pis[i]->identifier, plugins[j])) { + should_be_active = 1; + } + } + state = cp_get_plugin_state(ctx, pis[i]->identifier); + if ((should_be_active && state != CP_PLUGIN_ACTIVE) + || (!should_be_active && state == CP_PLUGIN_ACTIVE)) { + fprintf(stderr, "plug-in %s has unexpected state %d\n", pis[i]->identifier, state); + errors++; + } + } + cp_release_info(ctx, pis); + return errors == 0; +} + +void pluginmissingdep(void) { + cp_context_t *ctx; + const char * const act_none[] = { NULL }; + + ctx = init_context(CP_LOG_ERROR + 1, NULL); + check((cp_register_pcollection(ctx, pcollectiondir("dependencies"))) == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + + // Try starting a plugin depending on plug-in missing dependency + check(cp_start_plugin(ctx, "chainmissingdep") == CP_ERR_DEPENDENCY); + check(active(ctx, act_none)); + + // Try starting a plug-in with missing dependency + check(cp_start_plugin(ctx, "missingdep") == CP_ERR_DEPENDENCY); + check(active(ctx, act_none)); + + cp_destroy(); +} + +void plugindepchain(void) { + cp_context_t *ctx; + const char * const act_none[] = { NULL }; + const char * const act_chain123[] = { "chain1", "chain2", "chain3", NULL }; + const char * const act_chain23[] = { "chain2", "chain3", NULL }; + const char * const act_chain3[] = { "chain3", NULL }; + + ctx = init_context(CP_LOG_ERROR, NULL); + check((cp_register_pcollection(ctx, pcollectiondir("dependencies"))) == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + + // Try starting and stopping plug-ins in dependency chain + check(cp_start_plugin(ctx, "chain1") == CP_OK); + check(active(ctx, act_chain123)); + check(cp_stop_plugin(ctx, "chain3") == CP_OK); + check(active(ctx, act_none)); + check(cp_start_plugin(ctx, "chain2") == CP_OK); + check(active(ctx, act_chain23)); + check(cp_stop_plugin(ctx, "chain2") == CP_OK); + check(active(ctx, act_chain3)); + check(cp_stop_plugin(ctx, "chain3") == CP_OK); + check(active(ctx, act_none)); + check(cp_start_plugin(ctx, "chain3") == CP_OK); + check(active(ctx, act_chain3)); + + // Check that chain is unresolved when a plug-in is uninstalled + check(cp_uninstall_plugin(ctx, "chain3") == CP_OK); + check(cp_get_plugin_state(ctx, "chain1") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "chain2") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "chain3") == CP_PLUGIN_UNINSTALLED); + + cp_destroy(); +} + +void plugindeploop(void) { + cp_context_t *ctx; + const char * const act_none[] = { NULL }; + const char * const act_sloop12[] = { "sloop1", "sloop2", NULL }; + const char * const act_loop1234[] = { "loop1", "loop2", "loop3", "loop4", NULL }; + const char * const act_loop4[] = { "loop4", NULL }; + const char * const act_loop12345[] = { "loop1", "loop2", "loop3", "loop4", "loop5", NULL }; + + ctx = init_context(CP_LOG_ERROR, NULL); + check((cp_register_pcollection(ctx, pcollectiondir("dependencies"))) == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + + // Start/stop checks for a short loop sloop1 <--> sloop2 + check(active(ctx, act_none)); + check(cp_start_plugin(ctx, "sloop1") == CP_OK); + check(active(ctx, act_sloop12)); + check(cp_stop_plugin(ctx, "sloop1") == CP_OK); + check(active(ctx, act_none)); + + // Start/stop checks for an extended loop + // loop1 --> loop2 + // loop2 --> loop3 + // loop3 --> loop1 + // loop2 --> loop4 + // loop5 --> loop3 + check(cp_start_plugin(ctx, "loop5") == CP_OK); + check(active(ctx, act_loop12345)); + check(cp_stop_plugin(ctx, "loop4") == CP_OK); + check(active(ctx, act_none)); + check(cp_start_plugin(ctx, "loop4") == CP_OK); + check(active(ctx, act_loop4)); + check(cp_start_plugin(ctx, "loop1") == CP_OK); + check(active(ctx, act_loop1234)); + check(cp_stop_plugin(ctx, "loop3") == CP_OK); + check(active(ctx, act_loop4)); + + // Unresolve check for the short loop + check(cp_uninstall_plugin(ctx, "sloop1") == CP_OK); + check(cp_get_plugin_state(ctx, "sloop1") == CP_PLUGIN_UNINSTALLED); + check(cp_get_plugin_state(ctx, "sloop2") == CP_PLUGIN_INSTALLED); + + // Unresolve check for the extended loop + check(cp_uninstall_plugin(ctx, "loop4") == CP_OK); + check(cp_get_plugin_state(ctx, "loop1") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "loop2") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "loop3") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "loop4") == CP_PLUGIN_UNINSTALLED); + check(cp_get_plugin_state(ctx, "loop5") == CP_PLUGIN_INSTALLED); + + cp_destroy(); +} diff --git a/lib/cpluff/test/pinstallation.c b/lib/cpluff/test/pinstallation.c new file mode 100644 index 0000000000..1cc57fc005 --- /dev/null +++ b/lib/cpluff/test/pinstallation.c @@ -0,0 +1,101 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include "test.h" + +void install(void) { + cp_context_t *ctx; + cp_plugin_info_t *plugin; + cp_status_t status; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); + check(cp_install_plugin(ctx, plugin) == CP_OK); + cp_release_info(ctx, plugin); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_INSTALLED); + cp_destroy(); + check(errors == 0); +} + +void installtwo(void) { + cp_context_t *ctx; + cp_plugin_info_t *plugin; + cp_status_t status; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); + check(cp_install_plugin(ctx, plugin) == CP_OK); + cp_release_info(ctx, plugin); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "maximal") == CP_PLUGIN_UNINSTALLED); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("maximal"), &status)) != NULL && status == CP_OK); + check(cp_get_plugin_state(ctx, "maximal") == CP_PLUGIN_UNINSTALLED); + check(cp_install_plugin(ctx, plugin) == CP_OK); + cp_release_info(ctx, plugin); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "maximal") == CP_PLUGIN_INSTALLED); + cp_destroy(); + check(errors == 0); +} + +void installconflict(void) { + cp_context_t *ctx; + cp_plugin_info_t *plugin; + cp_status_t status; + + ctx = init_context(CP_LOG_ERROR + 1, NULL); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); + check(cp_install_plugin(ctx, plugin) == CP_OK); + cp_release_info(ctx, plugin); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_INSTALLED); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); + check(cp_install_plugin(ctx, plugin) == CP_ERR_CONFLICT); + cp_release_info(ctx, plugin); + cp_destroy(); +} + +void uninstall(void) { + cp_context_t *ctx; + cp_plugin_info_t *plugin; + cp_status_t status; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); + check(cp_install_plugin(ctx, plugin) == CP_OK); + cp_release_info(ctx, plugin); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_INSTALLED); + check(cp_uninstall_plugin(ctx, "minimal") == CP_OK); + check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); + cp_destroy(); + check(errors == 0); +} diff --git a/lib/cpluff/test/ploading.c b/lib/cpluff/test/ploading.c new file mode 100644 index 0000000000..4011fbb60d --- /dev/null +++ b/lib/cpluff/test/ploading.c @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include "test.h" + +void loadonlymaximal(void) { + cp_context_t *ctx; + cp_plugin_info_t *plugin; + cp_status_t status; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check((plugin = cp_load_plugin_descriptor(ctx, plugindir("maximal"), &status)) != NULL && status == CP_OK); + cp_release_info(ctx, plugin); + cp_destroy(); + check(errors == 0); +} diff --git a/lib/cpluff/test/plugins-source/Makefile.am b/lib/cpluff/test/plugins-source/Makefile.am new file mode 100644 index 0000000000..d86583124c --- /dev/null +++ b/lib/cpluff/test/plugins-source/Makefile.am @@ -0,0 +1,7 @@ +## Process this file with automake to produce Makefile.in. + +# Copyright 2007 Johannes Lehtinen +# This Makefile is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + +SUBDIRS = callbackcounter symuser symprovider diff --git a/lib/cpluff/test/plugins-source/Makefile.in b/lib/cpluff/test/plugins-source/Makefile.in new file mode 100644 index 0000000000..c60688c837 --- /dev/null +++ b/lib/cpluff/test/plugins-source/Makefile.in @@ -0,0 +1,513 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2007 Johannes Lehtinen +# This Makefile is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test/plugins-source +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPLUFF_LOADER = @CPLUFF_LOADER@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CP_CXX_LIB_VERSION = @CP_CXX_LIB_VERSION@ +CP_C_LIB_VERSION = @CP_C_LIB_VERSION@ +CP_VERSION_MAJOR = @CP_VERSION_MAJOR@ +CP_VERSION_MINOR = @CP_VERSION_MINOR@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBS_LIBCPLUFF = @LIBS_LIBCPLUFF@ +LIBS_OTHER = @LIBS_OTHER@ +LIBTOOL = @LIBTOOL@ +LIB_READLINE = @LIB_READLINE@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = callbackcounter symuser symprovider +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/plugins-source/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/plugins-source/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/cpluff/test/plugins-source/callbackcounter/Makefile.am b/lib/cpluff/test/plugins-source/callbackcounter/Makefile.am new file mode 100644 index 0000000000..aa0c1b04ef --- /dev/null +++ b/lib/cpluff/test/plugins-source/callbackcounter/Makefile.am @@ -0,0 +1,17 @@ +## Process this file with automake to produce Makefile.in. + +# Copyright 2007 Johannes Lehtinen +# This Makefile is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + +LIBS = @LIBS_OTHER@ @LIBS@ + +EXTRA_DIST = plugin.xml + +plugindir = /plugins/callbackcounter + +plugin_LTLIBRARIES = libruntime.la +plugin_DATA = plugin.xml + +libruntime_la_SOURCES = callbackcounter.c callbackcounter.h +libruntime_la_LDFLAGS = -module -avoid-version diff --git a/lib/cpluff/test/plugins-source/callbackcounter/Makefile.in b/lib/cpluff/test/plugins-source/callbackcounter/Makefile.in new file mode 100644 index 0000000000..fd31e3c339 --- /dev/null +++ b/lib/cpluff/test/plugins-source/callbackcounter/Makefile.in @@ -0,0 +1,522 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2007 Johannes Lehtinen +# This Makefile is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test/plugins-source/callbackcounter +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)" +pluginLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(plugin_LTLIBRARIES) +libruntime_la_LIBADD = +am_libruntime_la_OBJECTS = callbackcounter.lo +libruntime_la_OBJECTS = $(am_libruntime_la_OBJECTS) +libruntime_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libruntime_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/auxliary/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libruntime_la_SOURCES) +DIST_SOURCES = $(libruntime_la_SOURCES) +pluginDATA_INSTALL = $(INSTALL_DATA) +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPLUFF_LOADER = @CPLUFF_LOADER@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CP_CXX_LIB_VERSION = @CP_CXX_LIB_VERSION@ +CP_C_LIB_VERSION = @CP_C_LIB_VERSION@ +CP_VERSION_MAJOR = @CP_VERSION_MAJOR@ +CP_VERSION_MINOR = @CP_VERSION_MINOR@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS_OTHER@ @LIBS@ +LIBS_LIBCPLUFF = @LIBS_LIBCPLUFF@ +LIBS_OTHER = @LIBS_OTHER@ +LIBTOOL = @LIBTOOL@ +LIB_READLINE = @LIB_READLINE@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = plugin.xml +plugindir = /plugins/callbackcounter +plugin_LTLIBRARIES = libruntime.la +plugin_DATA = plugin.xml +libruntime_la_SOURCES = callbackcounter.c callbackcounter.h +libruntime_la_LDFLAGS = -module -avoid-version +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/plugins-source/callbackcounter/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/plugins-source/callbackcounter/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ + else :; fi; \ + done + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libruntime.la: $(libruntime_la_OBJECTS) $(libruntime_la_DEPENDENCIES) + $(libruntime_la_LINK) -rpath $(plugindir) $(libruntime_la_OBJECTS) $(libruntime_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbackcounter.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pluginDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ + $(pluginDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(plugindir)/$$f"; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.c b/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.c new file mode 100644 index 0000000000..11cc15a538 --- /dev/null +++ b/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.c @@ -0,0 +1,124 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <cpluff.h> +#include "callbackcounter.h" + +struct runtime_data { + cp_context_t *ctx; + cbc_counters_t *counters; +}; + +static void *create(cp_context_t *ctx) { + struct runtime_data *data; + + if ((data = malloc(sizeof(struct runtime_data))) == NULL) { + return NULL; + } + data->ctx = ctx; + + /* + * Normally data->counters would be initialized in start function. + * We do it already here to be able to record count for the create + * function. + */ + if ((data->counters = malloc(sizeof(cbc_counters_t))) == NULL) { + free(data); + return NULL; + } + memset(data->counters, 0, sizeof(cbc_counters_t)); + data->counters->context_arg_0 = NULL; + data->counters->create++; + + return data; +} + +static void logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { + struct runtime_data *data = user_data; + + data->counters->logger++; +} + +static void listener(const char *plugin_id, cp_plugin_state_t old_state, cp_plugin_state_t new_state, void *user_data) { + struct runtime_data *data = user_data; + + data->counters->listener++; +} + +static int run(void *d) { + struct runtime_data *data = d; + + data->counters->run++; + return (data->counters->run < 3); +} + +static int start(void *d) { + struct runtime_data *data = d; + char **argv; + + data->counters->start++; + argv = cp_get_context_args(data->ctx, NULL); + if (argv != NULL && argv[0] != NULL) { + if ((data->counters->context_arg_0 = strdup(argv[0])) == NULL) { + return CP_ERR_RESOURCE; + } + } + if (cp_define_symbol(data->ctx, "cbc_counters", data->counters) != CP_OK + || cp_register_logger(data->ctx, logger, data, CP_LOG_WARNING) != CP_OK + || cp_register_plistener(data->ctx, listener, data) != CP_OK + || cp_run_function(data->ctx, run) != CP_OK) { + return CP_ERR_RUNTIME; + } else { + return CP_OK; + } +} + +static void stop(void *d) { + struct runtime_data *data = d; + + data->counters->stop++; + + /* + * Normally data->counters would be freed here. However, we do not free + * it so that the test program can read counters after plug-in stops. + */ +} + +static void destroy(void *d) { + struct runtime_data *data = d; + + data->counters->destroy++; + data->counters = NULL; + free(data); +} + +CP_EXPORT cp_plugin_runtime_t cbc_runtime = { + create, + start, + stop, + destroy +}; diff --git a/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.h b/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.h new file mode 100644 index 0000000000..bbbf79c4c0 --- /dev/null +++ b/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#ifndef CALLBACKCOUNTER_H_ +#define CALLBACKCOUNTER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** A type for cbc_counters_t structure */ +typedef struct cbc_counters_t cbc_counters_t; + +/** A container for callback counters */ +struct cbc_counters_t { + + /** Call counter for the create function */ + int create; + + /** Call counter for the start function */ + int start; + + /** Call counter for the logger function */ + int logger; + + /** Call counter for the plug-in listener function */ + int listener; + + /** Call counter for the run function */ + int run; + + /** Call counter for the stop function */ + int stop; + + /** Call counter for the destroy function */ + int destroy; + + /** Copy of context arg 0 from the call to start, or NULL */ + char *context_arg_0; +}; + +#ifdef __cplusplus +} +#endif + +#endif /*CALLBACKCOUNTER_H_*/ diff --git a/lib/cpluff/test/plugins-source/callbackcounter/plugin.xml b/lib/cpluff/test/plugins-source/callbackcounter/plugin.xml new file mode 100644 index 0000000000..c5438279af --- /dev/null +++ b/lib/cpluff/test/plugins-source/callbackcounter/plugin.xml @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<plugin id="callbackcounter" name="Callback Call Counter"> + <runtime library="libruntime" funcs="cbc_runtime"/> +</plugin> diff --git a/lib/cpluff/test/plugins-source/symprovider/Makefile.am b/lib/cpluff/test/plugins-source/symprovider/Makefile.am new file mode 100644 index 0000000000..ba32ac1b48 --- /dev/null +++ b/lib/cpluff/test/plugins-source/symprovider/Makefile.am @@ -0,0 +1,17 @@ +## Process this file with automake to produce Makefile.in. + +# Copyright 2007 Johannes Lehtinen +# This Makefile is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + +LIBS = @LIBS_OTHER@ @LIBS@ + +EXTRA_DIST = plugin.xml + +plugindir = /plugins/symprovider + +plugin_LTLIBRARIES = libruntime.la +plugin_DATA = plugin.xml + +libruntime_la_SOURCES = symprovider.c +libruntime_la_LDFLAGS = -module -avoid-version diff --git a/lib/cpluff/test/plugins-source/symprovider/Makefile.in b/lib/cpluff/test/plugins-source/symprovider/Makefile.in new file mode 100644 index 0000000000..fcf82afa9d --- /dev/null +++ b/lib/cpluff/test/plugins-source/symprovider/Makefile.in @@ -0,0 +1,522 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2007 Johannes Lehtinen +# This Makefile is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test/plugins-source/symprovider +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)" +pluginLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(plugin_LTLIBRARIES) +libruntime_la_LIBADD = +am_libruntime_la_OBJECTS = symprovider.lo +libruntime_la_OBJECTS = $(am_libruntime_la_OBJECTS) +libruntime_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libruntime_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/auxliary/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libruntime_la_SOURCES) +DIST_SOURCES = $(libruntime_la_SOURCES) +pluginDATA_INSTALL = $(INSTALL_DATA) +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPLUFF_LOADER = @CPLUFF_LOADER@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CP_CXX_LIB_VERSION = @CP_CXX_LIB_VERSION@ +CP_C_LIB_VERSION = @CP_C_LIB_VERSION@ +CP_VERSION_MAJOR = @CP_VERSION_MAJOR@ +CP_VERSION_MINOR = @CP_VERSION_MINOR@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS_OTHER@ @LIBS@ +LIBS_LIBCPLUFF = @LIBS_LIBCPLUFF@ +LIBS_OTHER = @LIBS_OTHER@ +LIBTOOL = @LIBTOOL@ +LIB_READLINE = @LIB_READLINE@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = plugin.xml +plugindir = /plugins/symprovider +plugin_LTLIBRARIES = libruntime.la +plugin_DATA = plugin.xml +libruntime_la_SOURCES = symprovider.c +libruntime_la_LDFLAGS = -module -avoid-version +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/plugins-source/symprovider/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/plugins-source/symprovider/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ + else :; fi; \ + done + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libruntime.la: $(libruntime_la_OBJECTS) $(libruntime_la_DEPENDENCIES) + $(libruntime_la_LINK) -rpath $(plugindir) $(libruntime_la_OBJECTS) $(libruntime_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symprovider.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pluginDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ + $(pluginDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(plugindir)/$$f"; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/cpluff/test/plugins-source/symprovider/plugin.xml b/lib/cpluff/test/plugins-source/symprovider/plugin.xml new file mode 100644 index 0000000000..3387ca637e --- /dev/null +++ b/lib/cpluff/test/plugins-source/symprovider/plugin.xml @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<plugin id="symprovider" name="Symbol Provider"> + <requires> + <import plugin="symuser"/> + </requires> + <runtime library="libruntime" funcs="sp_runtime"/> + <extension point="symuser.strings" string-symbol="sp_string"/> +</plugin> diff --git a/lib/cpluff/test/plugins-source/symprovider/symprovider.c b/lib/cpluff/test/plugins-source/symprovider/symprovider.c new file mode 100644 index 0000000000..bd7abcc9d0 --- /dev/null +++ b/lib/cpluff/test/plugins-source/symprovider/symprovider.c @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdlib.h> +#include <cpluff.h> + +typedef struct plugin_data_t plugin_data_t; + +struct plugin_data_t { + cp_context_t *ctx; + char *str; +}; + +static void *create(cp_context_t *ctx) { + plugin_data_t *data = malloc(sizeof(plugin_data_t)); + + if (data != NULL) { + data->ctx = ctx; + data->str = NULL; + } + return data; +} + +static int start(void *d) { + plugin_data_t *data = d; + + if ((data->str = malloc(sizeof(char) * 16)) == NULL) { + return CP_ERR_RESOURCE; + } + strcpy(data->str, "Provided string"); + cp_define_symbol(data->ctx, "sp_string", data->str); + return CP_OK; +} + +static void destroy(void *d) { + plugin_data_t *data = d; + + if (data->str != NULL) { + strcpy(data->str, "Cleared string"); + free(data->str); + } + free(d); +} + +CP_EXPORT cp_plugin_runtime_t sp_runtime = { + create, + start, + NULL, + destroy +}; diff --git a/lib/cpluff/test/plugins-source/symuser/Makefile.am b/lib/cpluff/test/plugins-source/symuser/Makefile.am new file mode 100644 index 0000000000..cc0314077d --- /dev/null +++ b/lib/cpluff/test/plugins-source/symuser/Makefile.am @@ -0,0 +1,17 @@ +## Process this file with automake to produce Makefile.in. + +# Copyright 2007 Johannes Lehtinen +# This Makefile is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + +LIBS = @LIBS_OTHER@ @LIBS@ + +EXTRA_DIST = plugin.xml + +plugindir = /plugins/symuser + +plugin_LTLIBRARIES = libruntime.la +plugin_DATA = plugin.xml + +libruntime_la_SOURCES = symuser.c +libruntime_la_LDFLAGS = -module -avoid-version diff --git a/lib/cpluff/test/plugins-source/symuser/Makefile.in b/lib/cpluff/test/plugins-source/symuser/Makefile.in new file mode 100644 index 0000000000..c9d905ca79 --- /dev/null +++ b/lib/cpluff/test/plugins-source/symuser/Makefile.in @@ -0,0 +1,522 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2007 Johannes Lehtinen +# This Makefile is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test/plugins-source/symuser +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)" +pluginLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(plugin_LTLIBRARIES) +libruntime_la_LIBADD = +am_libruntime_la_OBJECTS = symuser.lo +libruntime_la_OBJECTS = $(am_libruntime_la_OBJECTS) +libruntime_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libruntime_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/auxliary/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libruntime_la_SOURCES) +DIST_SOURCES = $(libruntime_la_SOURCES) +pluginDATA_INSTALL = $(INSTALL_DATA) +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPLUFF_LOADER = @CPLUFF_LOADER@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CP_CXX_LIB_VERSION = @CP_CXX_LIB_VERSION@ +CP_C_LIB_VERSION = @CP_C_LIB_VERSION@ +CP_VERSION_MAJOR = @CP_VERSION_MAJOR@ +CP_VERSION_MINOR = @CP_VERSION_MINOR@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS_OTHER@ @LIBS@ +LIBS_LIBCPLUFF = @LIBS_LIBCPLUFF@ +LIBS_OTHER = @LIBS_OTHER@ +LIBTOOL = @LIBTOOL@ +LIB_READLINE = @LIB_READLINE@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = plugin.xml +plugindir = /plugins/symuser +plugin_LTLIBRARIES = libruntime.la +plugin_DATA = plugin.xml +libruntime_la_SOURCES = symuser.c +libruntime_la_LDFLAGS = -module -avoid-version +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/plugins-source/symuser/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/plugins-source/symuser/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ + else :; fi; \ + done + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libruntime.la: $(libruntime_la_OBJECTS) $(libruntime_la_DEPENDENCIES) + $(libruntime_la_LINK) -rpath $(plugindir) $(libruntime_la_OBJECTS) $(libruntime_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symuser.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pluginDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ + $(pluginDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(plugindir)/$$f"; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/cpluff/test/plugins-source/symuser/plugin.xml b/lib/cpluff/test/plugins-source/symuser/plugin.xml new file mode 100644 index 0000000000..57c2d68f95 --- /dev/null +++ b/lib/cpluff/test/plugins-source/symuser/plugin.xml @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<plugin id="symuser" name="Symbol User"> + <runtime library="libruntime" funcs="su_runtime"/> + <extension-point id="strings"/> +</plugin> diff --git a/lib/cpluff/test/plugins-source/symuser/symuser.c b/lib/cpluff/test/plugins-source/symuser/symuser.c new file mode 100644 index 0000000000..8e84a6f762 --- /dev/null +++ b/lib/cpluff/test/plugins-source/symuser/symuser.c @@ -0,0 +1,97 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <cpluff.h> + +typedef struct plugin_data_t plugin_data_t; + +struct plugin_data_t { + cp_context_t *ctx; + const char *str; +}; + +static void *create(cp_context_t *ctx) { + plugin_data_t *data; + + if ((data = malloc(sizeof(plugin_data_t))) != NULL) { + data->ctx = ctx; + data->str = NULL; + } + return data; +} + +static int start(void *d) { + plugin_data_t *data = d; + cp_extension_t **exts; + + exts = cp_get_extensions_info(data->ctx, "symuser.strings", NULL, NULL); + if (exts != NULL && exts[0] != NULL) { + const char *symname; + + symname = cp_lookup_cfg_value(exts[0]->configuration, "@string-symbol"); + if (symname != NULL) { + data->str = cp_resolve_symbol(data->ctx, exts[0]->plugin->identifier, symname, NULL); + if (data->str == NULL) { + cp_log(data->ctx, CP_LOG_ERROR, "Could not resolve symbol specified by extension."); + } + } else { + cp_log(data->ctx, CP_LOG_ERROR, "No string-symbol attribute present in extension."); + } + } else { + cp_log(data->ctx, CP_LOG_ERROR, "No extensions available."); + } + if (exts != NULL) { + cp_release_info(data->ctx, exts); + } + if (data->str == NULL) { + return CP_ERR_RUNTIME; + } + return cp_define_symbol(data->ctx, "used_string", (void *) data->str); +} + +static void stop(void *d) { + plugin_data_t *data = d; + + // Check that the provided string is still available + if (data->str != NULL) { + if (strcmp(data->str, "Provided string")) { + fputs("Provided string is not available in symuser stop function.\n", stderr); + abort(); + } + cp_release_symbol(data->ctx, data->str); + } +} + +static void destroy(void *d) { + free(d); +} + +CP_EXPORT cp_plugin_runtime_t su_runtime = { + create, + start, + stop, + destroy +}; diff --git a/lib/cpluff/test/plugins/maximal/plugin.xml b/lib/cpluff/test/plugins/maximal/plugin.xml new file mode 100644 index 0000000000..2bab3c0672 --- /dev/null +++ b/lib/cpluff/test/plugins/maximal/plugin.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<plugin id="maximal" name="Maximal" version="1.0.0.max" provider-name="Maximal Provider"> + <backwards-compatibility abi="1.0" api="0.8"/> + <requires> + <c-pluff version="999.3.4"/> + <import plugin="dependency1" version="0.1" optional="true"/> + <import plugin="dependency2" version="0.2"/> + <import plugin="dependency3" optional="true"/> + <import plugin="dependency4"/> + </requires> + <runtime library="nonexisting" funcs="funcs"/> + <extension-point id="extpt1" name="Extension Point 1" schema="ext1.xsd"/> + <extension-point id="extpt2" name="Extension Point 2"/> + <extension-point id="extpt3" schema="extpt3.xsd"/> + <extension-point id="extpt4"/> + <extension point="nonexisting.extptA" id="ext1" name="Extension 1"> + Extension data begins + <structure> + <parameter>parameter</parameter> + <parameter>param2</parameter> + <!-- <parameter>commented out parameter</parameter> --> + <assertion>1<2</assertion> + <deeper> + <struct> + <is>here</is> + </struct> + </deeper> + Structure ends + </structure> + </extension> + <extension point="nonexisting.extptB" id="ext2"/> + <extension point="maximal.extpt1" name="Extension 3"/> + <extension point="maximal.extpt2"/> +</plugin> diff --git a/lib/cpluff/test/plugins/minimal/plugin.xml b/lib/cpluff/test/plugins/minimal/plugin.xml new file mode 100644 index 0000000000..d5a0d23d84 --- /dev/null +++ b/lib/cpluff/test/plugins/minimal/plugin.xml @@ -0,0 +1 @@ +<plugin id="minimal"/> diff --git a/lib/cpluff/test/pscanning.c b/lib/cpluff/test/pscanning.c new file mode 100644 index 0000000000..ae1987a080 --- /dev/null +++ b/lib/cpluff/test/pscanning.c @@ -0,0 +1,181 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <string.h> +#include "test.h" + +/* + * Basic plug-in scanning tests were already performed in collections.c. + * Here we test some more complex things like upgrade and restart behavior. + */ + +static void scanupgrade_checkpver(cp_context_t *ctx, const char *plugin, const char *ver) { + cp_plugin_info_t *pi; + cp_status_t status; + + check((pi = cp_get_plugin_info(ctx, plugin, &status)) != NULL && status == CP_OK); + check(ver == NULL ? pi->version == NULL : (pi->version != NULL && strcmp(pi->version, ver) == 0)); + cp_release_info(ctx, pi); +} + +void scanupgrade(void) { + cp_context_t *ctx; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); + check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_INSTALLED); + scanupgrade_checkpver(ctx, "plugin1", NULL); + + // Register newer version of plugin1 but do not allow upgrades + check(cp_start_plugin(ctx, "plugin1") == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); + check(cp_register_pcollection(ctx, pcollectiondir("collection1v2")) == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); + scanupgrade_checkpver(ctx, "plugin1", NULL); + + // Now allow upgrade of plugin1 + check(cp_scan_plugins(ctx, CP_SP_UPGRADE) == CP_OK); + scanupgrade_checkpver(ctx, "plugin1", "2"); + + // Register even new version and upgrade while running + check(cp_register_pcollection(ctx, pcollectiondir("collection1v3")) == CP_OK); + check(cp_start_plugin(ctx, "plugin1") == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); + check(cp_scan_plugins(ctx, CP_SP_UPGRADE) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); + scanupgrade_checkpver(ctx, "plugin1", "3"); + + // Check that plug-in is not downgraded when newer versions are unregistered + cp_unregister_pcollection(ctx, pcollectiondir("collection1v3")); + check(cp_scan_plugins(ctx, CP_SP_UPGRADE) == CP_OK); + scanupgrade_checkpver(ctx, "plugin1", "3"); + + cp_destroy(); + check(errors == 0); +} + +void scanstoponupgrade(void) { + cp_context_t *ctx; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); + check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + + // First check upgrade without stopping other plug-ins + check(cp_start_plugin(ctx, "plugin1") == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); + check(cp_start_plugin(ctx, "plugin2a") == CP_OK); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_ACTIVE); + check(cp_register_pcollection(ctx, pcollectiondir("collection1v2")) == CP_OK); + check(cp_scan_plugins(ctx, CP_SP_UPGRADE) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_ACTIVE); + + // Then check upgrade with stop flag + check(cp_start_plugin(ctx, "plugin1") == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); + check(cp_register_pcollection(ctx, pcollectiondir("collection1v3")) == CP_OK); + check(cp_scan_plugins(ctx, CP_SP_UPGRADE | CP_SP_STOP_ALL_ON_UPGRADE) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_RESOLVED); + + cp_destroy(); + check(errors == 0); +} + +void scanstoponinstall(void) { + cp_context_t *ctx; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + + // First check install without stopping other plug-ins + check(cp_start_plugin(ctx, "plugin1") == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_UNINSTALLED); + check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); + + // Then check install and stopping of other plug-ins + check(cp_uninstall_plugin(ctx, "plugin2a") == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_UNINSTALLED); + check(cp_scan_plugins(ctx, CP_SP_STOP_ALL_ON_INSTALL) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_RESOLVED); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); + + // Then check upgrade and stopping of other plug-ins + check(cp_start_plugin(ctx, "plugin2a") == CP_OK); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_ACTIVE); + check(cp_register_pcollection(ctx, pcollectiondir("collection1v2")) == CP_OK); + check(cp_scan_plugins(ctx, CP_SP_UPGRADE | CP_SP_STOP_ALL_ON_INSTALL) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_RESOLVED); + + cp_destroy(); + check(errors == 0); +} + +void scanrestart(void) { + cp_context_t *ctx; + int errors; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); + check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + check(cp_start_plugin(ctx, "plugin2b") == CP_OK); + check(cp_start_plugin(ctx, "plugin1") == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_ACTIVE); + + // Check that upgraded plug-in is correctly restarted after upgrade + check(cp_register_pcollection(ctx, pcollectiondir("collection1v2")) == CP_OK); + check(cp_scan_plugins(ctx, CP_SP_UPGRADE | CP_SP_RESTART_ACTIVE) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_ACTIVE); + + // Check that other plug-ins are correctly restarted after upgrade + check(cp_register_pcollection(ctx, pcollectiondir("collection1v3")) == CP_OK); + check(cp_scan_plugins(ctx, CP_SP_UPGRADE | CP_SP_STOP_ALL_ON_UPGRADE | CP_SP_RESTART_ACTIVE) == CP_OK); + check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); + check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); + check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_ACTIVE); + + cp_destroy(); + check(errors == 0); +} diff --git a/lib/cpluff/test/psymbolusage.c b/lib/cpluff/test/psymbolusage.c new file mode 100644 index 0000000000..d0a1b3ca15 --- /dev/null +++ b/lib/cpluff/test/psymbolusage.c @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "test.h" + +void symbolusage(void) { + cp_context_t *ctx; + cp_status_t status; + int errors; + const char *str; + + ctx = init_context(CP_LOG_ERROR, &errors); + check(cp_register_pcollection(ctx, "tmp/install/plugins") == CP_OK); + check(cp_scan_plugins(ctx, 0) == CP_OK); + + // Start plug-in implicitly by resolving a symbol + check((str = cp_resolve_symbol(ctx, "symuser", "used_string", &status)) != NULL && status == CP_OK); + + // Compare used string to the provided string + check(strcmp(str, "Provided string") == 0); + + // Release string + cp_release_symbol(ctx, str); + + // Shutdown framework + cp_destroy(); + check(errors == 0); +} diff --git a/lib/cpluff/test/test-extensions b/lib/cpluff/test/test-extensions new file mode 100755 index 0000000000..29e25dac72 --- /dev/null +++ b/lib/cpluff/test/test-extensions @@ -0,0 +1,17 @@ +#! /bin/sh + +# Copyright 2007 Johannes Lehtinen +# This shell script is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + +set -e + +tmpdir="tmp/test-extensions" +mkdir -p "$tmpdir" +LC_ALL=C libtool --mode=execute $TEST_WRAPPER ../console/cpluff-console <<EOI > "$tmpdir"/console-out.txt +set-log-level error +load-plugin $srcdir/plugins/maximal +list-extensions +EOI +sed -n -e '/^Installed extensions:$/,/^C-Pluff/p' < "$tmpdir"/console-out.txt > "$tmpdir"/filtered.txt +diff -u "$srcdir"/expected/output-extensions.txt "$tmpdir"/filtered.txt diff --git a/lib/cpluff/test/test-extpoints b/lib/cpluff/test/test-extpoints new file mode 100755 index 0000000000..5b7824e204 --- /dev/null +++ b/lib/cpluff/test/test-extpoints @@ -0,0 +1,17 @@ +#! /bin/sh + +# Copyright 2007 Johannes Lehtinen +# This shell script is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + +set -e + +tmpdir="tmp/test-extpoints" +mkdir -p "$tmpdir" +LC_ALL=C libtool --mode=execute $TEST_WRAPPER ../console/cpluff-console <<EOI > "$tmpdir"/console-out.txt +set-log-level error +load-plugin $srcdir/plugins/maximal +list-ext-points +EOI +sed -n -e '/^Installed extension points:$/,/^C-Pluff/p' < "$tmpdir"/console-out.txt > "$tmpdir"/filtered.txt +diff -u "$srcdir"/expected/output-extpoints.txt "$tmpdir"/filtered.txt diff --git a/lib/cpluff/test/test-fatalerrordefault b/lib/cpluff/test/test-fatalerrordefault new file mode 100755 index 0000000000..8a7f1a7c9d --- /dev/null +++ b/lib/cpluff/test/test-fatalerrordefault @@ -0,0 +1,10 @@ +#! /bin/sh + +# Copyright 2007 Johannes Lehtinen +# This shell script is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + +set -e + +trap "" SIGABRT +! ./testsuite fatalerrordefault 2> /dev/null diff --git a/lib/cpluff/test/test-fatalerrorreset b/lib/cpluff/test/test-fatalerrorreset new file mode 100755 index 0000000000..e9bf59411e --- /dev/null +++ b/lib/cpluff/test/test-fatalerrorreset @@ -0,0 +1,10 @@ +#! /bin/sh + +# Copyright 2007 Johannes Lehtinen +# This shell script is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + +set -e + +trap "" SIGABRT +! ./testsuite fatalerrorreset 2> /dev/null diff --git a/lib/cpluff/test/test-loadmaximal b/lib/cpluff/test/test-loadmaximal new file mode 100755 index 0000000000..420dd204cb --- /dev/null +++ b/lib/cpluff/test/test-loadmaximal @@ -0,0 +1,17 @@ +#! /bin/sh + +# Copyright 2007 Johannes Lehtinen +# This shell script is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + +set -e + +tmpdir="tmp/test-loadmaximal" +mkdir -p "$tmpdir" +LC_ALL=C libtool --mode=execute $TEST_WRAPPER ../console/cpluff-console <<EOI > "$tmpdir"/console-out.txt +set-log-level error +load-plugin $srcdir/plugins/maximal +show-plugin-info maximal +EOI +sed -n -e '/^{$/,/^}$/{/^ plugin_path =/!p}' < "$tmpdir"/console-out.txt > "$tmpdir"/filtered.txt +diff -u "$srcdir"/expected/output-loadmaximal.txt "$tmpdir"/filtered.txt diff --git a/lib/cpluff/test/test-loadminimal b/lib/cpluff/test/test-loadminimal new file mode 100755 index 0000000000..17df7f8db3 --- /dev/null +++ b/lib/cpluff/test/test-loadminimal @@ -0,0 +1,17 @@ +#! /bin/sh + +# Copyright 2007 Johannes Lehtinen +# This shell script is free software; Johannes Lehtinen gives unlimited +# permission to copy, distribute and modify it. + +set -e + +tmpdir="tmp/test-loadminimal" +mkdir -p "$tmpdir" +LC_ALL=C libtool --mode=execute $TEST_WRAPPER ../console/cpluff-console <<EOI > "$tmpdir"/console-out.txt +set-log-level error +load-plugin $srcdir/plugins/minimal +show-plugin-info minimal +EOI +sed -n -e '/^{$/,/^}$/{/^ plugin_path =/!p}' < "$tmpdir"/console-out.txt > "$tmpdir"/filtered.txt +diff -u "$srcdir"/expected/output-loadminimal.txt "$tmpdir"/filtered.txt diff --git a/lib/cpluff/test/test.h b/lib/cpluff/test/test.h new file mode 100644 index 0000000000..1b42e2139c --- /dev/null +++ b/lib/cpluff/test/test.h @@ -0,0 +1,99 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#ifndef TEST_H_ +#define TEST_H_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <cpluff.h> + +// GNU C attribute defines +#ifndef CP_GCC_NORETURN +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5) +#define CP_GCC_NORETURN __attribute__((noreturn)) +#else +#define CP_GCC_NORETURN +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Prints failure message and aborts the test program. + * + * @param func the test function + * @param file the test source file + * @param line the test source line + * @param msg the failure message + */ +CP_HIDDEN void fail(const char *func, const char *file, int line, const char *msg) CP_GCC_NORETURN CP_GCC_NONNULL(1, 2, 4); + +/** + * Checks that the specified condition is true. + * + * @param cond the condition that should be true + */ +#define check(cond) do { if (!(cond)) { fail(__func__, __FILE__, __LINE__, "Failed condition: " #cond); }} while (0) + +/** + * Returns the plug-in path for the specified test plug-in. + * The returned string is valid until the next call to plugindir. + * + * @return plug-in path for the specified test plug-in + */ +CP_HIDDEN const char *plugindir(const char *plugin) CP_GCC_NONNULL(1); + +/** + * Returns the plug-in collection path for the specified test collection. + * The returned string is valid until the next call to pcollectiondir. + * + * @return plug-in collection path for the specified test collection + */ +CP_HIDDEN const char *pcollectiondir(const char *collection) CP_GCC_NONNULL(1); + +/** + * Initializes the C-Pluff framework and creates a plug-in context. + * Checks for any failures on the way. Also prints out context errors/warnings + * and maintains a count of logged context errors if so requested. + * + * @param min_disp_sev the minimum severity of messages to be displayed + * @param error_counter pointer to the location where the logged error count is to be stored or NULL + * @return the created plug-in context + */ +CP_HIDDEN cp_context_t *init_context(cp_log_severity_t min_disp_sev, int *error_counter); + +/** + * Frees any test resources. This can be called to ensure there are no memory + * leaks due to leaked test resources. + */ +CP_HIDDEN void free_test_resources(void); + +#ifdef __cplusplus +} +#endif + +#endif /*TEST_H_*/ diff --git a/lib/cpluff/test/testmain.c b/lib/cpluff/test/testmain.c new file mode 100644 index 0000000000..63c2374cd4 --- /dev/null +++ b/lib/cpluff/test/testmain.c @@ -0,0 +1,176 @@ +/*------------------------------------------------------------------------- + * C-Pluff, a plug-in framework for C + * Copyright 2007 Johannes Lehtinen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "test.h" +#include "../libcpluff/internal.h" + +static const char *argv0; + +CP_HIDDEN void fail(const char *func, const char *file, int line, const char *msg) { + fprintf(stderr, "%s: %s:%d: %s: %s\n", argv0, file, line, func, msg); + abort(); +} + +static void full_logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { + const char *sevstr; + switch (severity) { + case CP_LOG_DEBUG: + sevstr = "DEBUG"; + break; + case CP_LOG_INFO: + sevstr = "INFO"; + break; + case CP_LOG_WARNING: + sevstr = "WARNING"; + break; + case CP_LOG_ERROR: + sevstr = "ERROR"; + break; + default: + check((sevstr = "UNKNOWN", 0)); + break; + } + if (apid != NULL) { + fprintf(stderr, "testsuite: %s: [%s] %s\n", sevstr, apid, msg); + } else { + fprintf(stderr, "testsuite: %s: [testsuite] %s\n", sevstr, msg); + } + if (severity >= CP_LOG_ERROR && user_data != NULL) { + (*((int *) user_data))++; + } +} + +static void counting_logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { + (*((int *) user_data))++; +} + +CP_HIDDEN cp_context_t *init_context(cp_log_severity_t min_disp_sev, int *error_counter) { + cp_context_t *ctx; + cp_status_t status; + + check(cp_init() == CP_OK); + check((ctx = cp_create_context(&status)) != NULL && status == CP_OK); + if (error_counter != NULL) { + *error_counter = 0; + } + if (error_counter != NULL || min_disp_sev <= CP_LOG_ERROR) { + if (min_disp_sev <= CP_LOG_ERROR) { + check(cp_register_logger(ctx, full_logger, error_counter, min_disp_sev) == CP_OK); + } else { + check(cp_register_logger(ctx, counting_logger, error_counter, CP_LOG_ERROR) == CP_OK); + } + } + return ctx; +} + +static char *plugindir_buffer = NULL; + +CP_HIDDEN const char *plugindir(const char *plugin) { + const char *srcdir; + + if (plugindir_buffer != NULL) { + free(plugindir_buffer); + plugindir_buffer = NULL; + } + if ((srcdir = getenv("srcdir")) == NULL) { + srcdir="."; + } + if ((plugindir_buffer = malloc((strlen(srcdir) + strlen("/plugins/") + strlen(plugin) + 1) * sizeof(char))) == NULL) { + fputs("testsuite: ERROR: Insufficient memory.\n", stderr); + exit(2); + } + strcpy(plugindir_buffer, srcdir); + strcat(plugindir_buffer, CP_FNAMESEP_STR "plugins" CP_FNAMESEP_STR); + strcat(plugindir_buffer, plugin); + return plugindir_buffer; +} + +static char *pcollectiondir_buffer = NULL; + +CP_HIDDEN const char *pcollectiondir(const char *collection) { + const char *srcdir; + + if (pcollectiondir_buffer != NULL) { + free(pcollectiondir_buffer); + pcollectiondir_buffer = NULL; + } + if ((srcdir = getenv("srcdir")) == NULL) { + srcdir="."; + } + if ((pcollectiondir_buffer = malloc((strlen(srcdir) + strlen("/pcollections/") + strlen(collection) + 1) * sizeof(char))) == NULL) { + fputs("testsuite: ERROR: Insufficient memory.\n", stderr); + exit(2); + } + strcpy(pcollectiondir_buffer, srcdir); + strcat(pcollectiondir_buffer, CP_FNAMESEP_STR "pcollections" CP_FNAMESEP_STR); + strcat(pcollectiondir_buffer, collection); + return pcollectiondir_buffer; +} + +CP_HIDDEN void free_test_resources(void) { + if (plugindir_buffer != NULL) { + free(plugindir_buffer); + plugindir_buffer = NULL; + } + if (pcollectiondir_buffer != NULL) { + free(pcollectiondir_buffer); + pcollectiondir_buffer = NULL; + } +} + +int main(int argc, char *argv[]) { + DLHANDLE dh; + void *ptr; + + // Check arguments + if (argc != 2) { + fputs("testsuite: ERROR: Usage: testsuite <test>\n", stderr); + exit(2); + } + if ((argv0 = argv[0]) == NULL) { + argv0 = "testsuite"; + } + + // Find the test + if ((dh = DLOPEN(NULL)) == NULL) { + fputs("testsuite: ERROR: Could not open the testsuite binary for symbols.\n", stderr); + exit(2); + } + if ((ptr = DLSYM(dh, argv[1])) == NULL) { + fprintf(stderr, "testsuite: ERROR: Could not resolve symbol %s.\n", argv[1]); + exit(2); + } + + // Execute the test + // (NOTE: This conversion is not ANSI C compatible) + ((void (*)(void)) ptr)(); + + // Free test resources + free_test_resources(); + + // Successfully completed + exit(0); +} diff --git a/lib/cpluff/test/tests.txt b/lib/cpluff/test/tests.txt new file mode 100644 index 0000000000..46435afeee --- /dev/null +++ b/lib/cpluff/test/tests.txt @@ -0,0 +1,44 @@ +getversion +gethosttype +fatalerrordefault +fatalerrorhandled +fatalerrorreset +initdestroy +initcreatedestroy +initloaddestroy +initinstalldestroy +initstartdestroy +initstartdestroyboth +nocollections +onecollection +twocollections +unregcollection +unregcollections +errorlogger +warninglogger +infologger +debuglogger +twologgers +unreglogger +updatelogger +logmsg +islogged +loadonlymaximal +loadminimal +loadmaximal +install +installtwo +installconflict +uninstall +scanupgrade +scanstoponupgrade +scanstoponinstall +scanrestart +plugincallbacks +pluginmissingdep +plugindepchain +plugindeploop +extpoints +extensions +extcfgutils +symbolusage |