Add "cimple_test" to the bazel build.

This commit is contained in:
iphydf 2020-03-02 15:06:12 +00:00
parent 0f7138c010
commit e618829112
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
4 changed files with 48 additions and 3 deletions

View File

@ -14,4 +14,4 @@ cirrus-ci_task:
- mv c-toxcore cirrus-ci-build - mv c-toxcore cirrus-ci-build
- cd - - cd -
test_all_script: test_all_script:
- bazel test --remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST --copt=-DUSE_IPV6=0 -c opt -k //c-toxcore/... - bazel test --copt=-DUSE_IPV6=0 -c opt -k //c-toxcore/...

View File

@ -122,3 +122,23 @@ cc_library(
":video", ":video",
], ],
) )
CIMPLE_SRCS = glob(
[
"*.c",
"*.h",
],
exclude = [
"*.api.h",
"toxav.h",
],
)
sh_test(
name = "cimple_test",
size = "small",
srcs = ["//hs-tokstyle/tools:check-cimple"],
args = ["$(location %s)" % f for f in CIMPLE_SRCS],
data = CIMPLE_SRCS,
tags = ["manual"],
)

View File

@ -85,8 +85,9 @@ RingBuffer *rb_new(int size)
} }
buf->size = size + 1; /* include empty elem */ buf->size = size + 1; /* include empty elem */
buf->data = (void **)calloc(buf->size, sizeof(void *));
if (!(buf->data = (void **)calloc(buf->size, sizeof(void *)))) { if (!buf->data) {
free(buf); free(buf);
return nullptr; return nullptr;
} }
@ -118,7 +119,7 @@ uint16_t rb_data(const RingBuffer *b, void **dest)
{ {
uint16_t i = 0; uint16_t i = 0;
for (; i < rb_size(b); i++) { for (; i < rb_size(b); ++i) {
dest[i] = b->data[(b->start + i) % b->size]; dest[i] = b->data[(b->start + i) % b->size];
} }

View File

@ -279,3 +279,27 @@ cc_library(
"//c-toxcore/toxencryptsave:defines", "//c-toxcore/toxencryptsave:defines",
], ],
) )
CIMPLE_SRCS = glob(
[
"*.c",
"*.h",
],
exclude = [
"*.api.h",
"ccompat.h",
"crypto_core_mem.c",
"ping_array.h",
"tox.h",
"tox_api.c",
],
)
sh_test(
name = "cimple_test",
size = "small",
srcs = ["//hs-tokstyle/tools:check-cimple"],
args = ["$(location %s)" % f for f in CIMPLE_SRCS],
data = CIMPLE_SRCS,
tags = ["manual"],
)