Packages
mix_erlang_tasks
0.1.0
This project provides a few Mix tasks that make it more convenient to use Mix as a build tool and package manager when developing applications in Erlang.
Current section
Files
Jump to
Current section
Files
lib/mix/tasks/ct.ex
defmodule Mix.Tasks.Ct do
use Mix.Task
@shortdoc "Run the project's Common Test suite"
@moduledoc """
# Command line options
* `--log-dir` - change the output directory; default: ctest/logs
* other options supported by `compile*` tasks
"""
def run(args) do
{opts, args, rem_opts} = OptionParser.parse(args, strict: [log_dir: :string])
new_args = args ++ MixErlangTasks.Util.filter_opts(rem_opts)
Mix.env :test
Mix.Task.run "compile", new_args
# This is run independently, so that the test modules don't end up in the
# .app file
ebin_dir = Path.join([Mix.Project.app_path, "test_beams"])
MixErlangTasks.Util.compile_files(Path.wildcard("ctest/**/*_SUITE.erl"), ebin_dir)
logdir = Keyword.get(opts, :log_dir, "ctest/logs")
File.mkdir_p!(logdir)
:ct.run_test [
{:dir, String.to_char_list(ebin_dir)},
{:logdir, String.to_char_list(logdir)},
{:auto_compile, false}
]
end
end