Commit Graph

453 Commits

Author SHA1 Message Date
Maxim Biro
1cbc9609a7
Make tox-bootstrapd free memory on SIGINT and SIGTERM
Useful for using memory analyzing tools.
2018-10-16 21:35:27 -04:00
iphydf
700accb3c7
Use bool for IPv6 flag in test programs and DHT_bootstrap. 2018-10-16 22:11:53 +00:00
iphydf
77e025fae4
Remove Alpine Linux bootstrap daemon dockerfile.
We can add it back when there is a test for it. For now, we don't know
whether it works and don't have tests to make sure it keeps working.
2018-10-08 23:00:35 +00:00
iphydf
15d64221f1
Add LAN_discovery to the list of apidsl-generated files.
So it gets regenerated when the .api.h file changes.
2018-10-08 22:38:26 +00:00
Maxim Biro
56432a44c6
Make sure logger levels stay in sync across files 2018-10-07 15:16:00 -04:00
yangfl
d3d5b701cb
Fix typos 2018-09-19 18:16:13 +00:00
iphydf
49bb43f662
Standardise header guards.
Using the full path including the repo name.
2018-09-14 19:09:10 +00:00
iphydf
93cc178cfe
Add tool to find directly recursive calls in toxcore.
We should avoid recursion, as it makes reasoning about stack growth
harder. This tool shows (currently) 4 (non-tail) recursive functions, at
least 2 of which are easy to fix.
2018-09-08 22:08:34 +00:00
Maxim Biro
2e4cae692e
Use our own logging facility to log toxcore's logs 2018-08-30 22:44:18 +00:00
cotox
deb82006e5
Feature bootstrap trace/debug log output
Don't know why codes with macro dosen't work.
As it's only a few expensive, just code it without macro for now.

\#if (MIN_LOGGER_LEVEL == LOG_TRACE) || (MIN_LOGGER_LEVEL == LOG_DEBUG)
    fprintf(stderr, "[%s] %s:%d(%s) %s\n", strlevel, file, line, func, message);
\#endif
2018-08-30 22:44:18 +00:00
iphydf
acc19a202f
Format crypto_core.c.
Changes:
* 100 columns maximum (not strict, can be a bit more sometimes).
* No space after cast.
2018-08-26 19:15:44 +00:00
iphydf
473cde24d8
Update copyright to 2018. 2018-08-26 18:57:29 +00:00
iphydf
a1035cf814
Add some tests for ping_array.
No timeout test here yet, because we don't yet have the ability to
manipulate time at will, so we would have to actually sleep.
2018-08-26 17:32:19 +00:00
iphydf
7aa57afeba
Avoid redefining macros from different files. 2018-08-19 23:15:01 +00:00
iphydf
248902ffd4
Fix const cast in save-generator. 2018-08-19 11:51:00 +00:00
endoffile78
30960dcc7e
Add save file generator, save compatibility test, and generate a save file 2018-08-19 10:38:51 +00:00
iphydf
d6d305feeb
Use per-instance Mono_Time for Messenger and onion. 2018-08-16 21:01:43 +00:00
iphydf
54066f338f
Reduce the number of times unix_time_update is called.
Reduced by, e.g.:
* `file_transfer_test`: 33% of the `clock_gettime` calls.
* `tox_many_test`: 53% of the `clock_gettime` calls.

Other tests will see similar improvements. Real world applications will
be closer to 40-50% improvement, since tox_many_test has 100 nodes, while
file_transfer_test has 2 nodes.
2018-08-16 21:01:38 +00:00
iphydf
d92c96e783
Fix a few warnings from clang.
Also remove the use of a VLA in a context where there can be unbounded
memory allocations.
2018-08-12 14:09:59 +00:00
iphydf
064ffe5875
Make a separate struct Tox containing the Messenger.
This allows Tox to contain additional data on top of Messenger, making
Messenger not necessarily the most top-level object. E.g. groups are
built on Messenger and currently awkwardly void-pointered into it to
pretend there is no cyclic dependency.
2018-08-04 09:29:15 +00:00
iphydf
f627a26a7b
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.
2018-07-22 02:34:30 +00:00
iphydf
7245ac11ef
Avoid implementations in .h files or #including .c files.
Also, avoid the need for putting `_XOPEN_SOURCE` in every test file.
2018-07-21 20:44:26 +00:00
Maxim Biro
c0b4cd156f
Simplify Travis-CI FreeBSD build 2018-07-15 18:37:10 -04:00
iphydf
abc17b0f89
Factor out time keeping code into its own module: mono_time.c.
It turns out, `unix_time` is also monotonic, and is used as such, so I've
renamed the new functions to `mono_time_*`.

2018-07-08:
```
00:01 <@irungentoo> the idea used to be that the unix_time() function
  could go backward in time but I think I might have started using it like
  if it could not after I changed it so that it would never go back in time
```
2018-07-09 21:04:50 +00:00
iphydf
c8697ccc20
Move load_state and its helper functions to their own module. 2018-07-09 20:36:39 +00:00
iphydf
8739f7fccb
Make tox.c unambiguously parseable.
Rules:
1. Constants are uppercase names: THE_CONSTANT.
2. SUE[1] types start with an uppercase letter and have at least one
   lowercase letter in it: The_Type, THE_Type.
