Skip to content

Commit

Permalink
Add log directory to eunit setup template (#4493)
Browse files Browse the repository at this point in the history
To log messages of test-runs to a single file, we need to add
a absoulute path to the file logger.
  • Loading branch information
big-r81 committed Mar 23, 2023
1 parent 09dca4e commit 27af79c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rel/files/eunit.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ port = 0
[log]
; log to a file to save our terminals from log spam
writer = file
file = couch.log
file = {{log_dir}}/couch.log
level = info

[replicator]
; disable jitter to reduce test run times
startup_jitter = 0
startup_jitter = 0
4 changes: 3 additions & 1 deletion rel/plugins/eunit_plugin.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ build_eunit_config(Config0, AppFile) ->
ViewIndexDir = Cwd ++ "/tmp/data",
StateDir = Cwd ++ "/tmp/data",
TmpDataDir = Cwd ++ "/tmp/tmp_data",
LogDir = Cwd ++ "/tmp",
cleanup_dirs([DataDir, TmpDataDir]),
Config1 = rebar_config:set_global(Config0, template, "setup_eunit"),
Config2 = rebar_config:set_global(Config1, prefix, Cwd),
Config3 = rebar_config:set_global(Config2, data_dir, DataDir),
Config4 = rebar_config:set_global(Config3, view_index_dir, ViewIndexDir),
Config = rebar_config:set_global(Config4, state_dir, StateDir),
Config5 = rebar_config:set_global(Config4, log_dir, LogDir),
Config = rebar_config:set_global(Config5, state_dir, StateDir),
rebar_templater:create(Config, AppFile).

cleanup_dirs(Dirs) ->
Expand Down
3 changes: 2 additions & 1 deletion setup_eunit.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
{data_dir, "/tmp"},
{prefix, "/tmp"},
{view_index_dir, "/tmp"},
{state_dir, "/tmp"}
{state_dir, "/tmp"},
{log_dir, "/tmp"}
]}.
{dir, "tmp"}.
{dir, "tmp/etc"}.
Expand Down

0 comments on commit 27af79c

Please sign in to comment.