mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-04-21 21:52:03 +02:00
tests: fix account accumulation on Linux systems
On non-dockerized Linux systems, the accounts generated during tests are only cleaned up occassionally. The test suite design implements consistent account cleanup post test. Accumulation of these accounts interfere with subsequent test runs, rendering the test suite ineffective. The main test scripts incorrectly utilize a Jami Windows environment variable for Linux systems. In adherence with the Jami client design, this patch utilizes the correct environment variable for Linux systems. Windows formatted paths were also modified to allow recogntion in Linux enironments GitLab: #1801 Change-Id: I633dbd168af1e6d20ccee53d1109cd179bd1a187
This commit is contained in:
parent
1524ba0177
commit
b99c2674b4
2 changed files with 34 additions and 9 deletions
|
@ -44,6 +44,16 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define DATA_DIR "JAMI_DATA_HOME"
|
||||
#define CONFIG_DIR "JAMI_CONFIG_HOME"
|
||||
#define CACHE_DIR "JAMI_CACHE_HOME"
|
||||
#else
|
||||
#define DATA_DIR "XDG_DATA_HOME"
|
||||
#define CONFIG_DIR "XDG_CONFIG_HOME"
|
||||
#define CACHE_DIR "XDG_CACHE_HOME"
|
||||
#endif
|
||||
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
|
@ -178,9 +188,9 @@ main(int argc, char** argv)
|
|||
QDir(jamiConfigDir).removeRecursively();
|
||||
QDir(jamiCacheDir).removeRecursively();
|
||||
|
||||
bool envSet = qputenv("JAMI_DATA_HOME", jamiDataDir.toLocal8Bit());
|
||||
envSet &= qputenv("JAMI_CONFIG_HOME", jamiConfigDir.toLocal8Bit());
|
||||
envSet &= qputenv("JAMI_CACHE_HOME", jamiCacheDir.toLocal8Bit());
|
||||
bool envSet = qputenv(DATA_DIR, jamiDataDir.toLocal8Bit());
|
||||
envSet &= qputenv(CONFIG_DIR, jamiConfigDir.toLocal8Bit());
|
||||
envSet &= qputenv(CACHE_DIR, jamiCacheDir.toLocal8Bit());
|
||||
if (!envSet)
|
||||
return 1;
|
||||
|
||||
|
|
|
@ -22,6 +22,16 @@
|
|||
#include <QApplication>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define DATA_DIR "JAMI_DATA_HOME"
|
||||
#define CONFIG_DIR "JAMI_CONFIG_HOME"
|
||||
#define CACHE_DIR "JAMI_CACHE_HOME"
|
||||
#else
|
||||
#define DATA_DIR "XDG_DATA_HOME"
|
||||
#define CONFIG_DIR "XDG_CONFIG_HOME"
|
||||
#define CACHE_DIR "XDG_CACHE_HOME"
|
||||
#endif
|
||||
|
||||
TestEnvironment globalEnv;
|
||||
|
||||
int
|
||||
|
@ -29,13 +39,18 @@ main(int argc, char* argv[])
|
|||
{
|
||||
QDir tempDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation));
|
||||
|
||||
auto jamiDataDir = tempDir.absolutePath() + "\\jami_test\\jami";
|
||||
auto jamiConfigDir = tempDir.absolutePath() + "\\jami_test\\.config";
|
||||
auto jamiCacheDir = tempDir.absolutePath() + "\\jami_test\\.cache";
|
||||
auto jamiDataDir = tempDir.absolutePath() + "/jami_test/jami";
|
||||
auto jamiConfigDir = tempDir.absolutePath() + "/jami_test/.config";
|
||||
auto jamiCacheDir = tempDir.absolutePath() + "/jami_test/.cache";
|
||||
|
||||
bool envSet = qputenv("JAMI_DATA_HOME", jamiDataDir.toLocal8Bit());
|
||||
envSet &= qputenv("JAMI_CONFIG_HOME", jamiConfigDir.toLocal8Bit());
|
||||
envSet &= qputenv("JAMI_CACHE_HOME", jamiCacheDir.toLocal8Bit());
|
||||
// Clean up the temp directories.
|
||||
QDir(jamiDataDir).removeRecursively();
|
||||
QDir(jamiConfigDir).removeRecursively();
|
||||
QDir(jamiCacheDir).removeRecursively();
|
||||
|
||||
bool envSet = qputenv(DATA_DIR, jamiDataDir.toLocal8Bit());
|
||||
envSet &= qputenv(CONFIG_DIR, jamiConfigDir.toLocal8Bit());
|
||||
envSet &= qputenv(CACHE_DIR, jamiCacheDir.toLocal8Bit());
|
||||
if (!envSet)
|
||||
return 1;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue