You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2023/03/22 23:05:43 UTC

[couchdb] 01/01: Add log directory to eunit setup template

This is an automated email from the ASF dual-hosted git repository.

ronny pushed a commit to branch eunit-log-file
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 7f0fe530b4747a056bcaf763c604b9de55023ba5
Author: Ronny Berndt <ro...@apache.org>
AuthorDate: Thu Mar 23 00:02:08 2023 +0100

    Add log directory to eunit setup template
    
    To log messages of test runs to file we need to add
    a absoulute path to the file logger.
---
 rel/files/eunit.ini          | 4 ++--
 rel/plugins/eunit_plugin.erl | 4 +++-
 setup_eunit.template         | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/rel/files/eunit.ini b/rel/files/eunit.ini
index 361ea6669..8c203bab4 100644
--- a/rel/files/eunit.ini
+++ b/rel/files/eunit.ini
@@ -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
\ No newline at end of file
+startup_jitter = 0
diff --git a/rel/plugins/eunit_plugin.erl b/rel/plugins/eunit_plugin.erl
index 8f298db5f..356f4e0f7 100644
--- a/rel/plugins/eunit_plugin.erl
+++ b/rel/plugins/eunit_plugin.erl
@@ -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) ->
diff --git a/setup_eunit.template b/setup_eunit.template
index ceef60d12..11eee4458 100644
--- a/setup_eunit.template
+++ b/setup_eunit.template
@@ -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"}.