Changeset: 16c5a855d1de for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/16c5a855d1de
Added Files:
        sql/test/miscellaneous/Tests/sqlfuncnames.test
Modified Files:
        sql/backends/monet5/sql_gencode.c
        sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.test
        sql/test/miscellaneous/Tests/All
        sql/test/miscellaneous/Tests/simple_selects.test
        testing/CMakeLists.txt
        testing/Mconvert.py.in
        testing/Mtest.py.in
        testing/Mz.py.in
        testing/explain.py
Branch: sqlfuncfix
Log Message:

On debug builds use a mangled version of the sql function name, thus making it 
easier to debug. Added 'NOT_ASSERT' conditional on the test suite, so tests can 
run only on builds without assertions


diffs (194 lines):

diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -1156,11 +1156,21 @@ backend_create_sql_func(backend *be, sql
                        return -1;
                }
 
+#ifndef NDEBUG
+               /* for debug builds we keep the SQL function name in the MAL 
function name to make it easy to debug */
+               if (strlen(f->base.name) + 21 >= IDLENGTH) { /* 20 bits for u64 
number + '%' */
+                       (void) sql_error(m, 01, SQLSTATE(42000) "MAL function 
name '%s' too large for the backend", f->base.name);
+                       unlock_function(m->store, f->base.id);
+                       return -1;
+               }
+               (void) snprintf(befname, IDLENGTH, "%%" LLFMT "%s", 
store_function_counter(m->store), f->base.name);
+#else
+               (void) snprintf(befname, IDLENGTH, "f_" LLFMT, 
store_function_counter(m->store));
+#endif
                symbackup = c->curprg;
                memcpy(&bebackup, be, sizeof(backend)); /* backup current 
backend */
                backend_reset(be);
 
-               (void) snprintf(befname, IDLENGTH, "f_" LLFMT, 
store_function_counter(m->store));
                nargs = (f->res && f->type == F_UNION ? list_length(f->res) : 
1) + (f->vararg && ops ? list_length(ops) : f->ops ? list_length(f->ops) : 0);
                c->curprg = newFunctionArgs(putName(sql_shared_module_name), 
putName(befname), FUNCTIONsymbol, nargs);
                if (c->curprg == NULL) {
diff --git a/sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.test 
b/sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.test
--- a/sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.test
+++ b/sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.test
@@ -18,31 +18,6 @@ BEGIN
     RETURN tmp_generate_series;
 END
 
-query T python .explain.function_histogram
-explain select count(*) from my_generate_series(1,5) as t1,
-my_generate_series(1,100) as t2
-----
-aggr.count
-2
-algebra.crossproduct
-1
-algebra.projection
-2
-bat.pack
-5
-bat.single
-2
-batcalc.lng
-1
-querylog.define
-1
-sql.resultSet
-1
-sql.user_func
-2
-user.main
-1
-
 query I rowsort
 select count(*) from my_generate_series(1,5) as t1,
 my_generate_series(1,100) as t2
diff --git a/sql/test/miscellaneous/Tests/All b/sql/test/miscellaneous/Tests/All
--- a/sql/test/miscellaneous/Tests/All
+++ b/sql/test/miscellaneous/Tests/All
@@ -21,3 +21,4 @@ unique_keys
 vessels
 prepare
 rel_push_count_down
+NOT_ASSERT?sqlfuncnames
diff --git a/sql/test/miscellaneous/Tests/simple_selects.test 
b/sql/test/miscellaneous/Tests/simple_selects.test
--- a/sql/test/miscellaneous/Tests/simple_selects.test
+++ b/sql/test/miscellaneous/Tests/simple_selects.test
@@ -805,28 +805,6 @@ statement ok
 rollback
 
 statement ok
-create function 
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"() returns 
int return 2
-
-query I rowsort
-select "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"()
-----
-2
-
-statement ok
-drop function 
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-
-statement ok
-create function "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"() returns int return 3
-
-query I rowsort
-select "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"()
-----
-3
-
-statement ok
-drop function "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"
-
-statement ok
 create table thisnamewontconflict(y int, z int)
 
 statement ok rowcount 3
diff --git a/sql/test/miscellaneous/Tests/sqlfuncnames.test 
b/sql/test/miscellaneous/Tests/sqlfuncnames.test
new file mode 100644
--- /dev/null
+++ b/sql/test/miscellaneous/Tests/sqlfuncnames.test
@@ -0,0 +1,21 @@
+statement ok
+create function 
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"() returns 
int return 2
+
+query I rowsort
+select "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"()
+----
+2
+
+statement ok
+drop function 
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+
+statement ok
+create function "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"() returns int return 3
+
+query I rowsort
+select "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"()
+----
+3
+
+statement ok
+drop function "😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀"
diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt
--- a/testing/CMakeLists.txt
+++ b/testing/CMakeLists.txt
@@ -86,6 +86,9 @@ endif(HAVE_SHP)
 if (NOT WIN32)
   set(NOT_WIN32_FALSE "#")
 endif()
+if(NOT ASSERT)
+  set(NOT_ASSERT_FALSE "#")
+endif()
 
 configure_file(Mtest.py.in
   ${CMAKE_CURRENT_BINARY_DIR}/Mtest.py
diff --git a/testing/Mconvert.py.in b/testing/Mconvert.py.in
--- a/testing/Mconvert.py.in
+++ b/testing/Mconvert.py.in
@@ -402,6 +402,7 @@ CONDITIONALS = {
     'HAVE_SHP'             : "@HAVE_SHP_FALSE@",
     'NATIVE_WIN32'         : "@NATIVE_WIN32_FALSE@",
     'NOT_WIN32'            : "@NOT_WIN32_FALSE@",
+    'NOT_ASSERT'           : "@NOT_ASSERT_FALSE@",
     # unknown at compile time;
     # hence, we set them only at runtime in main() below
     'KNOWNFAIL'            : "", # skip on release branch when not in testweb
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -383,6 +383,7 @@ CONDITIONALS = {
     'HAVE_SHP'             : "@HAVE_SHP_FALSE@",
     'NATIVE_WIN32'         : "@NATIVE_WIN32_FALSE@",
     'NOT_WIN32'            : "@NOT_WIN32_FALSE@",
+    'NOT_ASSERT'           : "@NOT_ASSERT_FALSE@",
     # unknown at compile time;
     # hence, we set them only at runtime in main() below
     'KNOWNFAIL'            : False, # skip on release branch when not in 
testweb
diff --git a/testing/Mz.py.in b/testing/Mz.py.in
--- a/testing/Mz.py.in
+++ b/testing/Mz.py.in
@@ -404,6 +404,7 @@ CONDITIONALS = {
     'HAVE_SHP'             : "@HAVE_SHP_FALSE@",
     'NATIVE_WIN32'         : "@NATIVE_WIN32_FALSE@",
     'NOT_WIN32'            : "@NOT_WIN32_FALSE@",
+    'NOT_ASSERT'           : "@NOT_ASSERT_FALSE@",
     # unknown at compile time;
     # hence, we set them only at runtime in main() below
     'KNOWNFAIL'            : False, # skip on release branch when not in 
testweb
diff --git a/testing/explain.py b/testing/explain.py
--- a/testing/explain.py
+++ b/testing/explain.py
@@ -20,8 +20,6 @@ def function_histogram(tab):
             g = 
re.match('^[^#].*\s([a-zA-Z_][a-zA-Z_0-9]*\.[a-zA-Z_][a-zA-Z_0-9]*)\(.*;', 
row[0])
             if g:
                 f = g.group(1)
-                if f.startswith('sql.f_'): # normalize user functions
-                    f = 'sql.user_func'
                 if f in histo:
                     histo[f]+=1
                 else:
@@ -41,8 +39,6 @@ def function_with_more_than_one_result_b
                 g2 = 
re.match('^[^#].*\s([a-zA-Z_][a-zA-Z_0-9]*\.[a-zA-Z_][a-zA-Z_0-9]*)\(.*;', 
row[0])
                 if g2:
                     f = g2.group(1)
-                    if f.startswith('sql.f_'): # normalize user functions
-                        f = 'sql.user_func'
                     if f in histo:
                         histo[f]+=1
                     else:
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to