mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
[Tests] Give loader matcher tests a writable HOME in CI
Under GitHub's docker runner the process uid has no passwd entry, so HOME resolves to '/' and the test-mode qttest data dir cannot be created. SettingsCache's QSettings then drops every write, getPicsPath() comes back empty, and the loader searches a blank path. Point HOME at a QTemporaryDir for the duration of the run.
This commit is contained in:
parent
8053fe34a8
commit
c1895bd1d9
1 changed files with 10 additions and 0 deletions
|
|
@ -169,6 +169,16 @@ int main(int argc, char **argv)
|
|||
// Redirect SettingsCache reads/writes (app-data location) away from the real user profile.
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
|
||||
// Some CI containers run as a uid without a passwd entry (e.g. GitHub's docker
|
||||
// runner), so HOME resolves to "/" and the test-mode qttest data dir cannot be
|
||||
// created. SettingsCache's QSettings then silently drops every write, reads come
|
||||
// back empty, and the paths the loader searches are "". Give the test a writable
|
||||
// HOME for the duration of the run so settings behave like on a normal machine.
|
||||
QTemporaryDir home;
|
||||
if (home.isValid()) {
|
||||
qputenv("HOME", home.path().toLocal8Bit());
|
||||
}
|
||||
|
||||
QCoreApplication app(argc, argv);
|
||||
QLoggingCategory::setFilterRules("card_picture_loader.*=false\nsettings_cache.*=false");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue