mirror of https://github.com/djcb/mu.git
tests: always log to file during tests
And set the cachedir (for logging and other things) to a random tmpdir.
This commit is contained in:
parent
8e9579055f
commit
c78435a6fe
|
@ -93,7 +93,10 @@ black_hole(void)
|
|||
void
|
||||
Mu::mu_test_init(int *argc, char ***argv)
|
||||
{
|
||||
const auto tmpdir{test_random_tmpdir()};
|
||||
|
||||
g_setenv("MU_TEST", "yes", TRUE);
|
||||
g_setenv("XDG_CACHE_HOME", tmpdir.c_str(), TRUE);
|
||||
|
||||
g_test_init(argc, argv, NULL);
|
||||
|
||||
|
|
3
mu/mu.cc
3
mu/mu.cc
|
@ -104,7 +104,6 @@ main(int argc, char* argv[])
|
|||
* there's a subcommand
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* set up logging
|
||||
*/
|
||||
|
@ -113,6 +112,8 @@ main(int argc, char* argv[])
|
|||
lopts |= Logger::Options::StdOutErr;
|
||||
if (opts->debug)
|
||||
lopts |= Logger::Options::Debug;
|
||||
if (g_getenv("MU_TEST"))
|
||||
lopts |= Logger::Options::File;
|
||||
|
||||
const auto logger = Logger::make(opts->runtime_path(RuntimePath::LogFile),
|
||||
lopts);
|
||||
|
|
Loading…
Reference in New Issue