Commit Graph

4586 Commits

Author SHA1 Message Date
iphydf
46b48f06ed
Always print output on failure in cmake tests on Travis.
Not only the second time it fails.
2018-08-21 17:52:56 +00:00
iphydf
2b73b6298b
Run project tests like yamllint_test.
We check that:
* The license is GPLv3.
* .travis.yml conforms with the toktok style specification.
* There exists a README.md file.
2018-08-21 17:31:22 +00:00
iphydf
74e685b497
Enable color diagnostics on circleci.
See https://github.com/ninja-build/ninja/issues/814
2018-08-21 17:12:22 +00:00
zugz (tox)
8e0aea1add
handle libsodium dependency of misc_tools correctly for autotools 2018-08-20 22:36:15 +02:00
iphydf
7aa57afeba
Avoid redefining macros from different files. 2018-08-19 23:15:01 +00:00
iphydf
0e7cc197f4
Upload coverage to codecov as well as coveralls. 2018-08-19 22:37:05 +00:00
iphydf
0fa700b55b
Make the save_compatibility_test work with bazel. 2018-08-19 22:08:02 +00:00
zugz (tox)
14484c6879
make Mono_Time an argument to current_time_monotonic 2018-08-19 23:41:43 +02:00
iphydf
e32e0b3402
Run both asan and tsan on Circle CI. 2018-08-19 12:05:28 +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
fc7a5dc4d8
Enable .travis.yml check and use non-markdown license. 2018-08-18 22:29:31 +00:00
iphydf
9fb87056bc
Set _POSIX_C_SOURCE to 200112L. We need it for C99 compat.
It is invalid to compile an XPG3, XPG4, XPG4v2, or XPG5 application
using c99.  The same is true for POSIX.1-1990, POSIX.2-1992, POSIX.1b,
and POSIX.1c applications. Likewise, it is invalid to compile an XPG6
or a POSIX.1-2001 application with anything other than a c99 or later
compiler.  Therefore, Solaris libc forces an error in both cases.
2018-08-17 22:43:24 +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
Robin Lindén
31ea1aa06e
Release 0.2.6 2018-08-16 22:45:33 +02:00
iphydf
c0db255425
Limit the size of a save file in file_saving_test.
Limited to 4GiB. That ought to be enough for any save file.
2018-08-16 10:15:01 +00:00
Leonid Bobrov
006b4f4e5c
Prune long long warnings. 2018-08-16 09:57:37 +00:00
crypto-universe
3036cc1f23
Fix possible resource leaks in test 2018-08-15 22:50:24 +00:00
iphydf
475f01bc1a
Fix style in toxav.c.
* Use Camel_Snake_Case for type names.
* Use at least 4 characters for constant names. I.e. `END` is a type
  name, but `RETURN` is a constant name. This is because `DHT` is a type
  name (yay consistency).
* Using `min_*` functions instead of MIN, we can avoid a cast.
* Use `for`-loops for for-each-frame semantics instead of `while`.
* Don't use assignments as expressions.
* `++i` instead of `i++`.
* Function pointers are dereferenced automatically, so no need to
  manually do so.
* Avoid void pointers that lie about not being spaghetti code. Toxcore
  and toxav are both spaghetti and shouldn't pretend anything else.
* Don't use empty statements (e.g. no `;;` anywhere in the code).
2018-08-14 21:59:27 +00:00
iphydf
fc34fee59a
Use --config to tell bazel about the environment.
Instead of importing a well-known file. This gives toktok-stack more
freedom in where and how it wants to define its interface, as long as it
provides the configurations requested ("linux" and "clang").
2018-08-14 20:34:24 +00:00
iphydf
52dd5575ab
Avoid implicit conversion of negative value to uint32_t. 2018-08-13 22:22:09 +00:00
iphydf
2d84681529
Fix ToxAv's use of struct Tox.
* Fix `toxav_get_tox` to return tox, not messenger.
* Fix the casts from Tox* to Messenger* in toxav_old.c.
* Pass Tox instead of Messenger to public group AV callbacks.
2018-08-13 22:11:48 +00:00
iphydf
b77e407b6f
Avoid passing -1 as friend connection to new groups.
Somehow it still works because the lower levels can deal with
inconsistent/broken state, but this lets us avoid that broken state in
the first place. If a friend connection doesn't exist, we don't add it to
our group.
2018-08-13 21:56:09 +00:00
iphydf
c10d5ceeee
Fix style in video.c.
* Constant-style macros can't be function call expressions. These must be
  function calls themselves.
* Assignments can't be used as expressions.
  * Therefore: `while` loops should not be used as a `for-each`
    construct. Use `for`, instead.
2018-08-13 21:40:05 +00:00
iphydf
3e3a8810af
Use tokstyle in the cmake travis build.
This checks that (some of) the code follows some simplicity and naming
guidelines set by the tool.
2018-08-13 17:27:08 +00:00
iphydf
a509d25324
Fix some printf format specifiers. 2018-08-13 11:02:32 +00:00
iphydf
97a4b8e6a7
Fix memory leak in error path in group A/V.
This probably doesn't happen, but it can in theory, so we avoid it.
2018-08-13 10:45:21 +00:00
iphydf
d518374819
Fix groupav.c style and avoid casts in toxav_old.c.
* No anonymous structs.
* No assignment expressions.
* Only one declarator per struct member declaration.
* Named callback types only, no inline types.
* No `;` empty statements.
* `++i` instead of `i++`.

