25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
3.2 KiB

10 년 전
10 년 전
10 년 전
10 년 전
10 년 전
10 년 전
10 년 전
10 년 전
10 년 전
10 년 전
  1. -module(rebar_compile_SUITE).
  2. -export([suite/0,
  3. init_per_suite/1,
  4. end_per_suite/1,
  5. init_per_testcase/2,
  6. all/0,
  7. build_basic_app/1,
  8. build_release_apps/1,
  9. build_checkout_apps/1,
  10. build_checkout_deps/1]).
  11. -include_lib("common_test/include/ct.hrl").
  12. -include_lib("eunit/include/eunit.hrl").
  13. -include_lib("kernel/include/file.hrl").
  14. suite() ->
  15. [].
  16. init_per_suite(Config) ->
  17. Config.
  18. end_per_suite(_Config) ->
  19. ok.
  20. init_per_testcase(_, Config) ->
  21. rebar_test_utils:init_rebar_state(Config).
  22. all() ->
  23. [build_basic_app, build_release_apps,
  24. build_checkout_apps, build_checkout_deps].
  25. build_basic_app(Config) ->
  26. AppDir = ?config(apps, Config),
  27. Name = rebar_test_utils:create_random_name("app1_"),
  28. Vsn = rebar_test_utils:create_random_vsn(),
  29. rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]),
  30. rebar_test_utils:run_and_check(Config, [], ["compile"], {ok, [{app, Name}]}).
  31. build_release_apps(Config) ->
  32. AppDir = ?config(apps, Config),
  33. Name1 = rebar_test_utils:create_random_name("relapp1_"),
  34. Vsn1 = rebar_test_utils:create_random_vsn(),
  35. rebar_test_utils:create_app(filename:join([AppDir,Name1]), Name1, Vsn1, [kernel, stdlib]),
  36. Name2 = rebar_test_utils:create_random_name("relapp2_"),
  37. Vsn2 = rebar_test_utils:create_random_vsn(),
  38. rebar_test_utils:create_app(filename:join([AppDir,Name2]), Name2, Vsn2, [kernel, stdlib]),
  39. rebar_test_utils:run_and_check(
  40. Config, [], ["compile"],
  41. {ok, [{app, Name1}, {app, Name2}]}
  42. ).
  43. build_checkout_apps(Config) ->
  44. AppDir = ?config(apps, Config),
  45. CheckoutsDir = ?config(checkouts, Config),
  46. Name1 = rebar_test_utils:create_random_name("checkapp1_"),
  47. Vsn1 = rebar_test_utils:create_random_vsn(),
  48. rebar_test_utils:create_app(filename:join([AppDir,Name1]), Name1, Vsn1, [kernel, stdlib]),
  49. Name2 = rebar_test_utils:create_random_name("checkapp2_"),
  50. Vsn2 = rebar_test_utils:create_random_vsn(),
  51. rebar_test_utils:create_app(filename:join([CheckoutsDir,Name2]), Name2, Vsn2, [kernel, stdlib]),
  52. rebar_test_utils:run_and_check(
  53. Config, [], ["compile"],
  54. {ok, [{app, Name1}, {checkout, Name2}]}
  55. ).
  56. build_checkout_deps(Config) ->
  57. AppDir = ?config(apps, Config),
  58. CheckoutsDir = ?config(checkouts, Config),
  59. DepsDir = filename:join([AppDir, "_build", "lib"]),
  60. Name1 = rebar_test_utils:create_random_name("checkapp1_"),
  61. Vsn1 = rebar_test_utils:create_random_vsn(),
  62. rebar_test_utils:create_app(filename:join([AppDir,Name1]), Name1, Vsn1, [kernel, stdlib]),
  63. Name2 = rebar_test_utils:create_random_name("checkapp2_"),
  64. Vsn2 = rebar_test_utils:create_random_vsn(),
  65. rebar_test_utils:create_app(filename:join([CheckoutsDir,Name2]), Name2, Vsn2, [kernel, stdlib]),
  66. rebar_test_utils:create_app(filename:join([DepsDir,Name2]), Name2, Vsn1, [kernel, stdlib]),
  67. rebar_test_utils:run_and_check(
  68. Config, [], ["compile"],
  69. {ok, [{app, Name1}, {checkout, Name2}]}
  70. ),
  71. ok = application:load(list_to_atom(Name2)),
  72. Loaded = application:loaded_applications(),
  73. {_, _, Vsn2} = lists:keyfind(list_to_atom(Name2), 1, Loaded).