Commit Graph

637 Commits

Author SHA1 Message Date
iphydf
0f7138c010
Upgrade bazel to 2.1.1.
Removed av_test, because it depends on an ancient opencv that starts to
really not exist on modern systems anymore.
2020-03-02 14:23:44 +00:00
sudden6
1b7d7b66c5
synchronize call control actions to tox_iterate 2020-01-02 11:58:42 +01:00
Robin Linden
79748dd9e5
Allow Bazel to rerun tests marked as flaky 2019-11-17 01:24:02 +01:00
Robin Linden
f6235b5f8d
Update tests to use a working bootstrap node 2019-11-02 15:35:21 +01:00
zugz (tox)
306dd1f21f
add configurable limit on number of stored frozen peers 2019-05-19 18:51:28 +02:00
sudden6
b3100c977c
add undef guard in tox_many_tcp_test
This fixes an redefinition error when creating amalgamation.cc during
static analysis
2019-05-01 14:24:46 +02:00
zugz (tox)
efff822aef
Disable failing TCP server test
The test's intermittent failure may well be exposing a real bug in the
TCP relay and/or onion systems, but we can't find the bug, and keeping
the test is disrupting our CI.
2019-04-01 19:43:32 +02:00
zugz (tox)
959f468eac
add API function to test whether av is enabled 2019-02-10 00:00:00 +00:00
zugz (tox)
49e2406ffa
Expose api functions for enabling and disabling AV in AV groups
A group loaded from a savefile starts with AV disabled.
2019-02-10 00:00:00 +00:00
zoff99
78bc9e7403
Added test and patch for VLA stack overflow vuln.
Also added and used the new crypto_malloc and crypto_free.

