Skip to content

Commit a2f8dd0

Browse files
committed
Upd tests, memleak for modules test
1 parent 73a66aa commit a2f8dd0

File tree

6 files changed

+31
-7
lines changed

6 files changed

+31
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* Allow converting `mpdata` to `bytes, issue #427.
44
* Fixed: map cache for nested structure not cleared, issue #428.
55
* Add global `enum` definition, issue #429.
6-
* Add _anonymous_ wrap only type syntax (`&{..}`), pr
7-
* Added `ano()` function, pr
6+
* Add _anonymous_ wrap only type syntax (`&{..}`), pr #430.
7+
* Added `ano()` function, pr #430.
88

99
# v1.8.1
1010

itest/lib/vars.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
f'--suppressions={MEMLEAK_SUPP}',
5454
'--errors-for-leak-kinds=all',
5555
],
56-
# full and vebose memcheck
56+
# full and verbose memcheck
5757
[
5858
'valgrind',
5959
'--tool=memcheck',
@@ -66,6 +66,20 @@
6666
'--errors-for-leak-kinds=all',
6767
'-v',
6868
],
69+
# full, verbose memcheck and gen suppressions
70+
[
71+
'valgrind',
72+
'--tool=memcheck',
73+
'--error-exitcode=1',
74+
'--leak-check=full',
75+
'--show-leak-kinds=all',
76+
'--track-origins=yes',
77+
'--show-reachable=yes',
78+
'--gen-suppressions=all',
79+
f'--suppressions={MEMLEAK_SUPP}',
80+
'--errors-for-leak-kinds=all',
81+
'-v',
82+
],
6983
][int(os.environ.get('THINGSDB_MEMCHECK', 1))]
7084

7185
except ValueError:

itest/test_collection_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ async def test_base64_encode(self, client):
503503
with self.assertRaisesRegex(
504504
TypeError,
505505
r'function `base64_encode` expects argument 1 to be of '
506-
r'type `str` or type `bytes` but got type `int` instead'):
506+
r'type `str`, `bytes` or `mpdata` but got type `int` instead'):
507507
await client.query('base64_encode(1);')
508508

509509
self.assertEqual(await client.query('base64_encode("");'), '')
@@ -2630,7 +2630,7 @@ async def test_map_wrap(self, client):
26302630
with self.assertRaisesRegex(
26312631
TypeError,
26322632
r'function `map_wrap` expects argument 1 to be of '
2633-
r'type `str` but got type `nil` instead;'):
2633+
r'type `str` or `<anonymous>` but got type `nil` instead;'):
26342634
await client.query('[].map_wrap(nil);')
26352635

26362636
with self.assertRaisesRegex(

itest/test_thingsdb_functions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ async def test_collections_info(self, client):
118118

119119
collections = await client.query('collections_info();')
120120
self.assertEqual(len(collections), 1)
121-
self.assertEqual(len(collections[0]), 8)
121+
self.assertEqual(len(collections[0]), 9)
122122

123123
self.assertIn("collection_id", collections[0])
124124
self.assertIn("next_free_id", collections[0])
@@ -127,6 +127,7 @@ async def test_collections_info(self, client):
127127
self.assertIn("created_at", collections[0])
128128
self.assertIn("time_zone", collections[0])
129129
self.assertIn("default_deep", collections[0])
130+
self.assertIn("ano_types", collections[0])
130131
self.assertIn("commit_history", collections[0])
131132

132133
self.assertTrue(isinstance(collections[0]["collection_id"], int))
@@ -136,6 +137,7 @@ async def test_collections_info(self, client):
136137
self.assertTrue(isinstance(collections[0]["created_at"], int))
137138
self.assertTrue(isinstance(collections[0]["time_zone"], str))
138139
self.assertTrue(isinstance(collections[0]["default_deep"], int))
140+
self.assertTrue(isinstance(collections[0]["ano_types"], int))
139141
self.assertEqual(collections[0]["commit_history"], "disabled")
140142

141143
# at least one info should be checked for a correct created_at info

memleak.supp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,10 @@
8888
fun:lws_create_context
8989
...
9090
}
91-
91+
{
92+
<libcrypto (libcrypto)>
93+
Memcheck:Leak
94+
...
95+
obj:/usr/lib/x86_64-linux-gnu/libcrypto.so*
96+
...
97+
}

src/langdef/translate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ const char * langdef_translate(cleri_t * elem)
1919
case CLERI_GID_OPR6_COMPARE:
2020
case CLERI_GID_OPR7_CMP_AND:
2121
case CLERI_GID_OPR8_CMP_OR:
22+
case CLERI_GID_T_ANO:
2223
case CLERI_GID_T_FALSE:
2324
case CLERI_GID_T_INT:
2425
case CLERI_GID_T_NIL:
2526
case CLERI_GID_T_STRING:
2627
case CLERI_GID_T_TRUE:
28+
case CLERI_GID_X_ANO:
2729
case CLERI_GID_X_ARRAY:
2830
case CLERI_GID_X_ASSIGN:
2931
case CLERI_GID_X_BLOCK:

0 commit comments

Comments
 (0)