mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
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.
This commit is contained in:
parent
3a85d88fb1
commit
2296d07e09
|
@ -498,6 +498,7 @@ endif()
|
||||||
auto_test(TCP)
|
auto_test(TCP)
|
||||||
auto_test(bootstrap)
|
auto_test(bootstrap)
|
||||||
auto_test(conference)
|
auto_test(conference)
|
||||||
|
auto_test(conference_two)
|
||||||
auto_test(crypto MSVC_DONT_BUILD)
|
auto_test(crypto MSVC_DONT_BUILD)
|
||||||
auto_test(dht MSVC_DONT_BUILD)
|
auto_test(dht MSVC_DONT_BUILD)
|
||||||
auto_test(encryptsave)
|
auto_test(encryptsave)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define START_TEST(name) static void name(void)
|
#define START_TEST(name) static void name(void)
|
||||||
#define END_TEST
|
#define END_TEST
|
||||||
|
|
30
auto_tests/conference_two_test.c
Normal file
30
auto_tests/conference_two_test.c
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
// This test checks that we can create two conferences and quit properly.
|
||||||
|
//
|
||||||
|
// This test triggers a different code path than if we only allocate a single
|
||||||
|
// conference. This is the simplest test possible that triggers it.
|
||||||
|
#ifndef _XOPEN_SOURCE
|
||||||
|
#define _XOPEN_SOURCE 600
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "../toxcore/tox.h"
|
||||||
|
|
||||||
|
#include "check_compat.h"
|
||||||
|
#include "helpers.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Create toxes.
|
||||||
|
uint32_t id = 1;
|
||||||
|
Tox *tox1 = tox_new_log(nullptr, nullptr, &id);
|
||||||
|
|
||||||
|
// Create two conferences and then exit.
|
||||||
|
TOX_ERR_CONFERENCE_NEW err;
|
||||||
|
tox_conference_new(tox1, &err);
|
||||||
|
ck_assert_msg(err == TOX_ERR_CONFERENCE_NEW_OK, "failed to create conference 1: %d", err);
|
||||||
|
tox_conference_new(tox1, &err);
|
||||||
|
ck_assert_msg(err == TOX_ERR_CONFERENCE_NEW_OK, "failed to create conference 2: %d", err);
|
||||||
|
|
||||||
|
tox_kill(tox1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user