The latter also zeroes out the memory safely. The former only exists for
symmetry (static analysis can detect asymmetric usages).
2019-01-03 11:13:27 +00:00
zugz (tox)
9770880e97
Implement conferences saving
* add global friend_connection status callback, used for group rejoining
* stop leaving groups on killing tox
2018-11-29 21:52:23 +01:00
zugz (tox)
caca350f43
Avoid format truncation in save compatibility test
(without this, gcc-8.2.0 issues a warning)
2018-11-23 18:09:45 +01:00
zugz (tox)
744dc2f5da
Make saving and loading the responsibility of Tox rather than Messenger 2018-10-20 11:03:10 +02:00
zugz (tox)
4dd86f1f29
ensure save data unchanged after save and load 2018-10-11 00:21:39 +02:00
iphydf
605dfe882c
Consistently use camel case enum names.
Including in tests and implementation files.
2018-10-09 17:33:37 +00:00
iphydf
b2b96b1aa1
Avoid use of IPv6 in tests if not supported (e.g. on Travis). 2018-10-06 21:27:02 +00:00
iphydf
4f266f913d
Use a working DHT node for bootstrap tests.
A lot of bootstrap nodes are down :(.
2018-09-25 21:19:07 +00:00
zugz (tox)
e43b2eadc0
Send rejoin packets on conference disconnection
We were mistakenly not making a rejoin attempt on freezing connections
due to all closest connections going down. This fixes that, and tweaks
the test. I've still only done tens rather than hundreds of tests, but
I'm fairly confident that the conference test now consistently passes.
2018-09-20 22:30:28 +02: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
hugbubby
0688877fba
Use run_auto_test fixture in typing_test.c 2018-09-14 13:51:41 +00:00
iphydf
d9541d542c
Use (void) for empty parameter lists in C.
Because `()` means "some unknown number of parameters".
2018-09-08 10:59:30 +00:00
zugz
1b2322284f
Add mechanism for recovering from disconnections in conferences
* add freezing and unfreezing of peers
  * add rejoin packet
  * revise handling of temporary invited connections
  * rename "peer kill" packet to "peer leave" packet
  * test rejoining in conference test
  * use custom clock in conference test
2018-09-05 20:56:26 +02:00
iphydf
6872c14e1a
Avoid use of global mutable state in mono_time on win32.
This uses a trick to get read-write access to `this` from a `const`
member function, similar to C++ `mutable`, but uglier.
2018-09-03 20:03:47 +00:00
zugz (tox)
9764285ab1
Use test clock in run_auto_test tests and dht test 2018-08-31 17:08:35 +02:00
zugz (tox)
66ab386d6f
try ipv6 connections even after udp timeout
Also adds a test (auto_reconnect_test) which fails without this change.
2018-08-27 22:27:01 +02:00
iphydf
473cde24d8
Update copyright to 2018. 2018-08-26 18:57:29 +00:00
iphydf
64ddb7fff2
Call abort instead of exit on test failure.
This raises a signal, so we can more easily catch it with gdb.
2018-08-26 13:18:43 +00:00
iphydf
80f8458146
Run save_compatibility_test in the autotools build. 2018-08-25 23:25:15 +00:00
iphydf
17e8195a8f
Fix the PORT_ALLOC failure of save_compatibility_test.
`tox_new_log` has a much larger range of ports it can select from.
2018-08-25 22:28:38 +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
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
endoffile78
76f4ae64b7
Add check to make sure tox was created successfully 2018-08-22 10:12:46 +00:00
iphydf
7aa57afeba
Avoid redefining macros from different files. 2018-08-19 23:15:01 +00:00
iphydf
0fa700b55b
Make the save_compatibility_test work with bazel. 2018-08-19 22:08:02 +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
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
iphydf
a509d25324
Fix some printf format specifiers. 2018-08-13 11:02:32 +00:00
zugz (tox)
d56ab5aaff
add callback for successful connection to a conference 2018-08-12 22:46:06 +02: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
zugz
aa63c1330c
Fix problems with initial connections and name-setting in conferences
* test names in conference_test
* raise error on attempt to invite friend to group before we are connected
* revise handling of temporary invited connections
    We are now careful not to prematurely delete a connection to a peer
    established during the invitation process; namely, before we have sufficient
    other connections and have confirmed that we have an alternative route to the
    peer.
* process out-of-order messages from a peer
* don't reset names when handling a Peer Response
2018-08-02 22:03:18 +01:00
hugbubby
3a4987da18
Fix autotools build
Mosts of the tests in auto_tests weren't running when the project
was built using autotools. This fixes that.
2018-07-30 12:48:21 +00:00
hugbubby
051eb1d5a7
auto_test fixture and filenames
Renamed a poorly named test, fixed up a few printf statements,
substituted some unsigned integers with fixed size counterparts,
and implemmented the auto_run_test.h fixture for the lossy and
lossless packet tests.
2018-07-28 16:14:06 +00:00
hugbubby
c4d58403f9
More fixed_width ints and incorporating file_saving_test.c
The file_saving_test.c was not included in the cmake list
and thus was ignored by travis and "make check". I found this
out while introducing ck_assert_msg into the integration test.

Furthermore, removed some variable width integers from encryptsave_test.c,
and the SRunner utilization. Implemmented ck_assert_msg, reorganized some
loops, and removed some longs in file_transfer_test.c.
2018-07-23 15:10:22 +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
iphydf
7c2b95ef5e
Remove redundant casts to the same type.
Also removed an unused identifier in messenger_test.c.
2018-07-21 15:09:39 +00:00
iphydf
adb12d5340
Add github usernames to TODOs. 2018-07-21 14:56:21 +00:00
iphydf
c1b7edbed3
Add missing braces in dht_test.c.
astyle doesn't catch all of these.
2018-07-21 13:01:34 +02:00
iphydf
affaaee210
Run buildifier on c-toxcore BUILD files. 2018-07-21 01:13:29 +00:00
hugbubby
a592f0fa87 Wrong use of unsigned integer. 2018-07-18 13:55:30 -07:00
hugbubby
864d1c15e4 Using stdint instead of int/long
Did my best to surmise the size requirements of
these integers, will do the rest of the tests soon. Also added a todo
and made an obsessive change to a for loop.
2018-07-18 13:55:30 -07:00
iphydf
beeb9b4335
Style fixes in TCP code; remove MIN and PAIR from util.h.
* Moved PAIR to toxav, where it's used (but really this should die).
* Replace most MIN calls with typed `min_*` calls. Didn't replace the
  ones where the desired semantics are unclear. Moved the MIN macro to
  the one place where it's still used.
* Avoid assignments in `while` loops. Instead, factored out the loop body
  into a separate `bool`-returning function.
* Use named types for callbacks (`_cb` types).
* Avoid assignments in `if` conditions.
* Removed `MAKE_REALLOC` and expanded its two calls. We can't have
  templates in C, and this fake templating is ugly and hard to analyse
  and debug (it expands on a single line).
* Moved epoll system include to the .c file, out of the .h file.
* Avoid assignments in expressions (`a = b = c;`).
* Avoid multiple declarators per struct member declaration.
* Fix naming inconsistencies.
* Replace `net_to_host` macro with function.
2018-07-12 20:21:42 +00:00
iphydf
cbda01021c
Fix style in DHT.c.
* Removed `ARRAY_SIZE` and use NULL markers for end of array, instead.
  The alternative is + size, but for these arrays, NULL markers made
  sense, since they are arrays of non-null pointers.
* Made `INDEX_OF_PK` a self-contained macro, not dependent upon the
  naming inside its call site. This is a minor change but makes the code
  more local and reviews easier.
* No nested structs.
* Use only named function types ending in `_cb` for callbacks.
* Replaced two macros with functions.
* `++i` instead of `i++`.
* struct member names start with lowercase letters.
* It takes a bit of work to support `/**/` comments in preprocessor
  macros, so I've decided not to support these. If a macro is complex
  enough to need comments inside it, it's too complex. `//` comments are
  allowed at the end of macro definitions.
* Callback typedefs must name their parameters.
2018-07-12 09:32:46 +00: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
2b49f80395
Rename BS_LIST to BS_List to follow the naming conventions.
`BS_LIST` would be a constant. `BS_List` is a type name.
2018-07-08 19:03:52 +00:00
iphydf
3c1025d2dc
Factor out the actual test code from conference_test.
Also, renamed simple_conference_test to conference_simple_test so it's
sorted together with the other conference tests.

Next step is to use run_auto_test.h for the conference test.
2018-07-07 10:35:35 +00:00
iphydf
9d5c55b4b3
Add a test that reproduces the NULL peer nick bug. 2018-07-06 11:14:44 +00:00
hugbubby
47a527509d
lan_discovery_test and version_test cleanup
Removed a pointless declaration of a function in lan_discovery_test
and cleaned up the one error message there. Did an entire restructuring
of the version_test using macros that resulted in fewer lines of code but more
thorough testing.

Formatting of version_test.c

back to old way, save comments and one change

Missing space
My greatest enemy

Add `#include <cstdio>` for `std::printf`.

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

Use run_auto_test.h test fixture for some auto-tests.

Most of the auto-tests should use this fixture, but I've only done a few
to set an example.
2018-07-06 10:25:47 +00:00
iphydf
597f23bdd9
Use run_auto_test.h test fixture for some auto-tests.
Most of the auto-tests should use this fixture, but I've only done a few
to set an example.
2018-07-05 23:41:27 +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
706fad1ce8
Add a test to try and overflow the send queue in net_crypto. 2018-06-29 23:24:20 +00:00
iphydf
b9a75d98b2
Remove broken conference tests.
These display some idea, but the tests are not implemented correctly. We
will need to implement the idea correctly later, but for now we can't use
these.
2018-06-29 18:25:44 +00:00
iphydf
86a6b17555
Fix leak of Logger instances in dht_test. 2018-06-28 21:25:21 +00:00
hugbubby
4e3bfac47d
Another TCP_test.c upgrade
Mostly documentation + comments. Some cases where code was removed
in exchange for more compact/less sprawly for loops. Introduced a
function that removed like 30 lines of repeated code.
2018-06-28 14:05:03 +00:00
iphydf
29b2dd6315
Use clang-format for C++ code.
`clang-format -style='{BasedOnStyle: Google, ColumnLimit: 100}'`
2018-06-24 20:17:53 +00:00
iphydf
5c2600d87b
Add new Circle CI configuration.
This one has ASAN enabled, unlike Travis.
2018-06-24 19:51:34 +00:00
iphydf
5a8790eab0
Add a test for double conference invite.
In Persistent Group Chats (PGC), this will cause a use-after-free. This
test ensures that we fix this bug before merging PGC.
2018-06-24 01:09:46 +00:00
iphydf
ca75c014a4
Disable UDP when proxy is enabled.
Currently, toxcore does not support UDP over proxies. In the future, we
can relax this by disabling UDP only if the proxy doesn't support it.
2018-06-23 17:36:37 +00:00
iphydf
64d115e52d
Avoid conditional-uninitialised warning for tcp test.
The C compiler warns because the value is initialised in a loop and used
outside of it. In this case, it's always initialised, but changing the
value of `NUM_PORTS` can change that.
2018-06-23 14:39:31 +00:00
iphydf
e4462af919
Add assertions to bootstrap tests for correct connection type. 2018-06-23 14:05:56 +00:00
iphydf
a48e0c4d18
Add tests for what happens when passing an invalid proxy host.
Related: https://github.com/qTox/qTox/issues/5174
2018-06-23 12:34:33 +00:00
hugbubby
36e20e7e94
Clarify/Improve test_some test
Better error messages, better sleep() call placements, etc.
Did not modify large chunk of function because I couldn't explain
it. Maybe I'll come back later once I've regained lost brain cells.
2018-06-22 19:52:30 +00:00
hugbubby
820e45dece
Better TCP testing (beginnings)
Tests all ports instead of just one, also adds some comments/changes
error messages to be more descriptive
2018-06-20 22:11:08 +00:00
iphydf
2296d07e09
Add test for creating multiple conferences in one tox.
This triggers a code path in Persistent Group Chats that causes a memory
leak. I'm adding this test now, so that we don't merge PGC without fixing
the memory leak first.
2018-06-19 21:00:26 +00:00
iphydf
3a85d88fb1
Remove resource_leak_test.
This test has never caught a bug. It's better to catch these with asan or
the likes.
2018-06-18 19:25:30 +00:00
iphydf
16f5cc8c24
Make dht_test more stable.
By making it run in a port range far away from other tests. This test
creates 100 DHTs and makes either itself or other tests run out of ports.
2018-06-17 23:41:42 +00:00
Robin Lindén
2f80e2206c
Only check full rtp offset if RTP_LARGE_FRAME is set 2018-06-16 22:50:07 +00:00
iphydf
8a4a5c2aa2
Log only the filename, not the full path in LOGGER.
Fixes #900.
2018-06-04 12:39:28 +00:00
iphydf
21675ce0d2
Finish @Diadlo's network Family abstraction.
The Family stuff in toxcore is a big mess. I'm sure I saw a bunch of bugs
on the way, but I'm not verifying that code now, so the bugs stay.
2018-05-20 19:35:28 +00:00
iphydf
be797d4b03
Move system header includes from network.h to network.c 2018-05-20 15:42:42 +00:00
Maxim Biro
7d399cedcf
Improve network error reporting on Windows
Windows doesn't report network errors though errno, it has its own facilities.
2018-04-17 19:07:50 -04:00
Evgeny Kurnevsky
6b97acb773
Restrict packet kinds that can be sent through onion path. 2018-04-15 09:51:41 +03:00
iphydf
37d4a0b2ca
Avoid the use of rand() in tests.
We control the random functions in crypto_core, so we can make them
deterministic more easily. This will help test reproducibility in the
future.
2018-04-03 17:43:22 +00:00
iphydf
9706d9a0f0
Disallow stderr logger by default. 2018-03-17 15:04:03 +00:00
iphydf
a2496af71a
Add logging to the onion_test.
Makes debugging easier.
2018-03-17 15:04:03 +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
bd62d11860
Make file transfers 50% faster.
By increasing a magic number.. Also, added more verbose logging to the
file transfer test.
2018-03-02 13:56:49 +00:00
iphydf
1282ef5741
Remove deprecated conference namelist change callback. 2018-02-27 04:30:37 +00:00
iphydf
1334d16517
Fix auto_tests to stop using the deprecated conference API. 2018-02-27 04:30:37 +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
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
097f41f264
Make some sizeof tests linux-only.
net_crypto has pthread types in its struct, so its size is system
dependent. In particular, the sizes are wrong on FreeBSD.
2018-02-19 13:35:41 +00:00
Robin Lindén
ec8b911d7c
Increase range of ports available to Toxes during tests 2018-02-18 23:59:22 +00:00
iphydf
3dc8cf6df8
Disable lan discovery in most tests. 2018-02-18 21:32:28 +00:00
iphydf
d016eb3f0e
Remove tox_test from autotools build. 2018-02-18 17:17:28 +00:00
Robin Lindén
c3515c49e0
Split up tox_test into multiple smaller tests 2018-02-18 14:50:18 +00:00
iphydf
83f7beacc5
Don't print trace level logging in tests. 2018-02-18 14:09:42 +00:00
iphydf
746c624a09
Add static asserts for all the struct sizes in toxcore.
This forces us to record size changes (for LP64) and helps estimate
memory consumption of internal data structures.
2018-02-17 17:08:37 +00:00
zoff99
82662d4e16
Make outgoing Filetransfers round-robin.
Instead of 1 FT blocking all others.
2018-02-17 16:32:25 +00:00
iphydf
35f13ef51d
Get rid of the only GNU extension we used. 2018-02-14 20:51:55 +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
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
835b9fbdc9
Improve stability of crypto_memcmp test.
Also reduce number of people in conference to 5, because on Circle CI the
test times out trying to connect more than 6 or 7 people. The persistent
conferences PR will improve this so we can set it much higher then.
2018-02-06 20:21:27 +00:00
iphydf
feaefbcbb3
Format .cpp files with format-source. 2018-02-06 13:44:03 +00:00
iphydf
d9413d5576
Improve conference test stability. 2018-02-01 14:58:00 +00:00
iphydf
92ffad1a72
Use nullptr as NULL pointer constant instead of NULL or 0.
This changes only code, no string literals or comments.
2018-01-30 23:35:50 +00:00
iphydf
6e0ac337c9
Avoid clashes with "build" directories on case-insensitive file systems. 2018-01-28 15:17:34 +00:00
xhe
651ef3adb6
Make audio/video bit rates "properties"
follow TokTok#731. This commit
completely removed all things in namespace bit_rate, and deprecated
functions are to be added back in another commit. set_xxx() is treadted
as a property of namespace audio&video, same as bit_rate change event.

toxav_basic_test is fixed, either.
2018-01-28 13:21:57 +00:00
iphydf
9c03439ad0
Fix out of bounds read in error case in messenger_test.
Also got rid of two VLAs. They are overused a bit in toxcore. In
irc_syncbot, the array was uninitialised and then filled by a recv system
call. This can cause uninitialised reads if recv doesn't fill the entire
array. It could not cause out of bounds read directly, because a
NUL-terminator was in place, but both cases are undefined behaviour.
2018-01-26 01:30:06 +00:00
xhe
0becafd272
Split bit_rate_set(), one for audio, one for video.
Fixes #572.

As discussed in the issue, there's a risk that toxcore may not hold the
maximum bitrates libvpx supports, if toxcore insists on using integer
type. I initially proposed to have another flag in set(), so that we can
use unsigned type instead. iphydf came up with a better solution, that is
splitting the original functions, one for audio, one for video. Now, we
could safely replace int32_t with uint32_t.

Also: clean video_bit_rate_invalid()

Though this is not a part of issue #572, as it's used in the
toxav_bit_rate_set(), i cleaned the code. As mannol said, there should be
a check. Uint32_t is large enough to hold the maximum bitrates libvpx
supports, but user may pass a value larger than uint while smaller than
uint32_t. Thanks to the reminding from nurupo, it's no longer a stub
function.

Bitrate error enums are shared for both audio and video
https://github.com/TokTok/c-toxcore/pull/578#issuecomment-360095609, just
as iphydf said.
2018-01-25 14:29:01 +00:00
iphydf
033965b8cc
Make the monolith test a C++ binary.
This way, developers compile toxcore, toxav, and toxencryptsave as C++ at
least once at home, reducing the likelyhood of running into travis
failures where we compile as C++ in the windows build.
2018-01-21 20:56:30 +00:00
iphydf
52778aed93
Make BUILD files more finely-grained.
This allows us to precisely see which libraries depend on which and lets
us split them up more, if necessary.
2018-01-21 19:44:09 +00:00
iphydf
822dd2fac2
Don't allocate or dereference Tox_Options in tests.
This struct will soon become opaque.
2018-01-21 00:14:43 +00:00
iphydf
b030b4d8c0
Fix log message in simple_conference_test: invite -> message. 2018-01-20 13:25:58 +00:00
iphydf
7c2e4dd403
Add a simple conference test with 3 friends.
This tests that a message from tox1 is relayed via tox2 to tox3 when tox1
and tox3 are not friends.
2018-01-20 12:22:52 +00:00
iphydf
25d3001556
Use larger arrays in crypto timing tests.
Increasing from 256K to 1M and increasing the number of iterations from
1000 to 2000. This makes the test more accurate and less flaky.
2018-01-19 18:15:17 +00:00
iphydf
0a5be3cbc5
Use C99 standard in bazel builds. 2018-01-18 21:52:31 +00:00
iphydf
18a33169b8
Add bazel build scripts for c-toxcore.
This allows us and users to reproducibly build verified versions of the
library with checksums. It will power the toktok-stack continuous build
with checked-in checksums at specific git revisions.
2018-01-18 16:11:52 +00:00
iphydf
643eea60bb
Make DHT a module-private type. 2018-01-16 20:06:07 +00:00
iphydf
22db2b9fe5
Make Net_Crypto a module-private type. 2018-01-16 15:46:13 +00:00
iphydf
1eea3f0ab6
Fix some memory or file descriptor leaks in test code.
Also some missing return value checks for `fopen`.
2018-01-14 19:15:28 +00:00
iphydf
bacd74c4dd
Make TCP_Client_Connection a module-private type. 2018-01-14 19:13:32 +00:00
iphydf
c28d362dd2
Make Onion_Client a module-private type. 2018-01-14 16:20:43 +00:00
iphydf
4b54d14d9c
Make Onion_Announce a module-private type. 2018-01-14 14:20:20 +00:00
iphydf
c38d3de604
Filter out annoying log statements in unit tests.
These may be useful when debugging toxcore locally, but are not useful in
unit tests.
2018-01-14 10:52:13 +00:00
yangfl
449c3f12cc Fix some typos in code and cmake comments 2018-01-12 21:22:44 +08:00
iphydf
2fbed5b4c5
Move Networking_Core struct into the .c file.
To make it an abstract type everywhere except in network.c.
2018-01-11 11:59:14 +00:00
iphydf
54ec162558
Fix formatting in some C files.
Also replace &(x) with &x for consistency.
2018-01-10 18:57:37 +00:00
iphydf
d26f0eb3bc
Change toxencryptsave API to never overwrite pass keys. 2017-12-29 23:24:54 +00:00
Diadlo
998f584b0d
Fix Travis fail on addr_resolve testing 2017-12-12 22:18:00 +01:00
Diadlo
05c35462f3
Fix bootstrap port
Test uses the first node as bootstrap, but the port is hardcoded.
2017-11-20 16:53:21 +03:00
Diadlo
8a8442a30c
Remove upper bound of save size 2017-11-20 16:53:21 +03:00
Diadlo
c506d73d5d
Fix assert for the first port value
Port of the first tox instance will be 33445 only if this port was not
in use during testing
2017-11-20 16:53:19 +03:00
yangfl
2651193b99
Fix typo 2017-11-19 23:52:23 +01:00
Diadlo
4d94a07d25
Add workaround for conference test 2017-11-15 21:36:22 +03:00
Diadlo
dd50da48f3
Don't use IPv6 in test if it's unsupported 2017-11-15 15:57:07 +03:00
Diadlo
d037f93811
Fix IPv4 and IPv6 loopbacks 2017-11-15 15:21:39 +03:00
Diadlo
f084f2c621
Add loopback and broadcast constants 2017-08-24 21:09:40 +03:00
Diadlo
e28d48130f
Add platform independent constants 2017-08-24 20:09:08 +03:00
Diadlo
66b8a7685e
AF_INET -> TOX_AF_INET 2017-08-24 20:09:08 +03:00
Maxim Biro
b02f68bb4b Remove unused variable 2017-06-06 15:37:02 -04:00
iphydf
cb69b8a986
Build tests on appveyor, the MSVC build.
Tests are not actually ran on appveyor for now, since they all fault for
some reason. For now, we just build them. Also, some tests are disabled
on msvc entirely, because they don't even compile. We'll need to look
into those, later. They are disabled using `MSVC_DONT_BUILD`.
2017-06-05 13:45:20 +00:00
pranomostro
7f5b057b05
Add test for changing the conference title and not receiving a callback. 2017-06-05 12:50:58 +00:00