18 Commits

Author SHA1 Message Date
iphydf
ea597edff7 test: Improve simulation determinism and reliability.
Require explicit seeds for `Simulation` and `SimulatedEnvironment` to
ensure reproducible test results.

Also:
- Drop packets in `FakeUdpSocket` when the receive queue is full to
  prevent unbounded memory growth during stress tests.
- Improve synchronization in `Simulation::run_until` by adding a timeout
  to the barrier wait, preventing hangs if a runner is unregistered.
2026-02-09 09:34:26 +00:00
iphydf
dd31362509 cleanup: Apply nullability qualifiers to C++ codebase. 2026-01-15 12:19:00 +00:00
iphydf
a03ae8051e refactor: Delete tox_memory, align on mem and os_memory.
os_memory will be os_mem later.
2026-01-14 10:19:05 +00:00
iphydf
4c88fed2c9 refactor: Use std:: prefixes more consistently in C++ code. 2026-01-14 02:10:10 +00:00
iphydf
72452f2aeb test: Add some more tests for onion and shared key cache.
Also some other cleanups.
2026-01-13 23:43:56 +00:00
iphydf
8f92e710f3 perf: Add a timed limit of number of cookie requests.
Avoids being spammed by cookie requests and spending a lot of CPU on it.
2026-01-09 15:05:43 +00:00
iphydf
9c22e79cc8 test(support): add SimulatedEnvironment for deterministic testing
Introduces a new testing support library 'testing/support' that provides
a clean, modular, and fully deterministic environment for testing
toxcore components.
2026-01-07 13:06:18 +00:00
iphydf
0c05566e58 cleanup: Further #include cleanups. 2024-01-31 21:04:53 +00:00
iphydf
bdf460a3a9 refactor: Rename system_{memory,...} to os_{memory,...}.
This rename happens in the system PR, so I'm pulling it out to reduce
the size of that PR.
2024-01-25 21:33:52 +00:00
iphydf
bcb6592af5 test: Add C++ classes wrapping system interfaces.
These are more convenient and safer than the manual vtables we have in
the fuzzer support code. We can override individual member functions,
and C++ will take care of correctly casting and offsetting this-pointers
when needed.
2024-01-13 16:16:47 +00:00
iphydf
a549807df7 refactor: Add mem module to allow tests to override allocators.
This will allow us to do more interesting things with memory allocation
within toxcore, and allow fuzzers to explore various allocation failure
paths.
2023-08-30 22:55:05 +00:00
iphydf
941026266e refactor: Allow overriding mono_time in tox_new.
This makes it so if mono_time is overridden, no monotonic time-related
system call is invoked in tox_new.
2022-04-03 22:48:16 +00:00
iphydf
cc31ff07fa feat: Add support for custom random number generator.
This can be used by fuzzers to make RNG-driven code deterministic (i.e.
based on the fuzzer input).
2022-04-01 14:06:05 +00:00
iphydf
093927ba4f test: Add mallocfail and proxy test to our coverage runs. 2022-02-25 01:55:28 +00:00
iphydf
86a528a37a chore: Add a .clang-format that mostly agrees with astyle. 2022-02-21 16:16:16 +00:00
iphydf
6f36b67a13 chore: Add an undefined behaviour/integer sanitizer build. 2022-02-08 09:18:18 +00:00
iphydf
2570ddcb17 Fix errors on error paths found by oomer.
* Use-after-free because we free network before dht in one case.
* Various unchecked allocs in tests (not so important).
* We used to not check whether ping arrays were actually allocated in DHT.
* `ping_kill` and `ping_array_kill` used to crash when passing NULL.

Also:
* Added an assert in all public API functions to ensure tox isn't NULL.
  The error message you get from that is a bit nicer than "Segmentation
  fault" when clients (or our tests) do things wrong.
* Decreased the sleep time in iterate_all_wait from 20ms to 5ms.
  Everything seems to still work with 5ms, and this greatly decreases
  the amount of time spent per test run, making oomer run much faster.
2020-05-02 21:47:08 +01: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