Commit Graph

4695 Commits

Author SHA1 Message Date
zugz (tox)
d380c41131
fix leave callback calling in del_groupchat 2018-08-25 15:39:31 +00:00
iphydf
94b06818fb
Use do-while instead of while in tests.
This forces all the loop bodies to be executed at least once, which is
harmless since it just means one more tox event loop iteration. This
reduces the jitter we see in coverage measurements, which is partially
caused by loops sometimes being entered and sometimes not (because their
condition happens to randomly already be true).
2018-08-25 15:25:33 +00:00
iphydf
0935aab927
Run all tests (and compilation) in parallel with autotools.
With distcheck, it's all or nothing, so we build with -j50 and run tests
with -j50.
2018-08-25 14:16:30 +00:00
iphydf
853a2a10b1
Stop using massive macros in toxav_basic_test.
Turned a huge macro into a function. Macros are a pain to debug.
2018-08-25 13:46:47 +00:00
zugz (tox)
efcda6c319
Fix auto_tests Makefile
* specify correct source files
* add save_compatibility_test (commented out for now)
* reformat TESTS to one line per test, and set check_PROGRAMS := TESTS
* add run_auto_test.h to EXTRA_DIST
* Fix `AUTO_TEST_CFLAGS` -> `AUTOTEST_CFLAGS`.
2018-08-25 14:30:04 +02:00
iphydf
ff342a5ba6
Force storing the result of crypto_memcmp in the test.
So we don't accidentally elide the call given that it's a pure function
and its result isn't used.
2018-08-23 22:26:46 +00:00
iphydf
2730c95699
Install the DHT_bootstrap binary on make install.
We didn't install it before, only `tox-bootstrapd`.
2018-08-23 21:33:54 +00:00
endoffile78
76f4ae64b7
Add check to make sure tox was created successfully 2018-08-22 10:12:46 +00:00
zugz (tox)
21b178396a
consistently use 'mono_time' rather than 'monotime' 2018-08-21 23:11:39 +02:00
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