summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2020-03-02 15:06:12 +0000
committeriphydf <iphydf@users.noreply.github.com>2020-03-02 15:20:34 +0000
commite618829112a298d6a859369862f760f1b7e3dc11 (patch)
treedcbba36cc500806ea3745e6fdb026b9afc33d9ff
parent0f7138c01006b35f2b1b477c30ae66ec243c21e1 (diff)
Add "cimple_test" to the bazel build.
-rw-r--r--.cirrus.yml2
-rw-r--r--toxav/BUILD.bazel20
-rw-r--r--toxav/ring_buffer.c5
-rw-r--r--toxcore/BUILD.bazel24
4 files changed, 48 insertions, 3 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index 0234f062..7a289e53 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -14,4 +14,4 @@ cirrus-ci_task:
14 - mv c-toxcore cirrus-ci-build 14 - mv c-toxcore cirrus-ci-build
15 - cd - 15 - cd -
16 test_all_script: 16 test_all_script:
17 - bazel test --remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST --copt=-DUSE_IPV6=0 -c opt -k //c-toxcore/... 17 - bazel test --copt=-DUSE_IPV6=0 -c opt -k //c-toxcore/...
diff --git a/toxav/BUILD.bazel b/toxav/BUILD.bazel
index a2b57ee9..865c0545 100644
--- a/toxav/BUILD.bazel
+++ b/toxav/BUILD.bazel
@@ -122,3 +122,23 @@ cc_library(
122 ":video", 122 ":video",
123 ], 123 ],
124) 124)
125
126CIMPLE_SRCS = glob(
127 [
128 "*.c",
129 "*.h",
130 ],
131 exclude = [
132 "*.api.h",
133 "toxav.h",
134 ],
135)
136
137sh_test(
138 name = "cimple_test",
139 size = "small",
140 srcs = ["//hs-tokstyle/tools:check-cimple"],
141 args = ["$(location %s)" % f for f in CIMPLE_SRCS],
142 data = CIMPLE_SRCS,
143 tags = ["manual"],
144)
diff --git a/toxav/ring_buffer.c b/toxav/ring_buffer.c
index 2b76f2ba..7cb8996d 100644
--- a/toxav/ring_buffer.c
+++ b/toxav/ring_buffer.c
@@ -85,8 +85,9 @@ RingBuffer *rb_new(int size)
85 } 85 }
86 86
87 buf->size = size + 1; /* include empty elem */ 87 buf->size = size + 1; /* include empty elem */
88 buf->data = (void **)calloc(buf->size, sizeof(void *));
88 89
89 if (!(buf->data = (void **)calloc(buf->size, sizeof(void *)))) { 90 if (!buf->data) {
90 free(buf); 91 free(buf);
91 return nullptr; 92 return nullptr;
92 } 93 }
@@ -118,7 +119,7 @@ uint16_t rb_data(const RingBuffer *b, void **dest)
118{ 119{
119 uint16_t i = 0; 120 uint16_t i = 0;
120 121
121 for (; i < rb_size(b); i++) { 122 for (; i < rb_size(b); ++i) {
122 dest[i] = b->data[(b->start + i) % b->size]; 123 dest[i] = b->data[(b->start + i) % b->size];
123 } 124 }
124 125
diff --git a/toxcore/BUILD.bazel b/toxcore/BUILD.bazel
index fc28a333..2fe951ac 100644
--- a/toxcore/BUILD.bazel
+++ b/toxcore/BUILD.bazel
@@ -279,3 +279,27 @@ cc_library(
279 "//c-toxcore/toxencryptsave:defines", 279 "//c-toxcore/toxencryptsave:defines",
280 ], 280 ],
281) 281)
282
283CIMPLE_SRCS = glob(
284 [
285 "*.c",
286 "*.h",
287 ],
288 exclude = [
289 "*.api.h",
290 "ccompat.h",
291 "crypto_core_mem.c",
292 "ping_array.h",
293 "tox.h",
294 "tox_api.c",
295 ],
296)
297
298sh_test(
299 name = "cimple_test",
300 size = "small",
301 srcs = ["//hs-tokstyle/tools:check-cimple"],
302 args = ["$(location %s)" % f for f in CIMPLE_SRCS],
303 data = CIMPLE_SRCS,
304 tags = ["manual"],
305)