1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-04-21 21:52:03 +02:00

test: change the location of local storage files when running tests

Change-Id: I6ee537ee1ee3928c93b9a579e2b55b6ef97af779
This commit is contained in:
Ming Rui Zhang 2021-05-07 10:38:19 -04:00
parent 70c520e867
commit a2858a883b
4 changed files with 31 additions and 3 deletions

View file

@ -127,8 +127,8 @@ Only 64-bit MSVC build can be compiled.
```sh
git clone https://review.jami.net/ring-project
cd ring-project/
git submodule update --init daemon lrc client-windows
git submodule update --recursive --remote daemon lrc client-windows
git submodule update --init daemon lrc client-qt
git submodule update --recursive --remote daemon lrc client-qt
```
- Using **Elevated Command Prompt**
```sh
@ -212,7 +212,7 @@ Only 64-bit MSVC build can be compiled.
- In Visual Studio, download WiX Toolset Visual Studio Extension.
- Build client-windows project first, then the JamiInstaller project, msi package should be stored in ring-project\client-windows\JamiInstaller\bin\Release
## Testing For Client-qt
## Testing for Client-qt on Windows
- We currently use [GoogleTest](https://github.com/google/googletest) and [Qt Quick Test](https://doc.qt.io/qt-5/qtquicktest-index.html#introduction) in our product. To build and run tests, you could use the following command.
@ -221,6 +221,16 @@ Only 64-bit MSVC build can be compiled.
python make-client.py runtests
```
- Note that, for tests, the path of local storage files for jami will be changed based on following environment variables.
```
%JAMI_DATA_HOME% = %TEMP% + '\\jami_test\\jami'
%JAMI_CONFIG_HOME% = %TEMP% + '\\jami_test\\.config'
%JAMI_CACHE_HOME% = %TEMP% + '\\jami_test\\.cache'
```
- These environment variables will be temporarily set when using make-client.py to run tests.
## Debugging
Compile the client with `BUILD=Debug` and compile LibRingClient with

View file

@ -21,6 +21,7 @@ vs_where_path = os.path.join(
host_is_64bit = (False, True)[platform.machine().endswith('64')]
this_dir = os.path.dirname(os.path.realpath(__file__))
build_dir = this_dir + '\\build'
temp_path = os.environ['TEMP']
# project path
jami_qt_project = build_dir + '\\jami-qt.vcxproj'
@ -31,6 +32,11 @@ qml_test_project = build_dir + '\\tests\\qml_tests.vcxproj'
qml_test_exe = this_dir + '\\x64\\test\\qml_tests.exe -input ' + this_dir + '\\tests\\qml'
unit_test_exe = this_dir + '\\x64\\test\\unittests.exe'
# test env path
test_data_dir = temp_path + '\\jami_test\\jami'
test_config_dir = temp_path + '\\jami_test\\.config'
test_cache_dir = temp_path + '\\jami_test\\.cache'
class QtVerison(Enum):
Major = 0
Minor = 1
@ -308,6 +314,12 @@ def run_tests(mute_dring, output_to_files):
# make sure that the tests are rendered offscreen
os.environ["QT_QPA_PLATFORM"] = 'offscreen'
os.environ["QT_QUICK_BACKEND"] = 'software'
# set test env variables
os.environ["JAMI_DATA_HOME"] = test_data_dir
os.environ["JAMI_CONFIG_HOME"] = test_config_dir
os.environ["JAMI_CACHE_HOME"] = test_cache_dir
for test_exe_command in test_exe_command_list:
if (execute_cmd(test_exe_command, True)):
test_result_code = 1

View file

@ -195,6 +195,8 @@ main(int argc, char** argv)
argc = std::distance(argv, end);
}
QStandardPaths::setTestModeEnabled(true);
QTEST_SET_MAIN_SOURCE_PATH
Setup setup(muteDring);
return quick_test_main_with_setup(argc, argv, "qml_test", nullptr, &setup);

View file

@ -20,6 +20,8 @@
#include "globaltestenvironment.h"
#include <QApplication>
#include <QStandardPaths>
#include <gtest/gtest.h>
bool muteDring;
@ -40,6 +42,8 @@ main(int argc, char* argv[])
argc = std::distance(argv, end);
}
QStandardPaths::setTestModeEnabled(true);
QApplication a(argc, argv);
a.processEvents();
::testing::InitGoogleTest(&argc, argv);