summaryrefslogtreecommitdiffstats
path: root/scilab/modules/dynamic_link
diff options
context:
space:
mode:
authorAllan CORNET <allan.cornet@scilab.org>2010-04-14 17:03:10 +0200
committerPierre MARECHAL <pierre.marechal@scilab.org>2010-04-15 09:32:56 +0200
commit6f8dfe6d3280552d7b106fc6b1b9c8ba67cfb364 (patch)
treeeab31d663b892bf47d7e7444f0e0de3c0b52357c /scilab/modules/dynamic_link
parent83448f9e5497f960aab367177a8e96d5b02df24a (diff)
downloadscilab-6f8dfe6d3280552d7b106fc6b1b9c8ba67cfb364.zip
scilab-6f8dfe6d3280552d7b106fc6b1b9c8ba67cfb364.tar.gz
bug 6902
Change-Id: I6d06fd34ff422723b9e0034444b7185637d6cbd3
Diffstat (limited to 'scilab/modules/dynamic_link')
-rw-r--r--scilab/modules/dynamic_link/macros/ilib_gen_gateway.sci15
-rw-r--r--scilab/modules/dynamic_link/tests/nonreg_tests/bug_6902.dia.ref30
-rw-r--r--scilab/modules/dynamic_link/tests/nonreg_tests/bug_6902.tst38
3 files changed, 76 insertions, 7 deletions
diff --git a/scilab/modules/dynamic_link/macros/ilib_gen_gateway.sci b/scilab/modules/dynamic_link/macros/ilib_gen_gateway.sci
index 08a50a3..60d808c 100644
--- a/scilab/modules/dynamic_link/macros/ilib_gen_gateway.sci
+++ b/scilab/modules/dynamic_link/macros/ilib_gen_gateway.sci
@@ -86,20 +86,21 @@ function gateway_filename = ilib_gen_gateway(name,tables)
86 ' return 0;'; 86 ' return 0;';
87 '}']; 87 '}'];
88 88
89 gateway_filename = path + tname + '.c'; 89 gateway_filename = path + tname + '.c';
90 // first chek if we already have a gateway 90 // first check if we have already a gateway
91 [fd,ierr] = mopen(gateway_filename); 91 [fd, ierr] = mopen(gateway_filename, 'rt');
92 if ierr == 0 then 92 if ierr == 0 then
93 // file already exists
94 t1 = mgetl(fd);
93 mclose(fd); 95 mclose(fd);
94 t1 = mgetl(gateway_filename); 96 if or(t1 <> t) then
95 if t1 <> t then 97 mputl(t, gateway_filename);
96 mputl(t, gateway_filename);
97 end 98 end
98 else 99 else
99 // file does not exist we create it 100 // file does not exist we create it
100 mputl(t, gateway_filename) ; 101 mputl(t, gateway_filename) ;
101 end 102 end
102 103
103 if ilib_verbose() > 1 then 104 if ilib_verbose() > 1 then
104 disp(t); 105 disp(t);
105 end 106 end
diff --git a/scilab/modules/dynamic_link/tests/nonreg_tests/bug_6902.dia.ref b/scilab/modules/dynamic_link/tests/nonreg_tests/bug_6902.dia.ref
new file mode 100644
index 0000000..5ca81b8
--- /dev/null
+++ b/scilab/modules/dynamic_link/tests/nonreg_tests/bug_6902.dia.ref
@@ -0,0 +1,30 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Allan CORNET
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- JVM NOT MANDATORY -->
8// <-- Non-regression test for bug 6902 -->
9//
10// <-- Bugzilla URL -->
11// http://bugzilla.scilab.org/show_bug.cgi?id=6902
12// <-- Short Description -->
13// ilib_gen_gateway did not regenerate gateway when we need.
14cd(TMPDIR);
15name = 'gw_example1';
16table = ['sci_func1', 'func1'];
17WITHOUT_AUTO_PUTLHSVAR = %t;
18n1 = ilib_gen_gateway(name,table);
19r1 = fileinfo(n1);
20WITHOUT_AUTO_PUTLHSVAR = %f;
21n2 = ilib_gen_gateway(name,table);
22r2 = fileinfo(n2);
23// there is a modification then gateway must be modified
24if ~or(r1 <> r2) then bugmes();quit;end
25WITHOUT_AUTO_PUTLHSVAR = %f;
26n3 = ilib_gen_gateway(name,table);
27r3 = fileinfo(n3);
28// there is no modification
29if ~and(r2 == r3) then bugmes();quit;end
30// =============================================================================
diff --git a/scilab/modules/dynamic_link/tests/nonreg_tests/bug_6902.tst b/scilab/modules/dynamic_link/tests/nonreg_tests/bug_6902.tst
new file mode 100644
index 0000000..d805a03
--- /dev/null
+++ b/scilab/modules/dynamic_link/tests/nonreg_tests/bug_6902.tst
@@ -0,0 +1,38 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Allan CORNET
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// <-- JVM NOT MANDATORY -->
9
10// <-- Non-regression test for bug 6902 -->
11//
12// <-- Bugzilla URL -->
13// http://bugzilla.scilab.org/show_bug.cgi?id=6902
14// <-- Short Description -->
15// ilib_gen_gateway did not regenerate gateway when we need.
16
17cd(TMPDIR);
18
19name = 'gw_example1';
20table = ['sci_func1', 'func1'];
21
22WITHOUT_AUTO_PUTLHSVAR = %t;
23n1 = ilib_gen_gateway(name,table);
24r1 = fileinfo(n1);
25
26WITHOUT_AUTO_PUTLHSVAR = %f;
27n2 = ilib_gen_gateway(name,table);
28r2 = fileinfo(n2);
29
30// there is a modification then gateway must be modified
31if ~or(r1 <> r2) then pause,end
32
33WITHOUT_AUTO_PUTLHSVAR = %f;
34n3 = ilib_gen_gateway(name,table);
35r3 = fileinfo(n3);
36// there is no modification
37if ~and(r2 == r3) then pause,end
38// =============================================================================