Skip to content
Snippets Groups Projects
Commit b99c2674 authored by Samuel Kayode's avatar Samuel Kayode Committed by Adrien Béraud
Browse files

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
parent 1524ba01
No related branches found
No related tags found
No related merge requests found
......@@ -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";
// Clean up the temp directories.
QDir(jamiDataDir).removeRecursively();
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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment