1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include "SdkTest_test.h"
#include <gmock/gmock.h>
/**
* Test for FTP server using port 0, which also consist of:
* - start two FTP servers from a thread and no ports conflicting
* - stop FTP servers from a different thread, to allow TSAN to report any data races
*/
TEST_F(SdkTest, FtpServerCanUsePort0)
{
CASE_info << "started";
ASSERT_NO_FATAL_FAILURE(getAccountsForTest(2, false));
ASSERT_TRUE(megaApi[0]->ftpServerStart(true, 0));
ASSERT_TRUE(megaApi[1]->ftpServerStart(true, 0));
ASSERT_TRUE(megaApi[0]->ftpServerIsRunning());
ASSERT_TRUE(megaApi[1]->ftpServerIsRunning());
std::async(std::launch::async,
[&api = megaApi]()
{
api[0]->ftpServerStop();
api[1]->ftpServerStop();
})
.get();
CASE_info << "finished";
}
|