Skip to content

Commit f0196b2

Browse files
cryptomilkjrasamba
authored andcommitted
coverity: Add modeling file for Coverity scan
The modeling file has currently all macros for cmocka that Coverity doesn't detect false positives. We could add torture assert macros if needed too. Signed-off-by: Andreas Schneider <[email protected]> Reviewed-by: Jeremy Allison <[email protected]> Autobuild-User(master): Jeremy Allison <[email protected]> Autobuild-Date(master): Thu Feb 23 07:11:18 CET 2017 on sn-devel-144
1 parent 8ac43e0 commit f0196b2

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

coverity/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
coverity_assert_model.c:
2+
3+
This file is a Coverity Modeling file for which currently adds the needed models
4+
for using the cmocka unit test framework. The assert functions could create
5+
false positives, to avoid that you can load this modeling file in the Coverity
6+
web interface. If needed add models for torture_ and talloc_ macros.

coverity/coverity_assert_model.c

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#define LargestIntegralType unsigned long long
2+
3+
void _assert_true(const LargestIntegralType result,
4+
const char* const expression,
5+
const char * const file, const int line)
6+
{
7+
__coverity_panic__();
8+
}
9+
10+
void _assert_int_equal(
11+
const LargestIntegralType a, const LargestIntegralType b,
12+
const char * const file, const int line)
13+
{
14+
__coverity_panic__();
15+
}
16+
17+
void _assert_int_not_equal(
18+
const LargestIntegralType a, const LargestIntegralType b,
19+
const char * const file, const int line)
20+
{
21+
__coverity_panic__();
22+
}
23+
24+
void _assert_return_code(const LargestIntegralType result,
25+
size_t rlen,
26+
const LargestIntegralType error,
27+
const char * const expression,
28+
const char * const file,
29+
const int line)
30+
{
31+
__coverity_panic__();
32+
}
33+
34+
void _assert_string_equal(const char * const a, const char * const b,
35+
const char * const file, const int line)
36+
{
37+
__coverity_panic__();
38+
}
39+
40+
void _assert_string_not_equal(const char * const a, const char * const b,
41+
const char *file, const int line)
42+
{
43+
__coverity_panic__();
44+
}
45+
46+
void _assert_memory_equal(const void * const a, const void * const b,
47+
const size_t size, const char* const file,
48+
const int line)
49+
{
50+
__coverity_panic__();
51+
}
52+
53+
void _assert_memory_not_equal(const void * const a, const void * const b,
54+
const size_t size, const char* const file,
55+
const int line)
56+
{
57+
__coverity_panic__();
58+
}
59+
60+
void _assert_in_range(
61+
const LargestIntegralType value, const LargestIntegralType minimum,
62+
const LargestIntegralType maximum, const char* const file, const int line)
63+
{
64+
__coverity_panic__();
65+
}
66+
67+
void _assert_not_in_range(
68+
const LargestIntegralType value, const LargestIntegralType minimum,
69+
const LargestIntegralType maximum, const char* const file, const int line)
70+
{
71+
__coverity_panic__();
72+
}
73+
74+
void _assert_in_set(
75+
const LargestIntegralType value, const LargestIntegralType values[],
76+
const size_t number_of_values, const char* const file, const int line)
77+
{
78+
__coverity_panic__();
79+
}
80+
81+
void _assert_not_in_set(
82+
const LargestIntegralType value, const LargestIntegralType values[],
83+
const size_t number_of_values, const char* const file, const int line)
84+
{
85+
__coverity_panic__();
86+
}

0 commit comments

Comments
 (0)