Avoiding a cast in toxav_old.c avoids some potential (and real) bugs.
2018-08-13 10:37:09 +00:00
iphydf
df9033dcb9
Fix coding style in rtp module.
* Named callback types only.
* No anonymous enums or structs.
* `++i` instead of `i++`.
* Don't use enums to specify integer constants. Enums should be
  enumerations. All values of an enum type should be listed[1].

[1] I don't know what to do about bit masks yet, but given that enums by
C standard can only go up to 32767 portably and 2^31 in reality, they are
probably not useful for 64 bit bit masks.
2018-08-12 23:32:59 +00:00
iphydf
f1eee02185
Temporarily disable FreeBSD build, since it times out. 2018-08-12 22:15:02 +00:00
iphydf
04d894e7cc
Fix style in msi.c.
* Don't use anonymous enums (`typedef enum { ... } Name;`).
* Don't use macros to generate structs (too magical, hard to grep).
* Assign output parameter once, and don't access it a lot in the
  function body.
* Don't pass type names as parameters to macros (this is C, we don't have
  templates, sorry).
* All function-like macros must be do-while(0).
* `++i` instead of `i++`.
* No assignment-expressions.
* No void-casts.
2018-08-12 21:27:53 +00:00
iphydf
6d8d80b387
Make conferences_object properly typed.
The void pointer here only adds opportunity to introduce bugs and doesn't
actually make things more layered. It's just the code lying about being
layered while it's actually spaghetti.
2018-08-12 21:10:27 +00:00
zugz (tox)
d56ab5aaff
add callback for successful connection to a conference 2018-08-12 22:46:06 +02:00
iphydf
4ed6e59992
Fix enumerator names to comply with toxcore naming standards. 2018-08-12 20:07:18 +00:00
iphydf
767ccbb387
Avoid forward declaration of rtp structs.
Forward declarations are problematic, as they easily allow introducing
cyclic dependencies.
2018-08-12 19:54:27 +00:00
iphydf
b2590e2f44
Fix style in bwcontroller module.
* Comments in macros must be `//` style.
* No inner structs.
* Named callback types.
* `++i` instead of `i++`.
* No assignments as expressions.
2018-08-12 18:26:31 +00:00
iphydf
b3036c55a6
Stop running tests in the bazel build.
These always fail at present. We'll need to look into making them not
always fail so we can enable them and get some useful signal from them.
2018-08-12 17:04:07 +00:00
iphydf
a743464623
Move OSX to stage 1 of Travis.
This avoids its dependency on FreeBSD.
2018-08-12 15:37:37 +00:00
zugz (tox)
fb89c03dd2
Add simple deterministic random number generator for tests 2018-08-12 15:22:34 +00:00
iphydf
3fe0551417
Assert that we don't divide by 0 in random_testing.cc.
This is always true due to the condition function, but if we introduce a
bug that makes the condition not be applied, this causes undefined
behaviour.
2018-08-12 14:52:52 +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
f0f456398d
Check that the save file size isn't larger than our address space. 2018-08-12 12:05:01 +00:00
iphydf
1de8b020cb
Remove all uses of the PAIR macro in toxav. 2018-08-12 11:38:23 +00:00
iphydf
5d15b5930d
Remove last use of the MIN macro.
We use functions for this instead.
2018-08-12 11:38:23 +00:00
iphydf
503d9f7e22
Add deprecation notice to some UPPER_CASE enums.
The enumerators won't change, but the type name will change in 0.3.0.
Reasoning:
- Type names in toxcore start with an uppercase letter and either have at
  least one lowercase letter in them, or are less than 4 characters long.
- Constants consist of 4 or more uppercase letters or underscores.

By these rules, "DHT" is a type name, but "TOX_USER_STATUS" is a
constant. We provide Tox_User_Status as an alternative for now, and will
switch to that in 0.3.0, removing the UPPER_CASE versions.
2018-08-11 16:28:24 +00:00
iphydf
678720d2fe
Split out conference type (text/av) from identifier. 2018-08-11 13:12:49 +00:00
iphydf
463cbcb19a
Use the crypto random functions instead of rand().
Presumably the uses of `rand()` were fine because they were not used in
security-sensitive places, but having to think about whether a crappy RNG
is acceptable in each situation requires effort that could better be
spent elsewhere.

Also, this means that once we have a custom deterministic RNG for
testing, that RNG is used everywhere, so all the code is deterministic.

It also allowed us to delete a system-specific function that wasn't used
anywhere except in a call to `srand()`.
2018-08-10 14:53:27 +00:00
zugz (tox)
afab28f0ff
Fix typo in loop over assocs. 2018-08-09 22:47:21 +00:00
Robin Lindén
ffd71e895b
Release 0.2.5 2018-08-08 19:38:31 +02:00