Scilab: parallelization of test-suite, remove configure cache
This commit is contained in:
parent
7a81f55ac9
commit
b4ed5625ee
6 changed files with 88 additions and 43 deletions
|
|
@ -9,7 +9,7 @@ matrix:
|
|||
- compiler: gcc
|
||||
env: SWIGLANG=python
|
||||
- compiler: gcc
|
||||
env: SWIGLANG=scilab
|
||||
env: SWIGLANG=scilab SWIGJOBS=-j4
|
||||
allow_failures:
|
||||
# None
|
||||
before_install:
|
||||
|
|
|
|||
|
|
@ -1587,11 +1587,24 @@ define get_swig_scilab_args
|
|||
ifdef INCLUDES
|
||||
SWIG_SCILAB_ARGS += -addcflag "$(INCLUDES)"
|
||||
endif
|
||||
ifdef OUTDIR
|
||||
SWIG_SCILAB_ARGS += -outdir "$(OUTDIR)"
|
||||
endif
|
||||
ifdef TARGET
|
||||
SWIG_SCILAB_ARGS += -o "$(TARGET)"
|
||||
endif
|
||||
endef
|
||||
|
||||
# Returns the output dir
|
||||
define get_output_dir
|
||||
ifdef OUTDIR
|
||||
OUTPUT_DIR := $(OUTDIR)
|
||||
else
|
||||
OUTPUT_DIR := .
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Build a C dynamically loadable module
|
||||
# ----------------------------------------------------------------
|
||||
|
|
@ -1599,8 +1612,9 @@ endef
|
|||
scilab: $(SRCS)
|
||||
$(eval $(call get_swig_scilab_args))
|
||||
$(SWIG) $(SWIGOPT) $(SWIG_SCILAB_ARGS) $(INTERFACEPATH)
|
||||
if [ -f builder.sce ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) $(SCILAB_STARTOPT) -f builder.sce; \
|
||||
$(eval $(call get_output_dir))
|
||||
if [ -f $(OUTPUT_DIR)/builder.sce ]; then \
|
||||
env LD_LIBRARY_PATH=$(OUTPUT_DIR):$$LD_LIBRARY_PATH MAKEFLAGS="-j1" $(RUNTOOL) $(SCILAB) $(SCILAB_STARTOPT) -f $(OUTPUT_DIR)/builder.sce; \
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
|
@ -1610,8 +1624,9 @@ scilab: $(SRCS)
|
|||
scilab_cpp: $(SRCS)
|
||||
$(eval $(call get_swig_scilab_args))
|
||||
$(SWIG) $(SWIGOPT) -c++ $(SWIG_SCILAB_ARGS) $(INTERFACEPATH)
|
||||
if [ -f builder.sce ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) $(SCILAB_STARTOPT) -f builder.sce; \
|
||||
$(eval $(call get_output_dir))
|
||||
if [ -f $(OUTPUT_DIR)/builder.sce ]; then \
|
||||
env LD_LIBRARY_PATH=$(OUTPUT_DIR):$$LD_LIBRARY_PATH MAKEFLAGS="-j1" $(RUNTOOL) $(SCILAB) $(SCILAB_STARTOPT) -f $(OUTPUT_DIR)/builder.sce; \
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
|
|
@ -1619,7 +1634,8 @@ scilab_cpp: $(SRCS)
|
|||
# -----------------------------------------------------------------
|
||||
|
||||
scilab_run:
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) $(SCILAB_STARTOPT) -f $(RUNME).sci $(RUNPIPE)
|
||||
$(eval $(call get_output_dir))
|
||||
env LD_LIBRARY_PATH=$(OUTPUT_DIR):$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) $(SCILAB_STARTOPT) -f $(RUNME).sci $(RUNPIPE)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Scilab version
|
||||
|
|
|
|||
|
|
@ -17,58 +17,74 @@ top_builddir = @top_builddir@
|
|||
# - member_pointer (C++)
|
||||
# - typemap_variables (C++)
|
||||
|
||||
# configure cache to speed up test run
|
||||
CONF_CACHE=$(CURDIR)/test-suite.config.cache
|
||||
CONFIG_SITE=$(CURDIR)/test-suite.config.site
|
||||
export CONFIG_SITE
|
||||
define get_output_dir
|
||||
OUTDIR := $(CURDIR)/$(1).build
|
||||
endef
|
||||
|
||||
enable_config_cache = \
|
||||
echo 'cache_file=$(CONF_CACHE)' > $(CONFIG_SITE)
|
||||
|
||||
disable_config_cache:
|
||||
rm -f $(CONF_CACHE)
|
||||
rm -f $(CONFIG_SITE)
|
||||
CONFIG_SITE=
|
||||
|
||||
# need reset cache before multicpptest
|
||||
reset_config_cache = \
|
||||
rm -f $(CONF_CACHE)
|
||||
|
||||
# disable cache at the end of test-suite
|
||||
# use trick for this: 'extra test cases' end target
|
||||
EXTRA_TEST_CASES = disable_config_cache
|
||||
define get_runme_script
|
||||
RUNME_SCRIPT := $(srcdir)/$(SCRIPTPREFIX)$(1)$(SCRIPTSUFFIX)
|
||||
endef
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Override make commands to specify OUTDIR
|
||||
swig_and_compile_cpp = \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
|
||||
INCLUDES="$(INCLUDES)" SWIGOPT= OUTDIR="$(OUTDIR)" \
|
||||
TARGET="$*_wrap.cxx" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
|
||||
scilab_cpp
|
||||
|
||||
swig_and_compile_c = \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CSRCS="$(CSRCS)" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
|
||||
INCLUDES="$(INCLUDES)" SWIGOPT= OUTDIR="$(OUTDIR)" \
|
||||
TARGET="$*_wrap.c" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
|
||||
scilab
|
||||
|
||||
swig_and_compile_multi_cpp = \
|
||||
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
|
||||
INCLUDES="$(INCLUDES)" SWIGOPT= OUTDIR="$(OUTDIR)" \
|
||||
TARGET="$*_wrap.cxx" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
|
||||
scilab_cpp; \
|
||||
done
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
$(setup)
|
||||
$(enable_config_cache)
|
||||
$(eval $(call get_output_dir,$*))
|
||||
mkdir -p $(OUTDIR)
|
||||
+$(swig_and_compile_cpp)
|
||||
$(run_testcase)
|
||||
|
||||
%.ctest:
|
||||
$(setup)
|
||||
$(enable_config_cache)
|
||||
$(eval $(call get_output_dir,$*))
|
||||
mkdir -p $(OUTDIR)
|
||||
+$(swig_and_compile_c)
|
||||
$(run_testcase)
|
||||
|
||||
%.multicpptest:
|
||||
$(setup)
|
||||
$(reset_config_cache)
|
||||
$(eval $(call get_output_dir,$*))
|
||||
mkdir -p $(OUTDIR)
|
||||
+$(swig_and_compile_multi_cpp)
|
||||
$(run_testcase)
|
||||
|
||||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.sci appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) $(SCILAB_STARTOPT) -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \
|
||||
fi;
|
||||
$(eval $(call get_output_dir,$*)) \
|
||||
$(eval $(call get_runme_script,$*)) \
|
||||
if [ -f $(RUNME_SCRIPT) ]; then ( \
|
||||
env LD_LIBRARY_PATH=$(OUTDIR):$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) $(SCILAB_STARTOPT) -f $(RUNME_SCRIPT); )\
|
||||
fi
|
||||
|
||||
# Clean: remove the generated files
|
||||
%.clean:
|
||||
@rm -f builder.sce loader.sce cleaner.sce $*_wrap.c $*_wrap.cxx lib$*lib.* $(CONFIG_SITE) $(CONF_CACHE)
|
||||
@rm -rf $*.build
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile scilab_clean
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
// Clean files
|
||||
exec("cleaner.sce", -1);
|
||||
mdelete("builder.sce");
|
||||
mdelete("cleaner.sce");
|
||||
mdelete(swigtestname + "_wrap.c");
|
||||
mdelete(swigtestname + "_wrap.cxx");
|
||||
mdelete(swigtestname + ".i");
|
||||
|
||||
exec(fullfile(testbuilddir, "cleaner.sce"), -1);
|
||||
|
||||
mdelete(fullfile(testbuilddir, "builder.sce"));
|
||||
mdelete(fullfile(testbuilddir, "cleaner.sce"));
|
||||
mdelete(fullfile(testbuilddir, swigtestname + "_wrap.c"));
|
||||
mdelete(fullfile(testbuilddir, swigtestname + "_wrap.cxx"));
|
||||
mdelete(fullfile(testbuilddir, swigtestname + ".i"));
|
||||
removedir(testbuilddir);
|
||||
|
||||
//mprintf("******************\n")
|
||||
//mprintf("* TEST SUCCEEDED *\n")
|
||||
|
|
|
|||
|
|
@ -4,15 +4,19 @@ lines(0);
|
|||
[units, typ, names] = file(1);
|
||||
swigtestname = strsubst(fileparts(names, "fname"), "_runme", "");
|
||||
|
||||
// Test build dir
|
||||
testbuilddir = swigtestname + ".build";
|
||||
|
||||
// Does the library exists? If not then exit!
|
||||
if ~isfile("lib" + swigtestname + "lib" + getdynlibext()) then
|
||||
libname = "lib" + swigtestname + "lib" + getdynlibext();
|
||||
if ~isfile(fullfile(testbuilddir, libname)) then
|
||||
mprintf("*** LIBRARY NOT FOUND: %s ***\n", "lib" + swigtestname + "lib" + getdynlibext());
|
||||
exit
|
||||
end
|
||||
|
||||
// Load library
|
||||
try
|
||||
exec("loader.sce", -1);
|
||||
exec(fullfile(testbuilddir, "loader.sce"), -1);
|
||||
catch
|
||||
mprintf("*** LOADER EXECUTION FAILED ***\n");
|
||||
exit
|
||||
|
|
|
|||
|
|
@ -152,6 +152,11 @@ public:
|
|||
Printf(builderCode, "mode(-1);\n");
|
||||
Printf(builderCode, "lines(0);\n"); /* Useful for automatic tests */
|
||||
|
||||
// Scilab needs to be in the build directory
|
||||
Printf(builderCode, "originaldir = pwd();\n");
|
||||
Printf(builderCode, "builddir = get_absolute_file_path('builder.sce');\n");
|
||||
Printf(builderCode, "cd(builddir);\n");
|
||||
|
||||
Printf(builderCode, "ilib_verbose(%s);\n", verboseBuildLevel);
|
||||
|
||||
Printf(builderCode, "ilib_name = \"%slib\";\n", moduleName);
|
||||
|
|
@ -163,7 +168,7 @@ public:
|
|||
Printf(builderCode, "ldflags = \"\";\n");
|
||||
}
|
||||
|
||||
Printf(builderCode, "cflags = [\"-g -I\" + get_absolute_file_path(\"builder.sce\")];\n");
|
||||
Printf(builderCode, "cflags = [\"-g -I\" + builddir];\n");
|
||||
if (cflag != NULL) {
|
||||
Printf(builderCode, "includepath = \"%s\";\n", cflag);
|
||||
Printf(builderCode, "includepath = fullpath(part(includepath, 3:length(includepath)));\n");
|
||||
|
|
@ -174,9 +179,9 @@ public:
|
|||
for (int i = 0; i < Len(sourceFileList); i++) {
|
||||
String *sourceFile = Getitem(sourceFileList, i);
|
||||
if (i == 0) {
|
||||
Printf(builderCode, "files = \"%s\";\n", sourceFile);
|
||||
Printf(builderCode, "files = \"%s\";\n", sourceFile);
|
||||
} else {
|
||||
Printf(builderCode, "files($ + 1) = \"%s\";\n", sourceFile);
|
||||
Printf(builderCode, "files($ + 1) = \"%s\";\n", sourceFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -208,6 +213,7 @@ public:
|
|||
Printf(builderCode, "if ~isempty(table) then\n");
|
||||
Printf(builderCode, " ilib_build(ilib_name, table, files, libs, [], ldflags, cflags);\n");
|
||||
Printf(builderCode, "end\n");
|
||||
Printf(builderCode, "cd(originaldir);\n");
|
||||
|
||||
Printf(builderCode, "exit");
|
||||
builderFile = NewFile(NewStringf("%sbuilder.sce", SWIG_output_directory()), "w", SWIG_output_files());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue