[erlang-questions] common_test usability enhancement

Loïc Hoguin essen@REDACTED
Thu Jan 24 03:21:26 CET 2013


Hello,

I've been wondering how to have a common url for repeated ct tests. For 
example if I'm fixing a few things I'd like to just refresh the browser 
to see how far I got. Problem is timestamps prevent that.

Instead of this URL:

file://localhost/home/essen/extend/cowboy/logs/ct_run.ct@localhost.2013-01-24_03.10.49/extend.cowboy.eunit_SUITE.logs/run.2013-01-24_03.10.50/eunit_suite.eunit.html

I want something like this:

file://localhost/home/essen/extend/cowboy/logs/last.ct@localhost/extend.cowboy.eunit_SUITE.logs/run/eunit_suite.eunit.html

I started fixing the first part with a naive enough patch as follow:

diff --git a/lib/common_test/src/ct_logs.erl 
b/lib/common_test/src/ct_logs.erl
index 0b7a8bb..95e85c5 100644
--- a/lib/common_test/src/ct_logs.erl
+++ b/lib/common_test/src/ct_logs.erl
@@ -536,6 +536,11 @@ logger(Parent, Mode, Verbosity) ->
      AbsDir = ?abs(Dir),
      put(ct_run_dir, AbsDir),

+    %% create a symlink always pointing to the last run
+    New = "last-" ++ atom_to_list(node()),
+    _ = file:delete(New),
+    _ = file:make_symlink(Dir, New),
+
      case basic_html() of
     true ->
         put(basic_html, true);

I think it could be accepted into OTP easily, but this only fixes half 
the problem. The other part is harder.

I'd very much like to receive guidance on how to achieve my goal and 
have it be good enough to be included in OTP. Perhaps it'd require an 
option to disable the timestamp in the second part of the URL? I don't 
know. Any pointers would help.

Thanks.

-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu



More information about the erlang-questions mailing list