Fixed naming convention issues (internal Swig variables, shadow -> proxy, test.c -> runme.c, etc.), modified Makefiles, bugfixes ("name" -> "sym:name"). Started C test-suite.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@10655 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f585c69d02
commit
a13c5976b5
35 changed files with 925 additions and 639 deletions
62
Examples/test-suite/c/Makefile.in
Normal file
62
Examples/test-suite/c/Makefile.in
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#######################################################################
|
||||
# Makefile for C test-suite
|
||||
#######################################################################
|
||||
|
||||
LANGUAGE = c
|
||||
C = gcc
|
||||
CXX = g++
|
||||
SCRIPTSUFFIX = _runme.c
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = @top_builddir@/..
|
||||
|
||||
C_TEST_CASES =
|
||||
|
||||
CPP_TEST_CASES = \
|
||||
c_arguments
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
+(cd $* && $(swig_and_compile_cpp))
|
||||
$(run_testcase)
|
||||
|
||||
%.ctest:
|
||||
$(setup)
|
||||
+(cd $* && $(swig_and_compile_c))
|
||||
$(run_testcase)
|
||||
|
||||
%.multicpptest:
|
||||
$(setup)
|
||||
+(cd $* && $(swig_and_compile_multi_cpp))
|
||||
$(run_testcase)
|
||||
|
||||
# Makes a directory for the testcase if it does not exist
|
||||
setup = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE)" ; \
|
||||
else \
|
||||
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
|
||||
fi; \
|
||||
if [ ! -d $* ]; then \
|
||||
mkdir $*; \
|
||||
fi;
|
||||
|
||||
# Compiles C files then runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.c appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then (\
|
||||
cd $* && $(COMPILETOOL) $(CC) ../$*_runme.c $*_proxy.c -L. -l$* -o $*_runme && \
|
||||
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_LIBRARY_PATH="$*:$$DYLD_LIBRARY_PATH" $(RUNTOOL) ./$*_runme;) \
|
||||
fi;
|
||||
|
||||
# Clean: remove testcase directories
|
||||
%.clean:
|
||||
@if [ -d $* ]; then \
|
||||
rm -rf $*; \
|
||||
fi;
|
||||
|
||||
clean:
|
||||
@rm -f *_wrap.* *_proxy.* *~ *.exe *.dll *.so *.out *runme
|
||||
17
Examples/test-suite/c/c_arguments_runme.c
Normal file
17
Examples/test-suite/c/c_arguments_runme.c
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "c_arguments/c_arguments_proxy.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
A* a = new_A();
|
||||
if (A_foo(a, 0) != 1)
|
||||
fprintf(stderr, "call to A_foo() failed\n");
|
||||
delete_A(a);
|
||||
|
||||
int ***array = (int ***) 0;
|
||||
|
||||
foo_1(array);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue