summaryrefslogtreecommitdiff
path: root/inttest
diff options
context:
space:
mode:
authorAndrey Teplyashin <platinumthinker@gmail.com>2014-11-09 14:04:05 +0600
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2015-07-03 12:13:13 +0200
commita587a9f7eb10691b7da5fcb45f2741c82618142f (patch)
treeade1a8da1d85966aeb727c82977a7ac2b26871b9 /inttest
parent0ad3eafc7a3401ce381c0a0d750ba3ac8d2b4321 (diff)
downloadrebar-a587a9f7eb10691b7da5fcb45f2741c82618142f.tar.gz
Add colored logs
Fix verbose level in global rebar config Replace application:set_env on erlang:put
Diffstat (limited to 'inttest')
-rw-r--r--inttest/logging/logging_rt.erl31
-rw-r--r--inttest/t_custom_config/t_custom_config_rt.erl5
-rw-r--r--inttest/tplugins/tplugins_rt.erl2
3 files changed, 28 insertions, 10 deletions
diff --git a/inttest/logging/logging_rt.erl b/inttest/logging/logging_rt.erl
index d3e1c0f..11cb0cd 100644
--- a/inttest/logging/logging_rt.erl
+++ b/inttest/logging/logging_rt.erl
@@ -40,23 +40,40 @@ run(_Dir) ->
SharedExpected = "==> logging_rt \\(compile\\)",
%% provoke ERROR due to an invalid app file
retest:log(info, "Check 'compile' failure output~n"),
+ {ERROR, WARN, INFO, DEBUG} =
+ case application:get_env(rebar, log_colored) of
+ {ok, true} ->
+ {
+ "\\e\\[1m\\e\\[31mERROR: \\e\\[0m",
+ "\\e\\[33mWARN: \\e\\[0m",
+ "\\e\\[32mINFO: \\e\\[0m",
+ "\\e\\[34mDEBUG: \\e\\[0m"
+ };
+ _ ->
+ {
+ "ERROR: ",
+ "WARN: ",
+ "INFO: ",
+ "DEBUG: "
+ }
+ end,
ok = check_output("./rebar compile -q", should_fail,
- [SharedExpected, "ERROR: "],
- ["WARN: ", "INFO: ", "DEBUG: "]),
+ [SharedExpected, ERROR],
+ [WARN, INFO, DEBUG]),
%% fix bad app file
ok = file:write_file(?APP_FILE, app(logging, [])),
retest:log(info, "Check 'compile' success output~n"),
ok = check_output("./rebar compile", should_succeed,
[SharedExpected],
- ["ERROR: ", "WARN: ", "INFO: ", "DEBUG: "]),
+ [ERROR, WARN, INFO, DEBUG]),
retest:log(info, "Check 'compile -v' success output~n"),
ok = check_output("./rebar compile -v", should_succeed,
[SharedExpected],
- ["ERROR: ", "INFO: ", "DEBUG: "]),
+ [ERROR, INFO, DEBUG]),
retest:log(info, "Check 'compile -vv' success output~n"),
ok = check_output("./rebar compile -vv", should_succeed,
- [SharedExpected, "DEBUG: "],
- ["ERROR: ", "INFO: "]),
+ [SharedExpected, DEBUG],
+ [ERROR, INFO]),
ok.
check_output(Cmd, FailureMode, Expected, Unexpected) ->
@@ -73,7 +90,7 @@ check_output(Cmd, FailureMode, Expected, Unexpected) ->
end.
check_output1(Cmd, Captured, Expected, Unexpected) ->
- ReOpts = [{capture, all, list}],
+ ReOpts = [{capture, all, list}, unicode],
ExMatches =
lists:zf(
fun(Pattern) ->
diff --git a/inttest/t_custom_config/t_custom_config_rt.erl b/inttest/t_custom_config/t_custom_config_rt.erl
index a6aac9b..a373b32 100644
--- a/inttest/t_custom_config/t_custom_config_rt.erl
+++ b/inttest/t_custom_config/t_custom_config_rt.erl
@@ -15,13 +15,14 @@ run(Dir) ->
retest_log:log(debug, "Running in Dir: ~s~n", [Dir]),
Ref = retest:sh("./rebar -C custom.config check-deps -vv",
[{async, true}]),
+
{ok, Captured} =
retest:sh_expect(Ref,
- "DEBUG: Consult config file .*/custom.config.*",
+ ".*DEBUG: .*Consult config file .*/custom.config.*",
[{capture, all, list}]),
{ok, Missing} =
retest:sh_expect(Ref,
- "DEBUG: Missing deps : \\[\\{dep,bad_name,"
+ ".*DEBUG: .*Missing deps : \\[\\{dep,bad_name,"
"boo,\"\\.\",undefined,false\\}\\]",
[{capture, all, list}]),
retest_log:log(debug, "[CAPTURED]: ~s~n", [Captured]),
diff --git a/inttest/tplugins/tplugins_rt.erl b/inttest/tplugins/tplugins_rt.erl
index 997661b..01d296e 100644
--- a/inttest/tplugins/tplugins_rt.erl
+++ b/inttest/tplugins/tplugins_rt.erl
@@ -24,7 +24,7 @@ run(_Dir) ->
?assertMatch({ok, _}, retest_sh:run("./rebar fwibble -v", [])),
?assertEqual(false, filelib:is_regular("fwibble.test")),
Ref = retest:sh("./rebar -C bad.config -v clean", [{async, true}]),
- {ok, _} = retest:sh_expect(Ref, "ERROR: Plugin .*bad_plugin.erl "
+ {ok, _} = retest:sh_expect(Ref, ".*ERROR: .*Plugin .*bad_plugin.erl "
"contains compilation errors:.*",
[{newline, any}]),
ok.