3. Function types end in "_cb": tox_friend_connection_cb.
4. Variable and function names are all lowercase: the_function.

This makes it easier for humans reading the code to determine what an
identifier means. I'm not convinced by the enum type name change, but I
don't know a better rule. Currently, a lot of enum types are spelled like
constants, which is confusing.

[1] struct/union/enum
2018-07-05 23:09:28 +00:00
iphydf
1a54be06cd
Simplify Travis CI builds.
Have one script per build. This means more duplication between the
scripts, but it's much easier to understand and to run locally.
2018-07-01 08:35:44 +00:00
iphydf
9b7d828f83
Only run astyle if the astyle binary exists. 2018-06-25 20:35:16 +00:00
iphydf
d22332dd50
Remove the format test.
It's annoying to have a test touch every source file. It causes a
recompile of everything after every test run.
2018-06-25 19:48:11 +00:00
Maxim Biro
7684b5ae3e
Make bootstrap daemon use toxcore's version 2018-06-25 00:29:16 -04:00
cotox
2d0a21adb3
Fix bootstrap logger
TODO: need a meanful log output
2018-05-22 01:01:18 +08:00
iphydf
4f6ab0708c
Add empty logger to DHT bootstrap daemons.
These should register a proper logging callback so the messages don't go
devnull, but this at least ensures a logger is available.
2018-05-20 16:15:49 +00:00
iphydf
be797d4b03
Move system header includes from network.h to network.c 2018-05-20 15:42:42 +00:00
Anthony Bilinski
291a849a5a
fix DHT_bootstrap key loading
Introduced by 643eea60bb
2018-05-10 18:06:13 +02:00
Maxim Biro
e9629977ad
Fix FreeBSD build on Travis 2018-05-10 03:45:43 -04:00
iphydf
571b10149d
Fix coveralls reporting.
The new clang version makes gcov segfault. Also, coveralls needs another
package that it doesn't install the right version of by default.
2018-03-17 05:02:33 +00:00
iphydf
aa05095419
Remove the use of the 'hh' format specifier.
It's not supported in mingw.

See https://github.com/TokTok/c-toxcore/issues/786.
2018-03-16 01:57:26 +00:00
iphydf
d3b286cb43
Fix a bunch of compiler warnings and remove suppressions. 2018-02-24 22:20:22 +00:00
iphydf
b2a2a0bbc7
Link all tests to the android cpufeatures library if available.
This is needed for libvpx to work on android.

This also means that we can upload our test binaries to an android device
and actually run them, now that libcheck is no longer a blocker.
2018-02-23 01:05:00 +00:00
iphydf
d7471482d1
Add an option that allows us to specify that we require toxav. 2018-02-22 13:56:55 +00:00
iphydf
414b8f7425
Fix OSX tests: find(1) doesn't work like on Linux. 2018-02-21 15:45:31 +00:00
iphydf
95c03e0e85
Make the "persistent conference" callback changes new functions.
We can now revert the changes to the callbacks and keep supporting them
until clients have moved off them.
2018-02-20 21:36:05 +00:00
iphydf
c4a734e304
Remove apidsl from the build.
apidsl is in feature freeze. We can rely on the web service, instead.
2018-02-19 21:00:19 +00:00
iphydf
9d58e0aa0a
Run all tests in parallel on Travis.
The first round some tests will fail and others will segfault. The second
round, still some will fail, but the third round it might pass. At some
point, tests will pass.

The reason for this is that tests assume a lot about which ports they are
given, and also toxcore's default port range has too few ports to run all
tests in parallel. These issues will be fixed in future PRs.
2018-02-18 21:44:58 +00:00
Maxim Biro
ef172adebe Use Wine Devel instead of Wine Staging
Wine Staging is not maintained
https://wine-staging.com/news/2018-02-17-future-wine-staging.html
2018-02-18 17:13:59 +00:00
iphydf
2e74db5447
Improve gtest finding, support local checkout.
Also fix library dependency order for monolith test.
2018-02-11 12:20:36 +00:00
iphydf
6cd4fcdec4
Remove libcheck from the dependencies.
We're not gaining much from this library, and it's a burden, especially
for windows development.
2018-02-09 20:51:39 +00:00
iphydf
f2857932d2
Use the markdown GPLv3 license in the c-toxcore repo. 2018-02-08 16:08:09 +00:00
iphydf
8a0e98bab8
Fix LAN discovery on FreeBSD.
Also, add an auto-test for bootstrap and for LAN discovery.

Bootstrap is never tested otherwise, and LAN discovery is a prerequisite
for everything else. Having these two tests lets us rule out or identify
LAN discovery as a possible cause for test failures.
2018-02-08 14:57:34 +00:00
iphydf
36ba80aacb
Remove csrc from the RTPHeader struct.
This is not used by anything in the code, so we shouldn't have it in the
header.
2018-02-08 13:20:40 +00:00