summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-07-17 01:18:04 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-07-22 02:34:30 +0000
commitf627a26a7b1c3619ba66f84b87092ff8ba7a95b6 (patch)
treec72c950fab473dc9bec4b5329d251b790e55443d /testing
parent7245ac11ef9be2420c8356c12acc79f93ea211bb (diff)
Run Clang global static analysis on Travis.
This uses a single .cc file containing almost all the code in the repository to perform whole program analysis.
Diffstat (limited to 'testing')
-rw-r--r--testing/BUILD.bazel12
-rw-r--r--testing/DHT_test.c2
-rw-r--r--testing/random_testing.cc5
3 files changed, 8 insertions, 11 deletions
diff --git a/testing/BUILD.bazel b/testing/BUILD.bazel
index 4d0674b4..c0d76f7f 100644
--- a/testing/BUILD.bazel
+++ b/testing/BUILD.bazel
@@ -35,7 +35,7 @@ cc_binary(
35 copts = ["-O1"], 35 copts = ["-O1"],
36 deps = [ 36 deps = [
37 "//c-toxcore/toxav", 37 "//c-toxcore/toxav",
38 "//c-toxcore/toxav:monolith", 38 "//c-toxcore/toxav:ring_buffer_srcs",
39 "//c-toxcore/toxcore", 39 "//c-toxcore/toxcore",
40 "@opencv//:core", 40 "@opencv//:core",
41 "@opencv//:highgui", 41 "@opencv//:highgui",
@@ -52,13 +52,3 @@ cc_binary(
52 "//c-toxcore/toxcore", 52 "//c-toxcore/toxcore",
53 ], 53 ],
54) 54)
55
56cc_library(
57 name = "monolith",
58 hdrs = [
59 "misc_tools.c",
60 "misc_tools.h",
61 ],
62 visibility = ["//c-toxcore/other:__pkg__"],
63 deps = ["//c-toxcore/toxcore"],
64)
diff --git a/testing/DHT_test.c b/testing/DHT_test.c
index c242953a..78853746 100644
--- a/testing/DHT_test.c
+++ b/testing/DHT_test.c
@@ -28,7 +28,9 @@
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with Tox. If not, see <http://www.gnu.org/licenses/>. 29 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
30 */ 30 */
31#ifndef _XOPEN_SOURCE
31#define _XOPEN_SOURCE 600 32#define _XOPEN_SOURCE 600
33#endif
32 34
33#include <stdlib.h> 35#include <stdlib.h>
34#include <stdio.h> 36#include <stdio.h>
diff --git a/testing/random_testing.cc b/testing/random_testing.cc
index bcdb8e70..4e64c1b4 100644
--- a/testing/random_testing.cc
+++ b/testing/random_testing.cc
@@ -102,6 +102,7 @@ struct Global_State : std::vector<Local_State> {
102 // Non-copyable; 102 // Non-copyable;
103 Global_State(Global_State const &) = delete; 103 Global_State(Global_State const &) = delete;
104 Global_State(Global_State &&) = default; 104 Global_State(Global_State &&) = default;
105 ~Global_State();
105 explicit Global_State(std::vector<Action> const &actions) 106 explicit Global_State(std::vector<Action> const &actions)
106 : actions_(actions), rnd_(actions), action_counter_(actions.size()) {} 107 : actions_(actions), rnd_(actions), action_counter_(actions.size()) {}
107 108
@@ -115,6 +116,8 @@ struct Global_State : std::vector<Local_State> {
115 std::vector<unsigned> action_counter_; 116 std::vector<unsigned> action_counter_;
116}; 117};
117 118
119Global_State::~Global_State() {}
120
118void handle_friend_connection_status(Tox *tox, uint32_t friend_number, 121void handle_friend_connection_status(Tox *tox, uint32_t friend_number,
119 TOX_CONNECTION connection_status, void *user_data) { 122 TOX_CONNECTION connection_status, void *user_data) {
120 Local_State *state = static_cast<Local_State *>(user_data); 123 Local_State *state = static_cast<Local_State *>(user_data);
@@ -394,4 +397,6 @@ int main() {
394 for (uint32_t i = 0; i < toxes.action_counter().size(); i++) { 397 for (uint32_t i = 0; i < toxes.action_counter().size(); i++) {
395 std::printf("%u x '%s'\n", toxes.action_counter().at(i), actions[i].title); 398 std::printf("%u x '%s'\n", toxes.action_counter().at(i), actions[i].title);
396 } 399 }
400
401 return 0;
397} 402}