diff --git a/Examples/Makefile.in b/Examples/Makefile.in index e1bddab4d..3348669d2 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -1155,8 +1155,8 @@ SCILAB = @SCILAB@ # ---------------------------------------------------------------- scilab: $(SRCS) - $(SWIG) -scilab $(SWIGOPT) $(INTERFACEPATH) - if [ -f builder.sce ]; then \ + @$(SWIG) -scilab $(SWIGOPT) $(INTERFACEPATH) + @if [ -f builder.sce ]; then \ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce; \ fi @@ -1165,8 +1165,8 @@ scilab: $(SRCS) # ---------------------------------------------------------------- scilab_cpp: $(SRCS) - $(SWIG) -scilab -c++ $(SWIGOPT) $(INTERFACEPATH) - if [ -f builder.sce ]; then \ + @$(SWIG) -scilab -c++ $(SWIGOPT) $(INTERFACEPATH) + @if [ -f builder.sce ]; then \ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce; \ fi @@ -1175,7 +1175,7 @@ scilab_cpp: $(SRCS) # ----------------------------------------------------------------- scilab_run: - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f runme.sci + @env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f runme.sci # ----------------------------------------------------------------- # Cleaning the scilab examples diff --git a/Examples/test-suite/scilab/Makefile.in b/Examples/test-suite/scilab/Makefile.in index df7de6990..892ffbee1 100644 --- a/Examples/test-suite/scilab/Makefile.in +++ b/Examples/test-suite/scilab/Makefile.in @@ -15,22 +15,24 @@ include $(srcdir)/../common.mk # none! # Rules for the different types of tests -%.cpptest: - +%.cpptest: + %.ctest: - $(setup) - cp ../$*.i $*.i - if [ -f ../$*.h ]; then (cp ../$*.h $*.h; ) fi; - +$(swig_and_compile_c) - $(run_testcase) + @$(setup) + @cp ../$*.i $*.i + @if [ -f ../$*.h ]; then (cp ../$*.h $*.h; ) fi; + @+$(swig_and_compile_c) + @$(run_testcase) -%.multicpptest: +%.multicpptest: # 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) -nwni -nb -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \ + else \ + (echo "**********************\n* RUNME FILE MISSING *\n**********************") \ fi; \ diff --git a/Examples/test-suite/scilab/arrays_dimensionless_runme.sci b/Examples/test-suite/scilab/arrays_dimensionless_runme.sci index dc9e1a669..6e673cf3e 100644 --- a/Examples/test-suite/scilab/arrays_dimensionless_runme.sci +++ b/Examples/test-suite/scilab/arrays_dimensionless_runme.sci @@ -1,6 +1,6 @@ -exec loader.sce; +exec("startswigtest.sce", -1); a = [1, 2, 3, 4] -if arr_double(a, 4) <> 10 then pause, end +if arr_double(a, 4) <> 10 then swigtesterror(); end -exit +exec("quitswigtest.sce", -1); diff --git a/Examples/test-suite/scilab/arrays_global_twodim_runme.sci b/Examples/test-suite/scilab/arrays_global_twodim_runme.sci index 5cbd6c92e..c33af31e7 100644 --- a/Examples/test-suite/scilab/arrays_global_twodim_runme.sci +++ b/Examples/test-suite/scilab/arrays_global_twodim_runme.sci @@ -1,7 +1,12 @@ -exec loader.sce; +exec("swigtest.start", -1); a = [1, 2, 3, 4; 5, 6, 7, 8;] -array_d_set(a); -if array_d_get() <> a then pause, end -exit +try + array_d_set(a); +catch + swigtesterror(); +end +if array_d_get() <> a then swigtesterror(); end + +exec("swigtest.start", -1); diff --git a/Examples/test-suite/scilab/char_constant_runme.sci b/Examples/test-suite/scilab/char_constant_runme.sci index cd8ba70e9..e48e3068d 100644 --- a/Examples/test-suite/scilab/char_constant_runme.sci +++ b/Examples/test-suite/scilab/char_constant_runme.sci @@ -1,9 +1,9 @@ -exec loader.sce; +exec("swigtest.start", -1); -if CHAR_CONSTANT_get() <> 'x' then pause, end -if STRING_CONSTANT_get() <> "xyzzy" then pause, end -if ESC_CONST_get() <> ascii(1) then pause, end -if ia_get() <> ascii('a') then pause, end -if ib_get() <> ascii('b') then pause, end +if CHAR_CONSTANT_get() <> "x" then swigtesterror(); end +if STRING_CONSTANT_get() <> "xyzzy" then swigtesterror(); end +if ESC_CONST_get() <> ascii(1) then swigtesterror(); end +if ia_get() <> ascii('a') then swigtesterror(); end +if ib_get() <> ascii('b') then swigtesterror(); end -exit +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/enums_runme.sci b/Examples/test-suite/scilab/enums_runme.sci index 9abcee518..63aae4cda 100644 --- a/Examples/test-suite/scilab/enums_runme.sci +++ b/Examples/test-suite/scilab/enums_runme.sci @@ -1,9 +1,24 @@ -lines(0); +exec("swigtest.start", -1); -exec loader.sce +try + bar1(CSP_ITERATION_FWD_get()) + bar1(CSP_ITERATION_BWD_get()) + bar1(int32(1)) -bar1(CSP_ITERATION_BWD_get()) -bar2(ABCDE_get()) -bar3(FGHJI_get()) + bar2(ABCDE_get()) + bar2(FGHJI_get()) + bar2(int32(1)) -exit + bar3(ABCDE_get()) + bar3(FGHJI_get()) + bar3(int32(1)) +catch + swigtesterror() +end + +if enumInstance_get() <> int32(2) then swigtesterror(); end +if Slap_get() <> int32(10) then swigtesterror(); end +if My_get() <> int32(11) then swigtesterror(); end +if Thigh_get() <> int32(12) then swigtesterror(); end + +exec("swigtest.quit", -1); \ No newline at end of file diff --git a/Examples/test-suite/scilab/funcptr_runme.sci b/Examples/test-suite/scilab/funcptr_runme.sci index 438e8e00e..430d15349 100644 --- a/Examples/test-suite/scilab/funcptr_runme.sci +++ b/Examples/test-suite/scilab/funcptr_runme.sci @@ -1,6 +1,6 @@ -exec loader.sce; +exec("swigtest.start", -1); -if add(7, 9) <> 16 then pause, end -if do_op(7, 9, funcvar_get()) <> 16 then pause, end +if add(7, 9) <> 16 then swigtesterror(); end +if do_op(7, 9, funcvar_get()) <> 16 then swigtesterror(); end -exit +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/inctest_runme.sci b/Examples/test-suite/scilab/inctest_runme.sci index 46a383a7e..5a8df7b8f 100644 --- a/Examples/test-suite/scilab/inctest_runme.sci +++ b/Examples/test-suite/scilab/inctest_runme.sci @@ -1,19 +1,20 @@ -exec loader.sce; +exec("swigtest.start", -1); try a = new_A(); catch printf("did not find A\ntherefore, I did not include ""testdir/subdir1/hello.i""\n"); + swigtesterror(); end try b = new_B(); catch printf("did not find B\ntherefore, I did not include ""testdir/subdir2/hello.i""\n"); + swigtesterror(); end -if importtest1(5) <> 15 then pause, end -if importtest2("black") <> "white" then pause, end - -exit +if importtest1(5) <> 15 then swigtesterror(); end +if importtest2("black") <> "white" then swigtesterror(); end +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/li_math_runme.sci b/Examples/test-suite/scilab/li_math_runme.sci index bcf5c76b7..d05f8eb18 100644 --- a/Examples/test-suite/scilab/li_math_runme.sci +++ b/Examples/test-suite/scilab/li_math_runme.sci @@ -1,6 +1,9 @@ -exec loader.sce; +exec("swigtest.start", -1); -x = fmod(M_PI_get(), M_1_PI_get()) - -exit +try + x = fmod(M_PI_get(), M_1_PI_get()) +catch + swigtesterror(); +end +exec("swigtest.quit", -1); \ No newline at end of file diff --git a/Examples/test-suite/scilab/name_runme.sci b/Examples/test-suite/scilab/name_runme.sci index 1a0beb7cb..dd901df61 100644 --- a/Examples/test-suite/scilab/name_runme.sci +++ b/Examples/test-suite/scilab/name_runme.sci @@ -1,7 +1,11 @@ -exec loader.sce; +exec("swigtest.start", -1); -foo_2(); -if bar_2_get() <> 17 then pause, end -if Baz_2_get() <> 47 then pause, end +try + foo_2(); +catch + swigtesterror(); +end +if bar_2_get() <> 17 then swigtesterror(); end +if Baz_2_get() <> 47 then swigtesterror(); end -exit +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/newobject2_runme.sci b/Examples/test-suite/scilab/newobject2_runme.sci index f737cb4d4..da1d50cbd 100644 --- a/Examples/test-suite/scilab/newobject2_runme.sci +++ b/Examples/test-suite/scilab/newobject2_runme.sci @@ -1,15 +1,31 @@ -exec loader.sce; +exec("swigtest.start", -1); -x = makeFoo(); -if fooCount() <> 1 then pause, end +try + x = makeFoo(); +catch + swigtesterror(); +end +if fooCount() <> 1 then swigtesterror(); end -y = makeFoo(); -if fooCount() <> 2 then pause, end +try + y = makeFoo(); +catch + swigtesterror(); +end +if fooCount() <> 2 then swigtesterror(); end -delete_Foo(x); -if fooCount() <> 1 then pause, end +try + delete_Foo(x); +catch + swigtesterror(); +end +if fooCount() <> 1 then swigtesterror(); end -delete_Foo(y); -if fooCount() <> 0 then pause, end +try + delete_Foo(y); +catch + swigtesterror(); +end +if fooCount() <> 0 then swigtesterror(); end -exit +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/overload_extend_runme.sci b/Examples/test-suite/scilab/overload_extend_runme.sci index 481c8bc25..04f71c1e6 100644 --- a/Examples/test-suite/scilab/overload_extend_runme.sci +++ b/Examples/test-suite/scilab/overload_extend_runme.sci @@ -1,9 +1,13 @@ -exec loader.sce +exec("swigtest.start", -1); -x = new_Foo(); -if Foo_test(x) <> 0 then pause, end -if Foo_test(x, 1) <> 1 then pause, end -if Foo_test(x, 2, 3) <> 5 then pause, end -if Foo_test(x, "Hello, swig!") <> 2 then pause, end +try + x = new_Foo(); +catch + swigtesterror(); +end +if Foo_test(x) <> 0 then swigtesterror(); end +if Foo_test(x, 1) <> 1 then swigtesterror(); end +if Foo_test(x, 2, 3) <> 5 then swigtesterror(); end +if Foo_test(x, "Hello, swig!") <> 2 then swigtesterror(); end -exit +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/overload_extendc_runme.sci b/Examples/test-suite/scilab/overload_extendc_runme.sci index 7ffaeec76..bf474ddbf 100644 --- a/Examples/test-suite/scilab/overload_extendc_runme.sci +++ b/Examples/test-suite/scilab/overload_extendc_runme.sci @@ -1,11 +1,15 @@ -exec loader.sce +exec("swigtest.start", -1); -x = new_Foo(); -if Foo_test(x, 1) <> 1 then pause, end -if Foo_test(x, "Hello swig!") <> 2 then pause, end -if Foo_test(x, 2, 3) <> 3 then pause, end -if Foo_test(x, x) <> 30 then pause, end -if Foo_test(x, x, 4) <> 24 then pause, end -if Foo_test(x, x, 4, 5) <> 9 then pause, end +try + x = new_Foo(); +catch + swigtesterror(); +end +if Foo_test(x, 1) <> 1 then swigtesterror(); end +if Foo_test(x, "Hello swig!") <> 2 then swigtesterror(); end +if Foo_test(x, 2, 3) <> 3 then swigtesterror(); end +if Foo_test(x, x) <> 30 then swigtesterror(); end +if Foo_test(x, x, 4) <> 24 then swigtesterror(); end +if Foo_test(x, x, 4, 5) <> 9 then swigtesterror(); end -exit +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/preproc_runme.sci b/Examples/test-suite/scilab/preproc_runme.sci index f240b1f2c..a54815a34 100644 --- a/Examples/test-suite/scilab/preproc_runme.sci +++ b/Examples/test-suite/scilab/preproc_runme.sci @@ -1,8 +1,8 @@ -exec loader.sce; +exec("swigtest.start", -1); -if endif_get() <> 1 then pause, end -if define_get() <> 1 then pause, end -if defined_get() <> 1 then pause ,end -if 2 * one_get() <> two_get() then pause, end - -exit +if endif_get() <> 1 then swigtesterror(); end +if define_get() <> 1 then swigtesterror(); end +if defined_get() <> 1 then swigtesterror(); end +if 2 * one_get() <> two_get() then swigtesterror(); end + +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/ret_by_value_runme.sci b/Examples/test-suite/scilab/ret_by_value_runme.sci new file mode 100644 index 000000000..2be40d62e --- /dev/null +++ b/Examples/test-suite/scilab/ret_by_value_runme.sci @@ -0,0 +1,13 @@ +exec("swigtest.start", -1); + +try + a = get_test(); +catch + swigtesterror(); +end + +if test_myInt_get(a) <> 100 then swigtesterror(); end + +if test_myShort_get(a) != 200 then swigtesterror(); end + +exec("swigtest.quit", -1); \ No newline at end of file diff --git a/Examples/test-suite/scilab/simple_array_runme.sci b/Examples/test-suite/scilab/simple_array_runme.sci index 782541655..8ff1a3a57 100644 --- a/Examples/test-suite/scilab/simple_array_runme.sci +++ b/Examples/test-suite/scilab/simple_array_runme.sci @@ -1,7 +1,12 @@ -exec loader.sce; +exec("swigtest.start", -1); -initArray(); -if x_get() <> int32([0,1,2,3,4,5,6,7,8,9]) then pause, end -if y_get() <> [0/7,1/7,2/7,3/7,4/7,5/7,6/7] then pause, end +try + initArray(); +catch + swigtesterror(); +end -exit +if x_get() <> int32([0,1,2,3,4,5,6,7,8,9]) then swigtesterror(); end +if y_get() <> [0/7,1/7,2/7,3/7,4/7,5/7,6/7] then swigtesterror(); end + +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/sneaky1_runme.sci b/Examples/test-suite/scilab/sneaky1_runme.sci index 4c434f901..5d9e24407 100644 --- a/Examples/test-suite/scilab/sneaky1_runme.sci +++ b/Examples/test-suite/scilab/sneaky1_runme.sci @@ -1,15 +1,31 @@ -exec loader.sce; +exec("swigtest.start", -1); -x = add(3, 4); -if x <> 7 then pause, end +try + x = add(3, 4); +catch + swigtesterror(); +end +if x <> 7 then swigtesterror(); end -y = subtract(3,4); -if y <> -1 then pause, end +try + y = subtract(3,4); +catch + swigtesterror(); +end +if y <> -1 then swigtesterror(); end -z = mul(3,4); -if z <> 12 then pause, end +try + z = mul(3,4); +catch + swigtesterror(); +end +if z <> 12 then swigtesterror(); end -w = divide(3,4); -if w <> 0 then pause, end +try + w = divide(3,4); +catch + swigtesterror(); +end +if w <> 0 then swigtesterror(); end -exit +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/struct_rename_runme.sci b/Examples/test-suite/scilab/struct_rename_runme.sci index 6e9da3908..2737d446e 100644 --- a/Examples/test-suite/scilab/struct_rename_runme.sci +++ b/Examples/test-suite/scilab/struct_rename_runme.sci @@ -1,7 +1,11 @@ -exec loader.sce +exec("swigtest.start", -1); -a = new_Bar(); -Bar_x_set(a,100); -if Bar_x_get(a) <> 100 then pause,end +try + a = new_Bar(); + Bar_x_set(a,100); +catch + swigtesterror(); +end +if Bar_x_get(a) <> 100 then swigtesterror(); end -exit +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/swigtest.quit b/Examples/test-suite/scilab/swigtest.quit new file mode 100644 index 000000000..0df89dfa1 --- /dev/null +++ b/Examples/test-suite/scilab/swigtest.quit @@ -0,0 +1,13 @@ +// Clean files +exec("cleaner.sce", -1); +mdelete("builder.sce"); +mdelete("cleaner.sce"); +mdelete(swigtestname + "_wrap.c"); +mdelete(swigtestname + ".i"); + +//mprintf("******************\n") +//mprintf("* TEST SUCCEEDED *\n") +//mprintf("******************\n") + +// Exit from Scilab +exit \ No newline at end of file diff --git a/Examples/test-suite/scilab/swigtest.start b/Examples/test-suite/scilab/swigtest.start new file mode 100644 index 000000000..47df488de --- /dev/null +++ b/Examples/test-suite/scilab/swigtest.start @@ -0,0 +1,22 @@ +lines(0); + +// Get test name (used in swigtest.quit file) +[units, typ, names] = file(1); +swigtestname = strsubst(fileparts(names, "fname"), "_runme", ""); + +// Load library +try + exec("loader.sce", -1); +catch + mprintf("***************************\n") + mprintf("* LOADER EXECUTION FAILED *\n"); + mprintf("***************************\n") +end + +// Error management function +function swigtesterror() + mprintf("***************\n") + mprintf("* TEST FAILED *\n") + mprintf("***************\n") + exit +endfunction diff --git a/Examples/test-suite/scilab/typedef_struct_runme.sci b/Examples/test-suite/scilab/typedef_struct_runme.sci index f9024b8a1..e41c21629 100644 --- a/Examples/test-suite/scilab/typedef_struct_runme.sci +++ b/Examples/test-suite/scilab/typedef_struct_runme.sci @@ -1,16 +1,29 @@ -exec loader.sce +exec("swigtest.start", -1); -x = new_LineObj(); -LineObj_numpoints_set(x, 100); -if LineObj_numpoints_get(x) <> 100 then pause, end +try + x = new_LineObj(); + LineObj_numpoints_set(x, 100); +catch + swigtesterror(); +end +if LineObj_numpoints_get(x) <> 100 then swigtesterror(); end -if MS_NOOVERRIDE_get() <> -1111 then pause, end +if MS_NOOVERRIDE_get() <> -1111 then swigtesterror(); end -y = make_a(); -A_t_a_set(y, 200); -if A_t_a_get(y) <> 200 then pause, end -A_t_b_set(y, 300); -if A_t_b_get(y) <> 300 then pause, end +try + y = make_a(); + A_t_a_set(y, 200); +catch + swigtesterror(); +end +if A_t_a_get(y) <> 200 then swigtesterror(); end -exit +try + A_t_b_set(y, 300); +catch + swigtesterror(); +end +if A_t_b_get(y) <> 300 then swigtesterror(); end + +exec("swigtest.quit", -1); diff --git a/Examples/test-suite/scilab/unions_runme.sci b/Examples/test-suite/scilab/unions_runme.sci index 1a9b560e1..c8c6a9444 100644 --- a/Examples/test-suite/scilab/unions_runme.sci +++ b/Examples/test-suite/scilab/unions_runme.sci @@ -1,15 +1,23 @@ -exec loader.sce; +exec("swigtest.start", -1); -small = new_SmallStruct(); -SmallStruct_jill_set(small, 200); +try + small = new_SmallStruct(); + SmallStruct_jill_set(small, 200); -big = new_BigStruct(); -BigStruct_jack_set(big, 300); + big = new_BigStruct(); + BigStruct_jack_set(big, 300); -Jill = SmallStruct_jill_get(small); -if Jill <> 200 then pause, end + Jill = SmallStruct_jill_get(small); +catch + swigtesterror(); +end +if Jill <> 200 then swigtesterror(); end -Jack = BigStruct_jack_get(big); -if Jack <> 300 then pause, end +try + Jack = BigStruct_jack_get(big); +catch + swigtesterror(); +end +if Jack <> 300 then swigtesterror(); end -exit +exec("swigtest.quit", -1);