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
|
- compiler: gcc
|
||||||
env: SWIGLANG=python
|
env: SWIGLANG=python
|
||||||
- compiler: gcc
|
- compiler: gcc
|
||||||
env: SWIGLANG=scilab
|
env: SWIGLANG=scilab SWIGJOBS=-j4
|
||||||
allow_failures:
|
allow_failures:
|
||||||
# None
|
# None
|
||||||
before_install:
|
before_install:
|
||||||
|
|
|
||||||
|
|
@ -1587,11 +1587,24 @@ define get_swig_scilab_args
|
||||||
ifdef INCLUDES
|
ifdef INCLUDES
|
||||||
SWIG_SCILAB_ARGS += -addcflag "$(INCLUDES)"
|
SWIG_SCILAB_ARGS += -addcflag "$(INCLUDES)"
|
||||||
endif
|
endif
|
||||||
|
ifdef OUTDIR
|
||||||
|
SWIG_SCILAB_ARGS += -outdir "$(OUTDIR)"
|
||||||
|
endif
|
||||||
ifdef TARGET
|
ifdef TARGET
|
||||||
SWIG_SCILAB_ARGS += -o "$(TARGET)"
|
SWIG_SCILAB_ARGS += -o "$(TARGET)"
|
||||||
endif
|
endif
|
||||||
endef
|
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
|
# Build a C dynamically loadable module
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
@ -1599,8 +1612,9 @@ endef
|
||||||
scilab: $(SRCS)
|
scilab: $(SRCS)
|
||||||
$(eval $(call get_swig_scilab_args))
|
$(eval $(call get_swig_scilab_args))
|
||||||
$(SWIG) $(SWIGOPT) $(SWIG_SCILAB_ARGS) $(INTERFACEPATH)
|
$(SWIG) $(SWIGOPT) $(SWIG_SCILAB_ARGS) $(INTERFACEPATH)
|
||||||
if [ -f builder.sce ]; then \
|
$(eval $(call get_output_dir))
|
||||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) $(SCILAB_STARTOPT) -f builder.sce; \
|
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
|
fi
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
@ -1610,8 +1624,9 @@ scilab: $(SRCS)
|
||||||
scilab_cpp: $(SRCS)
|
scilab_cpp: $(SRCS)
|
||||||
$(eval $(call get_swig_scilab_args))
|
$(eval $(call get_swig_scilab_args))
|
||||||
$(SWIG) $(SWIGOPT) -c++ $(SWIG_SCILAB_ARGS) $(INTERFACEPATH)
|
$(SWIG) $(SWIGOPT) -c++ $(SWIG_SCILAB_ARGS) $(INTERFACEPATH)
|
||||||
if [ -f builder.sce ]; then \
|
$(eval $(call get_output_dir))
|
||||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) $(SCILAB_STARTOPT) -f builder.sce; \
|
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
|
fi
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
|
|
@ -1619,7 +1634,8 @@ scilab_cpp: $(SRCS)
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
|
|
||||||
scilab_run:
|
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
|
# Scilab version
|
||||||
|
|
|
||||||
|
|
@ -17,58 +17,74 @@ top_builddir = @top_builddir@
|
||||||
# - member_pointer (C++)
|
# - member_pointer (C++)
|
||||||
# - typemap_variables (C++)
|
# - typemap_variables (C++)
|
||||||
|
|
||||||
# configure cache to speed up test run
|
define get_output_dir
|
||||||
CONF_CACHE=$(CURDIR)/test-suite.config.cache
|
OUTDIR := $(CURDIR)/$(1).build
|
||||||
CONFIG_SITE=$(CURDIR)/test-suite.config.site
|
endef
|
||||||
export CONFIG_SITE
|
|
||||||
|
|
||||||
enable_config_cache = \
|
define get_runme_script
|
||||||
echo 'cache_file=$(CONF_CACHE)' > $(CONFIG_SITE)
|
RUNME_SCRIPT := $(srcdir)/$(SCRIPTPREFIX)$(1)$(SCRIPTSUFFIX)
|
||||||
|
endef
|
||||||
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
|
|
||||||
|
|
||||||
include $(srcdir)/../common.mk
|
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
|
# Rules for the different types of tests
|
||||||
%.cpptest:
|
%.cpptest:
|
||||||
$(setup)
|
$(setup)
|
||||||
$(enable_config_cache)
|
$(eval $(call get_output_dir,$*))
|
||||||
|
mkdir -p $(OUTDIR)
|
||||||
+$(swig_and_compile_cpp)
|
+$(swig_and_compile_cpp)
|
||||||
$(run_testcase)
|
$(run_testcase)
|
||||||
|
|
||||||
%.ctest:
|
%.ctest:
|
||||||
$(setup)
|
$(setup)
|
||||||
$(enable_config_cache)
|
$(eval $(call get_output_dir,$*))
|
||||||
|
mkdir -p $(OUTDIR)
|
||||||
+$(swig_and_compile_c)
|
+$(swig_and_compile_c)
|
||||||
$(run_testcase)
|
$(run_testcase)
|
||||||
|
|
||||||
%.multicpptest:
|
%.multicpptest:
|
||||||
$(setup)
|
$(setup)
|
||||||
$(reset_config_cache)
|
$(eval $(call get_output_dir,$*))
|
||||||
|
mkdir -p $(OUTDIR)
|
||||||
+$(swig_and_compile_multi_cpp)
|
+$(swig_and_compile_multi_cpp)
|
||||||
$(run_testcase)
|
$(run_testcase)
|
||||||
|
|
||||||
# Runs the testcase. A testcase is only run if
|
# Runs the testcase. A testcase is only run if
|
||||||
# a file is found which has _runme.sci appended after the testcase name.
|
# a file is found which has _runme.sci appended after the testcase name.
|
||||||
run_testcase = \
|
run_testcase = \
|
||||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
$(eval $(call get_output_dir,$*)) \
|
||||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) $(SCILAB_STARTOPT) -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \
|
$(eval $(call get_runme_script,$*)) \
|
||||||
fi;
|
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: remove the generated files
|
||||||
%.clean:
|
%.clean:
|
||||||
@rm -f builder.sce loader.sce cleaner.sce $*_wrap.c $*_wrap.cxx lib$*lib.* $(CONFIG_SITE) $(CONF_CACHE)
|
@rm -rf $*.build
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile scilab_clean
|
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile scilab_clean
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
// Clean files
|
// Clean files
|
||||||
exec("cleaner.sce", -1);
|
|
||||||
mdelete("builder.sce");
|
exec(fullfile(testbuilddir, "cleaner.sce"), -1);
|
||||||
mdelete("cleaner.sce");
|
|
||||||
mdelete(swigtestname + "_wrap.c");
|
mdelete(fullfile(testbuilddir, "builder.sce"));
|
||||||
mdelete(swigtestname + "_wrap.cxx");
|
mdelete(fullfile(testbuilddir, "cleaner.sce"));
|
||||||
mdelete(swigtestname + ".i");
|
mdelete(fullfile(testbuilddir, swigtestname + "_wrap.c"));
|
||||||
|
mdelete(fullfile(testbuilddir, swigtestname + "_wrap.cxx"));
|
||||||
|
mdelete(fullfile(testbuilddir, swigtestname + ".i"));
|
||||||
|
removedir(testbuilddir);
|
||||||
|
|
||||||
//mprintf("******************\n")
|
//mprintf("******************\n")
|
||||||
//mprintf("* TEST SUCCEEDED *\n")
|
//mprintf("* TEST SUCCEEDED *\n")
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,19 @@ lines(0);
|
||||||
[units, typ, names] = file(1);
|
[units, typ, names] = file(1);
|
||||||
swigtestname = strsubst(fileparts(names, "fname"), "_runme", "");
|
swigtestname = strsubst(fileparts(names, "fname"), "_runme", "");
|
||||||
|
|
||||||
|
// Test build dir
|
||||||
|
testbuilddir = swigtestname + ".build";
|
||||||
|
|
||||||
// Does the library exists? If not then exit!
|
// 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());
|
mprintf("*** LIBRARY NOT FOUND: %s ***\n", "lib" + swigtestname + "lib" + getdynlibext());
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
// Load library
|
// Load library
|
||||||
try
|
try
|
||||||
exec("loader.sce", -1);
|
exec(fullfile(testbuilddir, "loader.sce"), -1);
|
||||||
catch
|
catch
|
||||||
mprintf("*** LOADER EXECUTION FAILED ***\n");
|
mprintf("*** LOADER EXECUTION FAILED ***\n");
|
||||||
exit
|
exit
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,11 @@ public:
|
||||||
Printf(builderCode, "mode(-1);\n");
|
Printf(builderCode, "mode(-1);\n");
|
||||||
Printf(builderCode, "lines(0);\n"); /* Useful for automatic tests */
|
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_verbose(%s);\n", verboseBuildLevel);
|
||||||
|
|
||||||
Printf(builderCode, "ilib_name = \"%slib\";\n", moduleName);
|
Printf(builderCode, "ilib_name = \"%slib\";\n", moduleName);
|
||||||
|
|
@ -163,7 +168,7 @@ public:
|
||||||
Printf(builderCode, "ldflags = \"\";\n");
|
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) {
|
if (cflag != NULL) {
|
||||||
Printf(builderCode, "includepath = \"%s\";\n", cflag);
|
Printf(builderCode, "includepath = \"%s\";\n", cflag);
|
||||||
Printf(builderCode, "includepath = fullpath(part(includepath, 3:length(includepath)));\n");
|
Printf(builderCode, "includepath = fullpath(part(includepath, 3:length(includepath)));\n");
|
||||||
|
|
@ -174,9 +179,9 @@ public:
|
||||||
for (int i = 0; i < Len(sourceFileList); i++) {
|
for (int i = 0; i < Len(sourceFileList); i++) {
|
||||||
String *sourceFile = Getitem(sourceFileList, i);
|
String *sourceFile = Getitem(sourceFileList, i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
Printf(builderCode, "files = \"%s\";\n", sourceFile);
|
Printf(builderCode, "files = \"%s\";\n", sourceFile);
|
||||||
} else {
|
} 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, "if ~isempty(table) then\n");
|
||||||
Printf(builderCode, " ilib_build(ilib_name, table, files, libs, [], ldflags, cflags);\n");
|
Printf(builderCode, " ilib_build(ilib_name, table, files, libs, [], ldflags, cflags);\n");
|
||||||
Printf(builderCode, "end\n");
|
Printf(builderCode, "end\n");
|
||||||
|
Printf(builderCode, "cd(originaldir);\n");
|
||||||
|
|
||||||
Printf(builderCode, "exit");
|
Printf(builderCode, "exit");
|
||||||
builderFile = NewFile(NewStringf("%sbuilder.sce", SWIG_output_directory()), "w", SWIG_output_files());
|
builderFile = NewFile(NewStringf("%sbuilder.sce", SWIG_output_directory()), "w", SWIG_output_files());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue