Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

75 řádky
2.1 KiB

  1. -module(all_SUITE).
  2. -include_lib("common_test/include/ct.hrl").
  3. -include_lib("eunit/include/eunit.hrl").
  4. -compile([export_all, nowarn_export_all]).
  5. init_per_suite(Config) ->
  6. %% TODO: figure out how to use a local rebar3 copy?
  7. %% Ensure global rebar3 has the same version as current one!
  8. {ok, Vsn} = application:get_key(rebar, vsn),
  9. {ok, ExecVsn} = rebar3("version", [{path, "."} | Config]),
  10. case rebar_string:lexemes(ExecVsn, " ") of
  11. ["rebar", Vsn | _] ->
  12. %% Copy all base cases to priv_dir
  13. rebar_file_utils:cp_r([?config(data_dir, Config)],
  14. ?config(priv_dir, Config)),
  15. Config;
  16. _ ->
  17. {skip, "expected current version "++Vsn++" in path "
  18. "and found '"++ ExecVsn ++ "'"}
  19. end.
  20. end_per_suite(Config) ->
  21. Config.
  22. init_per_testcase(Name, Config) ->
  23. set_name_config(Name, Config).
  24. end_per_testcase(_Name, Config) ->
  25. Config.
  26. all() ->
  27. [noop, resource_plugins].
  28. %groups() ->
  29. % [{plugins, [shuffle], []},
  30. % {deps, [shuffle], []}].
  31. %%%%%%%%%%%%%%%%%%
  32. %%% TEST CASES %%%
  33. %%%%%%%%%%%%%%%%%%
  34. noop() ->
  35. [{doc, "just a sanity check on the handling of the test suite init/end"}].
  36. noop(_Config) ->
  37. true.
  38. resource_plugins() ->
  39. [{doc, "Issue #1673: "
  40. "Ensure that deps using resource plugins with semver compile."}].
  41. resource_plugins(Config) ->
  42. %% When the environment handling is wrong, the run fails violently.
  43. {ok, Output} = rebar3("compile", Config),
  44. ct:pal("Rebar3 Output:~n~s",[Output]),
  45. ok.
  46. %%%%%%%%%%%%%%%
  47. %%% Helpers %%%
  48. %%%%%%%%%%%%%%%
  49. set_name_config(Atom, Config) ->
  50. [{path,
  51. filename:join([?config(priv_dir, Config),
  52. atom_to_list(?MODULE)++"_data", atom_to_list(Atom)])}
  53. | Config].
  54. rebar3(Args, Config) ->
  55. Exec = case os:type() of
  56. {win32, _} ->
  57. "rebar3.cmd";
  58. _ ->
  59. "rebar3"
  60. end,
  61. Cmd = Exec ++ " " ++ Args,
  62. Opts = [{cd, ?config(path, Config)}, return_on_error, use_stdout],
  63. ct:pal("Calling rebar3 ~s with options ~p", [Cmd, Opts]),
  64. rebar_utils:sh(Cmd, Opts).