summaryrefslogtreecommitdiff
path: root/auto_tests
AgeCommit message (Collapse)Author
2016-09-09Minor cleanups: header reordering, adding {}.iphydf
I hadn't done this for the "fun" code, yet. Also, we should include system headers after our own headers. "In general, a module should be implemented by one or more .cpp files. Each of these .cpp files should include the header that defines their interface first. This ensures that all of the dependences of the module header have been properly added to the module header itself, and are not implicit. System headers should be included after user headers for a translation unit." -- http://llvm.org/docs/CodingStandards.html#a-public-header-file-is-a-module
2016-09-06Improve static and const correctness.iphydf
- Any non-externally-visible declarations should be `static`. - Casting away the `const` qualifier from pointers-to-const is dangerous. All but one instance of this are now correct. The one instance where we can't keep `const` is one where toxav code actually writes to a chunk of memory marked as `const`. This code also assumes 4 byte alignment of data packets. I don't know whether that is a valid assumption, but it's likely unportable, and *not* obviously correct. - Replaced empty parameter lists with `(void)` to avoid passing parameters to it. Empty parameter lists are old style declarations for unknown number and type of arguments. - Commented out (as `#if DHT_HARDENING` block) the hardening code that was never executed. - Minor style fix: don't use `default` in enum-switches unless the number of enumerators in the default case is very large. In this case, it was 2, so we want to list them both explicitly to be warned about missing one if we add one in the future. - Removed the only two function declarations from nTox.h and put them into nTox.c. They are not used outside and nTox is not a library.
2016-09-06Improve C standard compliance.iphydf
- Don't cast between object and function pointers. - Use standard compliant `__VA_ARGS__` in macros. - Add explicit `__extension__` on unnamed union in struct (it's a GNU extension). - Remove ; after function definitions. - Replace `const T foo = 3;` for integral types `T` with `enum { foo = 3 };`. Folding integral constants like that as compile time constants is a GNU extension. Arrays allocated with `foo` as dimension are VLAs on strictly compliant C99 compilers. - Replace empty initialiser list `{}` with zero-initialiser-list `{0}`. The former is a GNU extension meaning the latter. - Cast `T*` (where `T != void`) to `void *` in format arguments. While any object pointer can be implicitly converted to and from `void *`, this conversion does not happen in variadic function calls. - Replace arithmetic on `void *` with arithmetic on `char *`. The former is non-compliant. - Replace non-`int`-derived types (like `uint16_t`, which is `short`-derived) in bit fields with `int`-derived types. Using any type other than `int` or `unsigned int` (or any of their aliases) in bit fields is a GNU extension.
2016-09-06Make friend requests statelessGregory Mullen (grayhatter)
Messenger is slightly twisty when it comes to sending connection status callbacks It will very likely need at the very least a partial refactor to clean it up a bit. Toxcore shouldn't need void *userdata as deep as is currently does. (amend 1) Because of the nature of toxcore connection callbacks, I decided to change this commit from statelessness for connections changes to statelessness for friend requests. It's simpler this was and doesn't include doing anything foolish in the time between commits. group fixup because grayhatter doesn't want to do it "arguably correct" is not how you write security sensitive code Clear a compiler warning about types within a function.
2016-09-02Add a short sleep before each tox_iterate in av test.iphydf
A race condition that happens on machines with heavily used network interfaces causes tests to fail. Packets sent don't arrive on time. This sleep gives it 100 extra milliseconds. The real fix would be to wait for the event to occur and then continue, but with a "once-loop" that is tox_iterate, it's not feasible at this time.
2016-09-02Re-enable group chat tests.iphydf
They don't seem to be a lot less stable than the rest. Either way we regularly need to restart builds to make timeouts go away.
2016-09-02Do not use `else` after `return`.iphydf
http://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code
2016-09-01Sort #includes in all source files.iphydf
2016-08-31Add braces to all if statements.iphydf
2016-08-31Remove unused and bit-rotten friends_test.iphydf
2016-08-27Move logging to a callback.iphydf
This removes the global logger (which by the way was deleted when the first tox was killed, so other toxes would then stop logging). Various bits of the code now carry a logger or pass it around. It's a bit less transparent now, but now there is no need to have a global logger, and clients can decide what to log and where.
2016-08-26Fix plane size calculation in testmannol
2016-08-26Avoid large stack allocations on thread stacks.iphydf
OS X and Windows have small thread stacks by default. Allocating audio and video frames (about 962KB total) on the stack overflows it.
2016-08-26Initialise the id in assoc_test.iphydf
Once every new moon, the assoc_test would fail because the key is 0. It can be anything but 0 to succeed, so I made it 1.
2016-08-25Reduce the timeout on travis to something much more reasonableGregory Mullen (grayhatter)
10x timeouts forces travis to kill our build without offering anything helpful
2016-08-20Make the friend message callback statelessGregory Mullen (grayhatter)
2016-08-19Make Typing change callback statelessGregory Mullen (grayhatter)
Moved a few #defines to the top of the header for better readability
2016-08-19Fix operation sequencing in TCP_test.iphydf
The expression was fun(foo = bar, foo). The evaluation order is unspecified, and often this will do the wrong thing. We should forbid side effects in argument lists and conditionals.
2016-08-18Make friend_status_message callback stateless.iphydf
See #40 for details.
2016-08-18Fix some compiler warnings.iphydf
2016-08-18Make tox_callback_friend_name stateless.iphydf
See #27 and #40 for details.
2016-08-17Make self_connection_status callback stateless.iphydf
**What are we doing?** We are moving towards stateless callbacks. This means that when registering a callback, you no longer pass a user data pointer. Instead, you pass a user data pointer to tox_iterate. This pointer is threaded through the code, passed to each callback. The callback can modify the data pointed at. An extra indirection will be needed if the pointer itself can change. **Why?** Currently, callbacks are registered with a user data pointer. This means the library has N pointers for N different callbacks. These pointers need to be managed by the client code. Managing the lifetime of the pointee can be difficult. In C++, it takes special effort to ensure that the lifetime of user data extends at least beyond the lifetime of the Tox instance. For other languages, the situation is much worse. Java and other garbage collected languages may move objects in memory, so the pointers are not stable. Tox4j goes through a lot of effort to make the Java/Scala user experience a pleasant one by keeping a global array of Tox+userdata on the C++ side, and communicating via protobufs. A Haskell FFI would have to do similarly complex tricks. Stateless callbacks ensure that a user data pointer only needs to live during a single function call. This means that the user code (or language runtime) can move the data around at will, as long as it sets the new location in the callback. **How?** We are doing this change one callback at a time. After each callback, we ensure that everything still works as expected. This means the toxcore change will require 15 Pull Requests.
2016-08-12Add and use CMake build scriptiphydf
Also, fix the hstox build that was taking half an hour. It now takes 5 minutes. Also, perform distcheck on travis to ensure that make dist works. It's not actually failing the build at the moment due to broken tests.
2016-08-12Check code formatting on Travis.iphydf
We run astyle on Travis and check if there is a diff. The build terminates if git finds a difference.
2016-08-11Fix a few issues with running Toxcore tests on Travis-CIGregory Mullen (grayhatter)
> increased the timeout for TCP tests because per @irungentoo the network on Travis-CI can be slow sometimes > allowed groupchats test to restart on error until timeout This had to be done because current groupchats are fundamentally broken and 3/5 times they'll 'net-split' on connect >> Drop group chat tests, add comment to the reason > added some debugging information to TCP tests, and a #define to force IPV6 (Travis-CI only uses IPv4 on their containers) and decreased the itr interval > Went crazy with timeouts for Tox network stuff on Travis. Tests on TCP will still randomly fail due to timeouts. I can't reproduce on any local system. So again per @irungentoo, Travis is slow, let's offer it a short bus.
2016-08-10Silence/fix some compiler warnings.iphydf
Some of these (like the incompatible pointers one) are really annoying for later refactoring.
2016-02-27Move argument comments to the end of lineRoman Yepishev
2016-02-27Remove unused main() argumentsRoman Yepishev
2016-02-27Remove magic numbers from addr_resolveRoman Yepishev
* Add #defines for INET/INET6 returns * Remove magic number 3 - exact AF_INET/INET6 result found. * Updated network_test.c
2016-01-30Realised there was no test to test these functions.irungentoo
2016-01-30Fixes.irungentoo
Fixed bug from merged PR. Don't build useless files when building with libsodium.
2016-01-27 fix: compare sensitive data with sodium_memcmpRoman Proskuryakov
fix: make increment_nonce & increment_nonce_number independent of user-controlled input fix: make crypto_core more stable agains null ptr dereference
2016-01-04Test fix.irungentoo
2015-12-15Onion test fixed to work with faster DHT.irungentoo
2015-12-11Better DHT tests.irungentoo
2015-12-01Slightly increased number of peers to announce to.irungentoo
Some test fixes.
2015-11-03Astyle.irungentoo
2015-10-23Changed gramatically incorrect comment in messenger_testSoumitra
2015-10-23Added ommited words in commentSoumitra
2015-10-11Test should not assert when hangup failsEniz Vukovic
2015-10-10New Adaptive BR algorithm, cleanups and fixesEniz Vukovic
2015-08-09Updated with upstreammannol
2015-08-07Removed a useless define.irungentoo
2015-07-29client_id -> public_keyirungentoo
2015-07-10Fixed CALL_STATE namingmannol
2015-07-06Test oob responding too.irungentoo
2015-07-05Added a TCP test for oob packets.irungentoo
2015-07-04Test fix.irungentoo
2015-07-03Fixed Tox reporting itself as being connected with TCP when using UDP only ↵irungentoo
on LAN.
2015-07-02Added a couple of checks to test.irungentoo