core_deps.mk 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546
  1. # Core: Packages and dependencies.
  2. CORE_DEPS_CASES = apps apps-build-count apps-conflict apps-deep-conflict apps-dir apps-dir-include-lib apps-new-app apps-new-lib apps-new-tpl apps-only autopatch-rebar build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-git-submodule fetch-hex fetch-hg fetch-legacy fetch-svn ignore list-deps mv mv-rebar no-autopatch no-autopatch-erlang-mk no-autopatch-rebar order-first order-top otp pkg rel search shell skip test
  3. CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
  4. .PHONY: core-deps $(CORE_DEPS_TARGETS)
  5. core-deps: $(CORE_DEPS_TARGETS)
  6. core-deps-apps: build clean
  7. $i "Bootstrap a new OTP library named $(APP)"
  8. $t mkdir $(APP)/
  9. $t cp ../erlang.mk $(APP)/
  10. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  11. # Bootstrap the application manually to make sure it works as intended.
  12. $i "Bootstrap a repository-local application my_app"
  13. $t mkdir -p $(APP)/apps/my_app/src/
  14. $t touch $(APP)/apps/file.erl
  15. $t echo "DEPS = cowlib" > $(APP)/apps/my_app/Makefile
  16. $t echo "include ../../erlang.mk" >> $(APP)/apps/my_app/Makefile
  17. $t echo "-module(boy)." > $(APP)/apps/my_app/src/boy.erl
  18. $t echo "-module(girl)." > $(APP)/apps/my_app/src/girl.erl
  19. $i "Build the application"
  20. $t $(MAKE) -C $(APP) $v
  21. $i "Check that all compiled files exist"
  22. $t test -f $(APP)/$(APP).d
  23. $t test -f $(APP)/ebin/$(APP).app
  24. $t test -f $(APP)/apps/my_app/my_app.d
  25. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  26. $t test -f $(APP)/apps/my_app/ebin/boy.beam
  27. $t test -f $(APP)/apps/my_app/ebin/girl.beam
  28. $t test -d $(APP)/deps/cowlib
  29. # Applications in apps are compiled automatically but not added
  30. # to the application resource file unless they are listed in LOCAL_DEPS.
  31. $i "Check that the application was compiled correctly"
  32. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  33. [ok = application:load(App) || App <- [$(APP), my_app]], \
  34. {ok, Deps} = application:get_key($(APP), applications), \
  35. false = lists:member(my_app, Deps), \
  36. {ok, MyAppDeps} = application:get_key(my_app, applications), \
  37. true = lists:member(cowlib, MyAppDeps), \
  38. {ok, []} = application:get_key($(APP), modules), \
  39. {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
  40. [{module, M} = code:load_file(M) || M <- Mods], \
  41. halt()"
  42. $i "Clean the application"
  43. $t $(MAKE) -C $(APP) clean $v
  44. $i "Check that Cowlib is still here"
  45. $t test -d $(APP)/deps/cowlib
  46. $i "Check that all relevant files were removed"
  47. $t test ! -e $(APP)/$(APP).d
  48. $t test ! -e $(APP)/ebin/$(APP).app
  49. $t test ! -e $(APP)/apps/my_app/my_app.d
  50. $t test ! -e $(APP)/apps/my_app/ebin/my_app.app
  51. $t test ! -e $(APP)/apps/my_app/ebin/boy.beam
  52. $t test ! -e $(APP)/apps/my_app/ebin/girl.beam
  53. $i "Distclean the application"
  54. $t $(MAKE) -C $(APP) distclean $v
  55. $i "Check that all relevant files were removed"
  56. $t test ! -e $(APP)/deps
  57. $i "Add my_app to the local dependencies"
  58. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = my_app\n"}' $(APP)/Makefile
  59. ifdef LEGACY
  60. $i "Add my_app to the applications key in the .app.src file"
  61. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_app,\n"}' $(APP)/src/$(APP).app.src
  62. endif
  63. $i "Build the application"
  64. $t $(MAKE) -C $(APP) $v
  65. $i "Check that all compiled files exist"
  66. $t test -f $(APP)/$(APP).d
  67. $t test -f $(APP)/ebin/$(APP).app
  68. $t test -f $(APP)/apps/my_app/my_app.d
  69. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  70. $t test -f $(APP)/apps/my_app/ebin/boy.beam
  71. $t test -f $(APP)/apps/my_app/ebin/girl.beam
  72. $t test -d $(APP)/deps/cowlib
  73. $i "Check that the application was compiled correctly"
  74. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  75. [ok = application:load(App) || App <- [$(APP), my_app]], \
  76. {ok, Deps} = application:get_key($(APP), applications), \
  77. true = lists:member(my_app, Deps), \
  78. {ok, MyAppDeps} = application:get_key(my_app, applications), \
  79. true = lists:member(cowlib, MyAppDeps), \
  80. {ok, []} = application:get_key($(APP), modules), \
  81. {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
  82. [{module, M} = code:load_file(M) || M <- Mods], \
  83. halt()"
  84. core-deps-apps-build-count: build clean
  85. $i "Bootstrap a new OTP library named $(APP)"
  86. $t mkdir $(APP)/
  87. $t cp ../erlang.mk $(APP)/
  88. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  89. $t mkdir -p "$(APP)/priv/dep"
  90. $t echo "PROJECT = fake_dep" > $(APP)/priv/dep/Makefile
  91. $t echo "include ../../erlang.mk" >> $(APP)/priv/dep/Makefile
  92. $i "Bootstrap a repository-local application my_app"
  93. $t echo "DEPS = dep1 dep2 dep3 dep4" > $(APP)/Makefile
  94. $t echo "dep_dep1 = cp ./priv/dep" >> $(APP)/Makefile
  95. $t echo "dep_dep2 = cp ./priv/dep" >> $(APP)/Makefile
  96. $t echo "dep_dep3 = cp ./priv/dep" >> $(APP)/Makefile
  97. $t echo "dep_dep4 = cp ./priv/dep" >> $(APP)/Makefile
  98. $t echo "include erlang.mk" >> $(APP)/Makefile
  99. $i "Create a new application app_one"
  100. $t $(MAKE) -C $(APP) new-app in=app_one $v
  101. $t echo "all::" >> $(APP)/apps/app_one/Makefile
  102. $t echo " @printf '#' >> count" >> $(APP)/apps/app_one/Makefile
  103. $i "Create a new application app_two"
  104. $t $(MAKE) -C $(APP) new-app in=app_two $v
  105. $t echo "all::" >> $(APP)/apps/app_two/Makefile
  106. $t echo " @printf '#' >> count" >> $(APP)/apps/app_two/Makefile
  107. $i "Build the application"
  108. $t $(MAKE) -C $(APP) $v
  109. $i "Check the number of times each app was compiled"
  110. $t test "`wc -c $(APP)/apps/app_one/count | awk '{printf $$1}'`" -eq 1
  111. $t test "`wc -c $(APP)/apps/app_two/count | awk '{printf $$1}'`" -eq 1
  112. core-deps-apps-conflict: build clean
  113. $i "Bootstrap a new OTP library named $(APP)"
  114. $t mkdir $(APP)/
  115. $t cp ../erlang.mk $(APP)/
  116. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  117. $i "Add Cowlib to the list of dependencies"
  118. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  119. $i "Create a new library Cowlib"
  120. $t $(MAKE) -C $(APP) new-lib in=cowlib $v
  121. $i "Check that building the application fails because of a conflict"
  122. $t ! $(MAKE) -C $(APP) $v
  123. $i "Check that Cowlib wasn't fetched"
  124. $t test ! -e $(APP)/deps/cowlib
  125. core-deps-apps-deep-conflict: build clean
  126. $i "Bootstrap a new OTP library named $(APP)"
  127. $t mkdir $(APP)/
  128. $t cp ../erlang.mk $(APP)/
  129. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  130. $i "Add Cowboy to the list of dependencies"
  131. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  132. $i "Create a new library Cowlib"
  133. $t $(MAKE) -C $(APP) new-lib in=cowlib $v
  134. $i "Check that building the application fails because of a conflict"
  135. $t ! $(MAKE) -C $(APP) $v
  136. $i "Check that Cowlib wasn't fetched"
  137. $t test ! -e $(APP)/deps/cowlib
  138. core-deps-apps-dir: build clean
  139. $i "Bootstrap a new OTP library named $(APP)"
  140. $t mkdir $(APP)/
  141. $t cp ../erlang.mk $(APP)/
  142. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  143. $i "Set a custom APPS_DIR"
  144. $t perl -ni.bak -e 'print;if ($$.==1) {print "APPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  145. $i "Create a new library my_app"
  146. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  147. $i "Add Cowlib as a dependency to my_app"
  148. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/deep/libs/my_app/Makefile
  149. ifdef LEGACY
  150. $i "Add Cowlib to the applications key in the .app.src file"
  151. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/deep/libs/my_app/src/my_app.app.src
  152. endif
  153. $i "Generate .erl files in my_app"
  154. $t echo "-module(boy)." > $(APP)/deep/libs/my_app/src/boy.erl
  155. $t echo "-module(girl)." > $(APP)/deep/libs/my_app/src/girl.erl
  156. $i "Build the application"
  157. $t $(MAKE) -C $(APP) $v
  158. $i "Check that all compiled files exist"
  159. $t test -f $(APP)/$(APP).d
  160. $t test -f $(APP)/ebin/$(APP).app
  161. $t test -f $(APP)/deep/libs/my_app/my_app.d
  162. $t test -f $(APP)/deep/libs/my_app/ebin/my_app.app
  163. $t test -f $(APP)/deep/libs/my_app/ebin/boy.beam
  164. $t test -f $(APP)/deep/libs/my_app/ebin/girl.beam
  165. $t test -d $(APP)/deps/cowlib
  166. # Applications in apps are compiled automatically but not added
  167. # to the application resource file unless they are listed in LOCAL_DEPS.
  168. $i "Check that the application was compiled correctly"
  169. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  170. [ok = application:load(App) || App <- [$(APP), my_app]], \
  171. {ok, Deps} = application:get_key($(APP), applications), \
  172. false = lists:member(my_app, Deps), \
  173. {ok, MyAppDeps} = application:get_key(my_app, applications), \
  174. true = lists:member(cowlib, MyAppDeps), \
  175. {ok, []} = application:get_key($(APP), modules), \
  176. {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
  177. [{module, M} = code:load_file(M) || M <- Mods], \
  178. halt()"
  179. $i "Clean the application"
  180. $t $(MAKE) -C $(APP) clean $v
  181. $i "Check that Cowlib is still here"
  182. $t test -d $(APP)/deps/cowlib
  183. $i "Check that all relevant files were removed"
  184. $t test ! -e $(APP)/$(APP).d
  185. $t test ! -e $(APP)/ebin/$(APP).app
  186. $t test ! -e $(APP)/libs/my_app/my_app.d
  187. $t test ! -e $(APP)/libs/my_app/ebin/my_app.app
  188. $t test ! -e $(APP)/libs/my_app/ebin/boy.beam
  189. $t test ! -e $(APP)/libs/my_app/ebin/girl.beam
  190. $i "Distclean the application"
  191. $t $(MAKE) -C $(APP) distclean $v
  192. $i "Check that all relevant files were removed"
  193. $t test ! -e $(APP)/deps
  194. core-deps-apps-dir-include-lib: build clean
  195. $i "Bootstrap a new OTP library named $(APP)"
  196. $t mkdir $(APP)/
  197. $t cp ../erlang.mk $(APP)/
  198. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  199. $i "Set a custom APPS_DIR"
  200. $t perl -ni.bak -e 'print;if ($$.==1) {print "APPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  201. $i "Create new libraries boy_app and girl_app"
  202. $t $(MAKE) -C $(APP) new-lib in=boy_app $v
  203. $t $(MAKE) -C $(APP) new-lib in=girl_app $v
  204. $i "Generate .erl and .hrl files in apps with mutual include_lib()"
  205. $t echo '-module(boy). -include_lib("girl_app/include/girl.hrl").' > $(APP)/deep/libs/boy_app/src/boy.erl
  206. $t echo '-module(girl). -include_lib("boy_app/include/boy.hrl").' > $(APP)/deep/libs/girl_app/src/girl.erl
  207. $t mkdir -p $(APP)/deep/libs/boy_app/include
  208. $t echo '%% boy' > $(APP)/deep/libs/boy_app/include/boy.hrl
  209. $t mkdir -p $(APP)/deep/libs/girl_app/include
  210. $t echo '%% girl' > $(APP)/deep/libs/girl_app/include/girl.hrl
  211. $i "Build the application"
  212. $t $(MAKE) -C $(APP) $v
  213. $i "Check that all compiled files exist"
  214. $t test -f $(APP)/$(APP).d
  215. $t test -f $(APP)/ebin/$(APP).app
  216. $t test -f $(APP)/deep/libs/boy_app/boy_app.d
  217. $t test -f $(APP)/deep/libs/boy_app/ebin/boy_app.app
  218. $t test -f $(APP)/deep/libs/boy_app/ebin/boy.beam
  219. $t test -f $(APP)/deep/libs/girl_app/girl_app.d
  220. $t test -f $(APP)/deep/libs/girl_app/ebin/girl_app.app
  221. $t test -f $(APP)/deep/libs/girl_app/ebin/girl.beam
  222. $i "Distclean the application"
  223. $t $(MAKE) -C $(APP) distclean $v
  224. core-deps-apps-new-app: build clean
  225. $i "Bootstrap a new OTP library named $(APP)"
  226. $t mkdir $(APP)/
  227. $t cp ../erlang.mk $(APP)/
  228. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  229. $i "Create a new application my_app"
  230. $t $(MAKE) -C $(APP) new-app in=my_app $v
  231. $i "Check that all bootstrapped files exist"
  232. $t test -f $(APP)/apps/my_app/Makefile
  233. ifdef LEGACY
  234. $t test -f $(APP)/apps/my_app/src/my_app.app.src
  235. endif
  236. $t test -f $(APP)/apps/my_app/src/my_app_app.erl
  237. $t test -f $(APP)/apps/my_app/src/my_app_sup.erl
  238. $i "Create a new module my_server in my_app"
  239. $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
  240. $i "Check that the file exists"
  241. $t test -f $(APP)/apps/my_app/src/my_server.erl
  242. $i "Build the application"
  243. $t $(MAKE) -C $(APP) $v
  244. $i "Check that all compiled files exist"
  245. $t test -f $(APP)/$(APP).d
  246. $t test -f $(APP)/ebin/$(APP).app
  247. $t test -f $(APP)/apps/my_app/my_app.d
  248. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  249. $t test -f $(APP)/apps/my_app/ebin/my_app_app.beam
  250. $t test -f $(APP)/apps/my_app/ebin/my_app_sup.beam
  251. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  252. $i "Check that the application was compiled correctly"
  253. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  254. ok = application:start(my_app), \
  255. {ok, [my_app_app, my_app_sup, my_server]} = application:get_key(my_app, modules), \
  256. {module, my_app_app} = code:load_file(my_app_app), \
  257. {module, my_app_sup} = code:load_file(my_app_sup), \
  258. {module, my_server} = code:load_file(my_server), \
  259. halt()"
  260. core-deps-apps-new-lib: build clean
  261. $i "Bootstrap a new OTP library named $(APP)"
  262. $t mkdir $(APP)/
  263. $t cp ../erlang.mk $(APP)/
  264. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  265. $i "Create a new application my_app"
  266. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  267. $i "Check that all bootstrapped files exist"
  268. $t test -f $(APP)/apps/my_app/Makefile
  269. ifdef LEGACY
  270. $t test -f $(APP)/apps/my_app/src/my_app.app.src
  271. endif
  272. $i "Create a new module my_server in my_app"
  273. $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
  274. $i "Check that the file exists"
  275. $t test -f $(APP)/apps/my_app/src/my_server.erl
  276. $i "Build the application"
  277. $t $(MAKE) -C $(APP) $v
  278. $i "Check that all compiled files exist"
  279. $t test -f $(APP)/$(APP).d
  280. $t test -f $(APP)/ebin/$(APP).app
  281. $t test -f $(APP)/apps/my_app/my_app.d
  282. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  283. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  284. $i "Check that the application was compiled correctly"
  285. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  286. ok = application:start(my_app), \
  287. {ok, [my_server]} = application:get_key(my_app, modules), \
  288. {module, my_server} = code:load_file(my_server), \
  289. halt()"
  290. core-deps-apps-new-tpl: build clean
  291. $i "Bootstrap a new OTP library named $(APP)"
  292. $t mkdir $(APP)/
  293. $t cp ../erlang.mk $(APP)/
  294. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  295. $i "Create a new library my_app"
  296. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  297. $i "Generate one of each template"
  298. $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=gen_fsm n=my_fsm
  299. $t $(MAKE) -C $(APP) --no-print-directory new in=cowboy_rest t=gen_fsm n=my_cowboy_rest
  300. $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=gen_server n=my_server
  301. $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=gen_statem n=my_statem
  302. $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=supervisor n=my_sup
  303. # Here we disable warnings because templates contain missing behaviors.
  304. $i "Build the application"
  305. $t $(MAKE) -C $(APP)/apps/my_app ERLC_OPTS=+debug_info $v
  306. $i "Check that all compiled files exist"
  307. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  308. $t test -f $(APP)/apps/my_app/ebin/my_fsm.beam
  309. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  310. $t test -f $(APP)/apps/my_app/ebin/my_sup.beam
  311. $i "Check that all the modules can be loaded"
  312. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  313. ok = application:start(my_app), \
  314. {ok, Mods = [my_fsm, my_server, my_sup]} = application:get_key(my_app, modules), \
  315. [{module, M} = code:load_file(M) || M <- Mods], \
  316. halt()"
  317. core-deps-apps-only: build clean
  318. $i "Create a multi application repository with no root application"
  319. $t mkdir $(APP)/
  320. $t cp ../erlang.mk $(APP)/
  321. $t echo "include erlang.mk" > $(APP)/Makefile
  322. $i "Create a new application my_app"
  323. $t $(MAKE) -C $(APP) new-app in=my_app $v
  324. $i "Create a module my_server from gen_server template in my_app"
  325. $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
  326. $i "Add Cowlib to the list of dependencies"
  327. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/apps/my_app/Makefile
  328. $i "Build the application"
  329. $t $(MAKE) -C $(APP) $v
  330. $i "Check that all compiled files exist"
  331. $t test -f $(APP)/apps/my_app/my_app.d
  332. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  333. $t test -f $(APP)/apps/my_app/ebin/my_app_app.beam
  334. $t test -f $(APP)/apps/my_app/ebin/my_app_sup.beam
  335. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  336. $t test -d $(APP)/deps/cowlib/
  337. $i "Check that the application was compiled correctly"
  338. $t $(ERL) -pa $(APP)/apps/*/ebin/ -eval " \
  339. ok = application:load(my_app), \
  340. {ok, Mods = [my_app_app, my_app_sup, my_server]} = application:get_key(my_app, modules), \
  341. [{module, M} = code:load_file(M) || M <- Mods], \
  342. halt()"
  343. $i "Clean the application"
  344. $t $(MAKE) -C $(APP) clean $v
  345. $i "Check that Cowlib is still here"
  346. $t test -d $(APP)/deps/cowlib
  347. $i "Check that all relevant files were removed"
  348. $t test ! -e $(APP)/apps/my_app/my_app.d
  349. $t test ! -e $(APP)/apps/my_app/ebin/my_app.app
  350. $t test ! -e $(APP)/apps/my_app/ebin/my_app_app.beam
  351. $t test ! -e $(APP)/apps/my_app/ebin/my_app_sup.beam
  352. $t test ! -e $(APP)/apps/my_app/ebin/my_server.beam
  353. $i "Distclean the application"
  354. $t $(MAKE) -C $(APP) distclean $v
  355. $i "Check that all relevant files were removed"
  356. $t test ! -e $(APP)/deps
  357. core-deps-autopatch-rebar: build clean
  358. $i "Bootstrap a new OTP library named $(APP)"
  359. $t mkdir $(APP)/
  360. $t cp ../erlang.mk $(APP)/
  361. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  362. $i "Add erlsha2 to the list of dependencies"
  363. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = erlsha2\n"}' $(APP)/Makefile
  364. $i "Build the application"
  365. $t $(MAKE) -C $(APP) $v
  366. $i "Check that erlsha2 was fetched and built"
  367. $t test -d $(APP)/deps/erlsha2
  368. $t test -f $(APP)/deps/erlsha2/ebin/erlsha2.beam
  369. ifneq ($(PLATFORM),msys2)
  370. $t test -f $(APP)/deps/erlsha2/priv/erlsha2_nif.so
  371. endif
  372. ifneq ($(PLATFORM),msys2)
  373. core-deps-build-c-8cc: build clean
  374. $i "Bootstrap a new OTP library named $(APP)"
  375. $t mkdir $(APP)/
  376. $t cp ../erlang.mk $(APP)/
  377. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  378. $i "Add 8cc to the list of build dependencies"
  379. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = 8cc\ndep_8cc = git https://github.com/rui314/8cc master\n"}' $(APP)/Makefile
  380. $i "Build the application"
  381. $t $(MAKE) -C $(APP) $v
  382. $i "Check that all dependencies were fetched"
  383. $t test -d $(APP)/deps/8cc
  384. $i "Check that 8cc can be started"
  385. $t $(APP)/deps/8cc/8cc -h $v
  386. $i "Check that the application was compiled correctly"
  387. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  388. [ok = application:load(App) || App <- [$(APP)]], \
  389. {ok, Deps} = application:get_key($(APP), applications), \
  390. false = lists:member('8cc', Deps), \
  391. halt()"
  392. endif
  393. ifneq ($(PLATFORM),freebsd)
  394. core-deps-build-c-imagejs: build clean
  395. $i "Bootstrap a new OTP library named $(APP)"
  396. $t mkdir $(APP)/
  397. $t cp ../erlang.mk $(APP)/
  398. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  399. $i "Add imagejs to the list of build dependencies"
  400. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = imagejs\ndep_imagejs = git https://github.com/jklmnn/imagejs master\n"}' $(APP)/Makefile
  401. $i "Build the application"
  402. $t $(MAKE) -C $(APP) $v
  403. $i "Check that all dependencies were fetched"
  404. $t test -d $(APP)/deps/imagejs
  405. $i "Check that imagejs works"
  406. $t $(APP)/deps/imagejs/imagejs bmp $(APP)/deps/imagejs/Makefile
  407. $t test -f $(APP)/deps/imagejs/Makefile.bmp
  408. $i "Check that the application was compiled correctly"
  409. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  410. [ok = application:load(App) || App <- [$(APP)]], \
  411. {ok, Deps} = application:get_key($(APP), applications), \
  412. false = lists:member(imagejs, Deps), \
  413. halt()"
  414. endif
  415. core-deps-build-erl: build clean
  416. $i "Bootstrap a new OTP library named $(APP)"
  417. $t mkdir $(APP)/
  418. $t cp ../erlang.mk $(APP)/
  419. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  420. $i "Add cowlib to the list of build dependencies"
  421. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = cowlib\n"}' $(APP)/Makefile
  422. $i "Build the application"
  423. $t $(MAKE) -C $(APP) $v
  424. $i "Check that all dependencies were fetched"
  425. $t test -d $(APP)/deps/cowlib
  426. $i "Check that the application was compiled correctly"
  427. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  428. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  429. {ok, Deps} = application:get_key($(APP), applications), \
  430. false = lists:member(cowlib, Deps), \
  431. halt()"
  432. core-deps-build-js: build clean
  433. $i "Bootstrap a new OTP library named $(APP)"
  434. $t mkdir $(APP)/
  435. $t cp ../erlang.mk $(APP)/
  436. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  437. $i "Add jquery to the list of build dependencies"
  438. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = jquery\ndep_jquery = git https://github.com/jquery/jquery master\n"}' $(APP)/Makefile
  439. $i "Build the application"
  440. $t $(MAKE) -C $(APP) $v
  441. $i "Check that all dependencies were fetched"
  442. $t test -d $(APP)/deps/jquery
  443. $i "Check that the application was compiled correctly"
  444. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  445. [ok = application:load(App) || App <- [$(APP)]], \
  446. {ok, Deps} = application:get_key($(APP), applications), \
  447. false = lists:member(jquery, Deps), \
  448. halt()"
  449. core-deps-dep-commit: build clean
  450. $i "Bootstrap a new OTP library named $(APP)"
  451. $t mkdir $(APP)/
  452. $t cp ../erlang.mk $(APP)/
  453. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  454. $i "Add Cowboy 1.0.0 to the list of dependencies"
  455. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
  456. ifdef LEGACY
  457. $i "Add Cowboy to the applications key in the .app.src file"
  458. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  459. endif
  460. $i "Build the application"
  461. $t $(MAKE) -C $(APP) $v
  462. $i "Check that all dependencies were fetched"
  463. $t test -d $(APP)/deps/cowboy
  464. $t test -d $(APP)/deps/cowlib
  465. $t test -d $(APP)/deps/ranch
  466. $i "Check that the application was compiled correctly"
  467. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  468. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  469. {ok, Deps} = application:get_key($(APP), applications), \
  470. true = lists:member(cowboy, Deps), \
  471. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  472. halt()"
  473. core-deps-dir: build clean
  474. $i "Bootstrap a new OTP library named $(APP)"
  475. $t mkdir $(APP)/
  476. $t cp ../erlang.mk $(APP)/
  477. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  478. $i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
  479. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  480. ifdef LEGACY
  481. $i "Add Cowboy to the applications key in the .app.src file"
  482. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  483. endif
  484. $i "Build the application"
  485. $t $(MAKE) -C $(APP) $v
  486. $i "Check that all dependencies were fetched in the custom DEPS_DIR"
  487. $t test -d $(APP)/deep/libs/cowboy
  488. $t test -d $(APP)/deep/libs/cowlib
  489. $t test -d $(APP)/deep/libs/ranch
  490. $i "Check that the application was compiled correctly"
  491. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  492. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  493. {ok, Deps} = application:get_key($(APP), applications), \
  494. true = lists:member(cowboy, Deps), \
  495. halt()"
  496. core-deps-doc: build clean
  497. $i "Bootstrap a new OTP library named $(APP)"
  498. $t mkdir $(APP)/
  499. $t cp ../erlang.mk $(APP)/
  500. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  501. $i "Generate .erl files"
  502. $t echo "-module(boy)." > $(APP)/src/boy.erl
  503. $t echo "-module(girl)." > $(APP)/src/girl.erl
  504. $i "Add Edown as a documentation building dependency"
  505. $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
  506. $i "Build the application"
  507. $t $(MAKE) -C $(APP) $v
  508. $i "Check that no dependencies were fetched"
  509. $t test ! -e $(APP)/deps
  510. $i "Check that the application was compiled correctly"
  511. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  512. [ok = application:load(App) || App <- [$(APP)]], \
  513. {ok, Deps} = application:get_key($(APP), applications), \
  514. false = lists:member(edown, Deps), \
  515. halt()"
  516. $i "Build the application documentation"
  517. $t $(MAKE) -C $(APP) edoc $v
  518. $i "Check that documentation dependencies were fetched"
  519. $t test -d $(APP)/deps/edown
  520. $i "Check the Edown generated Markdown documentation"
  521. $t test -f $(APP)/doc/boy.md
  522. $t test -f $(APP)/doc/girl.md
  523. core-deps-fetch-cp: build clean
  524. $i "Bootstrap a new OTP library named $(APP)"
  525. $t mkdir $(APP)/
  526. $t cp ../erlang.mk $(APP)/
  527. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  528. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  529. $t mkdir $(APP)/my_dep
  530. $t cp ../erlang.mk $(APP)/my_dep/
  531. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  532. $i "Add my_dep to the list of dependencies"
  533. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  534. ifdef LEGACY
  535. $i "Add my_dep to the applications key in the .app.src file"
  536. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  537. endif
  538. $i "Build the application"
  539. $t $(MAKE) -C $(APP) $v
  540. $i "Check that all dependencies were fetched"
  541. $t test -d $(APP)/deps/my_dep
  542. $i "Check that the application was compiled correctly"
  543. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  544. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  545. {ok, Deps} = application:get_key($(APP), applications), \
  546. true = lists:member(my_dep, Deps), \
  547. halt()"
  548. core-deps-fetch-custom: build clean
  549. $i "Bootstrap a new OTP library named $(APP)"
  550. $t mkdir $(APP)/
  551. $t cp ../erlang.mk $(APP)/
  552. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  553. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  554. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = boop\ndep_boop = beep boop\ndep_fetch_beep = mkdir -p \$$(DEPS_DIR)/\$$1/ebin/\n"}' $(APP)/Makefile
  555. ifdef LEGACY
  556. $i "Add boop to the applications key in the .app.src file"
  557. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
  558. endif
  559. $i "Build the application"
  560. $t $(MAKE) -C $(APP) $v
  561. $i "Check that all dependencies were fetched"
  562. $t test -d $(APP)/deps/boop
  563. $i "Check that the application was compiled correctly"
  564. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  565. ok = application:load($(APP)), \
  566. {ok, Deps} = application:get_key($(APP), applications), \
  567. true = lists:member(boop, Deps), \
  568. halt()"
  569. core-deps-fetch-fail-bad: build clean
  570. $i "Bootstrap a new OTP library named $(APP)"
  571. $t mkdir $(APP)/
  572. $t cp ../erlang.mk $(APP)/
  573. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  574. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  575. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = oops https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  576. $i "Check that building the application fails"
  577. $t ! $(MAKE) -C $(APP) $v
  578. core-deps-fetch-fail-unknown: build clean
  579. $i "Bootstrap a new OTP library named $(APP)"
  580. $t mkdir $(APP)/
  581. $t cp ../erlang.mk $(APP)/
  582. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  583. $i "Add an unknown application as a dependency"
  584. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
  585. $i "Check that building the application fails"
  586. $t ! $(MAKE) -C $(APP) $v
  587. core-deps-fetch-git: build clean
  588. $i "Bootstrap a new OTP library named $(APP)"
  589. $t mkdir $(APP)/
  590. $t cp ../erlang.mk $(APP)/
  591. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  592. $i "Add Cowboy 1.0.0 to the list of dependencies"
  593. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = git https://github.com/ninenines/cowboy 1.0.0\n"}' $(APP)/Makefile
  594. ifdef LEGACY
  595. $i "Add Cowboy to the applications key in the .app.src file"
  596. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  597. endif
  598. $i "Build the application"
  599. $t $(MAKE) -C $(APP) $v
  600. $i "Check that all dependencies were fetched"
  601. $t test -d $(APP)/deps/cowboy
  602. $t test -d $(APP)/deps/cowlib
  603. $t test -d $(APP)/deps/ranch
  604. $i "Check that the application was compiled correctly"
  605. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  606. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  607. {ok, Deps} = application:get_key($(APP), applications), \
  608. true = lists:member(cowboy, Deps), \
  609. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  610. halt()"
  611. core-deps-fetch-git-submodule: build clean
  612. $i "Bootstrap a new OTP library named $(APP)"
  613. $t mkdir $(APP)/
  614. $t cp ../erlang.mk $(APP)/
  615. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  616. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  617. $t mkdir $(APP)/my_dep
  618. $t cp ../erlang.mk $(APP)/my_dep/
  619. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  620. # Create an empty file so src/ gets committed.
  621. $t touch $(APP)/my_dep/src/README
  622. $t cd $(APP)/my_dep && \
  623. git init -q && \
  624. git config user.email "testsuite@erlang.mk" && \
  625. git config user.name "test suite" && \
  626. git add . && \
  627. git commit -q -m "Tests"
  628. $i "Add the submodule to my_dep"
  629. $t mkdir $(APP)/deps
  630. $t cd $(APP) && \
  631. git init -q && \
  632. git submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
  633. git config user.email "testsuite@erlang.mk" && \
  634. git config user.name "test suite" && \
  635. git add . && \
  636. git commit -q -m "Tests"
  637. $i "Distclean the application"
  638. $t $(MAKE) -C $(APP) distclean $v
  639. $i "Add my_dep to the list of dependencies"
  640. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-submodule\n"}' $(APP)/Makefile
  641. ifdef LEGACY
  642. $i "Add my_dep to the applications key in the .app.src file"
  643. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  644. endif
  645. $i "Build the application"
  646. $t $(MAKE) -C $(APP) $v
  647. $i "Check that all dependencies were fetched"
  648. $t test -d $(APP)/deps/my_dep
  649. $i "Check that the application was compiled correctly"
  650. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  651. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  652. {ok, Deps} = application:get_key($(APP), applications), \
  653. true = lists:member(my_dep, Deps), \
  654. halt()"
  655. core-deps-fetch-hex: build clean
  656. $i "Bootstrap a new OTP library named $(APP)"
  657. $t mkdir $(APP)/
  658. $t cp ../erlang.mk $(APP)/
  659. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  660. $i "Add Cowboy 1.0.0 to the list of dependencies"
  661. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
  662. ifdef LEGACY
  663. $i "Add Cowboy to the applications key in the .app.src file"
  664. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  665. endif
  666. $i "Build the application"
  667. $t $(MAKE) -C $(APP) $v
  668. $i "Check that all dependencies were fetched"
  669. $t test -d $(APP)/deps/cowboy
  670. $t test -d $(APP)/deps/cowlib
  671. $t test -d $(APP)/deps/ranch
  672. $i "Check that the application was compiled correctly"
  673. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  674. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  675. {ok, Deps} = application:get_key($(APP), applications), \
  676. true = lists:member(cowboy, Deps), \
  677. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  678. halt()"
  679. core-deps-fetch-hg: build clean
  680. $i "Bootstrap a new OTP library named $(APP)"
  681. $t mkdir $(APP)/
  682. $t cp ../erlang.mk $(APP)/
  683. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  684. $i "Add Ehsa 4.0.3 to the list of dependencies"
  685. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = ehsa\ndep_ehsa = hg https://bitbucket.org/a12n/ehsa 4.0.3\n"}' $(APP)/Makefile
  686. ifdef LEGACY
  687. $i "Add ehsa to the applications key in the .app.src file"
  688. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
  689. endif
  690. $i "Build the application"
  691. $t $(MAKE) -C $(APP) $v
  692. $i "Check that all dependencies were fetched"
  693. $t test -d $(APP)/deps/ehsa
  694. $i "Check that the application was compiled correctly"
  695. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  696. [ok = application:load(App) || App <- [$(APP), ehsa]], \
  697. {ok, Deps} = application:get_key($(APP), applications), \
  698. true = lists:member(ehsa, Deps), \
  699. {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  700. halt()"
  701. # Legacy must fail for the top-level application, but work for dependencies.
  702. core-deps-fetch-legacy: build clean
  703. $i "Bootstrap a new OTP library named $(APP)"
  704. $t mkdir $(APP)/
  705. $t cp ../erlang.mk $(APP)/
  706. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  707. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  708. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  709. $i "Check that building the application fails"
  710. $t ! $(MAKE) -C $(APP) $v
  711. $i "Check that building the application works with IS_DEP=1"
  712. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  713. core-deps-fetch-svn: build clean
  714. $i "Bootstrap a new OTP library named $(APP)"
  715. $t mkdir $(APP)/
  716. $t cp ../erlang.mk $(APP)/
  717. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  718. $i "Add Cowlib 1.0.0 to the list of dependencies"
  719. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = svn https://github.com/ninenines/cowlib/tags/1.0.0\n"}' $(APP)/Makefile
  720. ifdef LEGACY
  721. $i "Add Cowlib to the applications key in the .app.src file"
  722. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  723. endif
  724. $i "Build the application"
  725. $t $(MAKE) -C $(APP) $v
  726. $i "Check that all dependencies were fetched"
  727. $t test -d $(APP)/deps/cowlib
  728. $i "Check that the application was compiled correctly"
  729. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  730. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  731. {ok, Deps} = application:get_key($(APP), applications), \
  732. true = lists:member(cowlib, Deps), \
  733. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  734. halt()"
  735. core-deps-ignore: build clean
  736. $i "Bootstrap a new OTP library named $(APP)"
  737. $t mkdir $(APP)/
  738. $t cp ../erlang.mk $(APP)/
  739. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  740. $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  741. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  742. ifdef LEGACY
  743. $i "Add Cowboy to the applications key in the .app.src file"
  744. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  745. endif
  746. $i "Build the application"
  747. $t $(MAKE) -C $(APP) $v
  748. $i "Check that the correct dependencies were fetched"
  749. $t test -d $(APP)/deps/cowboy
  750. $t test -d $(APP)/deps/cowlib
  751. $t test ! -e $(APP)/deps/ranch
  752. $i "Build the test dependencies"
  753. $t $(MAKE) -C $(APP) test-deps $v
  754. $i "Check that the correct dependencies were fetched"
  755. $t test -d $(APP)/deps/ranch
  756. define add_dep_and_subdep
  757. $i "Bootstrap a new OTP library named $(APP)-$(1)subdep"
  758. $t mkdir $(APP)-$(1)subdep/
  759. $t cp ../erlang.mk $(APP)-$(1)subdep/
  760. $t $(MAKE) -C $(APP)-$(1)subdep --no-print-directory -f erlang.mk bootstrap-lib $$v
  761. $i "Create a Git repository for $(APP)-$(1)subdep"
  762. $t (cd $(APP)-$(1)subdep && \
  763. git init -q && \
  764. git config user.name "Testsuite" && \
  765. git config user.email "testsuite@erlang.mk" && \
  766. git add . && \
  767. git commit -q -m "Initial commit")
  768. $i "Bootstrap a new OTP library named $(APP)-$(1)dep"
  769. $t mkdir $(APP)-$(1)dep/
  770. $t cp ../erlang.mk $(APP)-$(1)dep/
  771. $t $(MAKE) -C $(APP)-$(1)dep --no-print-directory -f erlang.mk bootstrap-lib $$v
  772. $i "Add $(APP)-$(1)subdep as a dependency"
  773. $t perl -ni.bak -e \
  774. 'print;if ($$.==1) {print "DEPS = $(1)subdep\ndep_$(1)subdep = git file://$(abspath $(APP)-$(1)subdep) master\n"}' \
  775. $(APP)-$(1)dep/Makefile
  776. $t rm $(APP)-$(1)dep/Makefile.bak
  777. $i "Create a Git repository for $(APP)-$(1)dep"
  778. $t (cd $(APP)-$(1)dep && \
  779. git init -q && \
  780. git config user.name "Testsuite" && \
  781. git config user.email "testsuite@erlang.mk" && \
  782. git add . && \
  783. git commit -q -m "Initial commit")
  784. endef
  785. core-deps-list-deps: build clean
  786. $(call add_dep_and_subdep,)
  787. $(call add_dep_and_subdep,doc)
  788. $(call add_dep_and_subdep,rel)
  789. $(call add_dep_and_subdep,test)
  790. $(call add_dep_and_subdep,shell)
  791. $i "Bootstrap a new OTP library named $(APP)"
  792. $t mkdir $(APP)/
  793. $t cp ../erlang.mk $(APP)/
  794. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  795. $i "Add $(APP)-dep and $(APP)-testdep as a dependency"
  796. $t sed -i.bak '2i\
  797. DEPS = dep\
  798. DOC_DEPS = docdep\
  799. REL_DEPS = reldep\
  800. TEST_DEPS = testdep\
  801. SHELL_DEPS = shelldep\
  802. dep_dep = git file://$(abspath $(APP)-dep) master\
  803. dep_docdep = git file://$(abspath $(APP)-docdep) master\
  804. dep_reldep = git file://$(abspath $(APP)-reldep) master\
  805. dep_testdep = git file://$(abspath $(APP)-testdep) master\
  806. dep_shelldep = git file://$(abspath $(APP)-shelldep) master\
  807. ' $(APP)/Makefile
  808. $t rm $(APP)/Makefile.bak
  809. $i "Create a Git repository for $(APP)"
  810. $t (cd $(APP) && \
  811. git init -q && \
  812. git config user.name "Testsuite" && \
  813. git config user.email "testsuite@erlang.mk" && \
  814. git add . && \
  815. git commit -q -m "Initial commit")
  816. $i "List application dependencies"
  817. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  818. $t test -d $(APP)/deps/subdep
  819. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  820. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  821. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  822. $i "List application doc dependencies"
  823. $t $(MAKE) -C $(APP) --no-print-directory list-doc-deps $v
  824. $t test -d $(APP)/deps/subdep
  825. $t test -d $(APP)/deps/docsubdep
  826. $t printf "%s\n%s\n%s\n%s\n" \
  827. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/docdep $(APP)/deps/docsubdep) \
  828. | sort > $(APP)/expected-doc-deps.txt
  829. $t cmp $(APP)/expected-doc-deps.txt $(APP)/.erlang.mk/recursive-doc-deps-list.log
  830. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  831. $i "List application rel dependencies"
  832. $t $(MAKE) -C $(APP) --no-print-directory list-rel-deps $v
  833. $t test -d $(APP)/deps/subdep
  834. $t test -d $(APP)/deps/relsubdep
  835. $t printf "%s\n%s\n%s\n%s\n" \
  836. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/reldep $(APP)/deps/relsubdep) \
  837. | sort > $(APP)/expected-rel-deps.txt
  838. $t cmp $(APP)/expected-rel-deps.txt $(APP)/.erlang.mk/recursive-rel-deps-list.log
  839. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  840. $i "List application test dependencies"
  841. $t $(MAKE) -C $(APP) --no-print-directory list-test-deps $v
  842. $t test -d $(APP)/deps/subdep
  843. $t test -d $(APP)/deps/testsubdep
  844. $t printf "%s\n%s\n%s\n%s\n" \
  845. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/testdep $(APP)/deps/testsubdep) \
  846. | sort > $(APP)/expected-test-deps.txt
  847. $t cmp $(APP)/expected-test-deps.txt $(APP)/.erlang.mk/recursive-test-deps-list.log
  848. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  849. $i "List application shell dependencies"
  850. $t $(MAKE) -C $(APP) --no-print-directory list-shell-deps $v
  851. $t test -d $(APP)/deps/subdep
  852. $t test -d $(APP)/deps/shellsubdep
  853. $t printf "%s\n%s\n%s\n%s\n" \
  854. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  855. | sort > $(APP)/expected-shell-deps.txt
  856. $t cmp $(APP)/expected-shell-deps.txt $(APP)/.erlang.mk/recursive-shell-deps-list.log
  857. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  858. $i "List application all dependencies (all kinds)"
  859. $t $(MAKE) -C $(APP) --no-print-directory list-deps DEP_TYPES='doc rel test shell' $v
  860. $t test -d $(APP)/deps/subdep
  861. $t test -d $(APP)/deps/docsubdep
  862. $t test -d $(APP)/deps/relsubdep
  863. $t test -d $(APP)/deps/testsubdep
  864. $t test -d $(APP)/deps/shellsubdep
  865. $t printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
  866. $(abspath \
  867. $(APP)/deps/dep $(APP)/deps/subdep \
  868. $(APP)/deps/docdep $(APP)/deps/docsubdep \
  869. $(APP)/deps/reldep $(APP)/deps/relsubdep \
  870. $(APP)/deps/testdep $(APP)/deps/testsubdep \
  871. $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  872. | sort > $(APP)/expected-all-deps.txt
  873. $t cmp $(APP)/expected-all-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  874. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  875. core-deps-mv: build clean
  876. $i "Bootstrap a new OTP library named $(APP)"
  877. $t mkdir $(APP)/
  878. $t cp ../erlang.mk $(APP)/
  879. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  880. $i "Add Cowlib to the list of dependencies"
  881. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  882. $i "Build the application"
  883. $t $(MAKE) -C $(APP) $v
  884. $i "Check that all dependencies were fetched"
  885. $t test -d $(APP)/deps/cowlib
  886. $i "Move the application elsewhere"
  887. $t mv $(APP) $(APP)-moved
  888. $i "Build the application"
  889. $t $(MAKE) -C $(APP)-moved $v
  890. core-deps-mv-rebar: build clean
  891. $i "Bootstrap a new OTP library named $(APP)"
  892. $t mkdir $(APP)/
  893. $t cp ../erlang.mk $(APP)/
  894. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  895. $i "Add Lager to the list of dependencies"
  896. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  897. $i "Build the application"
  898. $t $(MAKE) -C $(APP) $v
  899. $i "Check that all dependencies were fetched"
  900. $t test -d $(APP)/deps/goldrush
  901. $t test -d $(APP)/deps/lager
  902. $i "Move the application elsewhere"
  903. $t mv $(APP) $(APP)-moved
  904. $i "Build the application"
  905. $t $(MAKE) -C $(APP)-moved $v
  906. # A lower-level dependency of the first dependency always
  907. # wins over a lower-level dependency of the second dependency.
  908. core-deps-order-first: build clean
  909. $i "Bootstrap a new OTP library named $(APP)"
  910. $t mkdir $(APP)/
  911. $t cp ../erlang.mk $(APP)/
  912. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  913. $i "Add Cowboy package and my_dep to the list of dependencies"
  914. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  915. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  916. $t mkdir $(APP)/my_dep
  917. $t cp ../erlang.mk $(APP)/my_dep/
  918. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  919. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  920. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = git https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/my_dep/Makefile
  921. ifdef LEGACY
  922. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  923. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  924. endif
  925. $i "Build the application"
  926. $t $(MAKE) -C $(APP) $v
  927. $i "Check that all dependencies were fetched"
  928. $t test -d $(APP)/deps/cowboy
  929. $t test -d $(APP)/deps/cowlib
  930. $t test -d $(APP)/deps/my_dep
  931. $t test -d $(APP)/deps/ranch
  932. $i "Check that the application was compiled correctly"
  933. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  934. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  935. {ok, Deps} = application:get_key($(APP), applications), \
  936. true = lists:member(cowboy, Deps), \
  937. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  938. halt()"
  939. # A higher-level dependency always wins.
  940. core-deps-order-top: build clean
  941. $i "Bootstrap a new OTP library named $(APP)"
  942. $t mkdir $(APP)/
  943. $t cp ../erlang.mk $(APP)/
  944. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  945. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  946. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy cowlib\ndep_cowlib = git https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  947. ifdef LEGACY
  948. $i "Add Cowboy to the applications key in the .app.src file"
  949. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  950. endif
  951. $i "Build the application"
  952. $t $(MAKE) -C $(APP) $v
  953. $i "Check that all dependencies were fetched"
  954. $t test -d $(APP)/deps/cowboy
  955. $t test -d $(APP)/deps/cowlib
  956. $t test -d $(APP)/deps/ranch
  957. $i "Check that the application was compiled correctly"
  958. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  959. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  960. {ok, Deps} = application:get_key($(APP), applications), \
  961. true = lists:member(cowboy, Deps), \
  962. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  963. halt()"
  964. core-deps-no-autopatch: build clean
  965. $i "Bootstrap a new OTP library named $(APP)"
  966. $t mkdir $(APP)/
  967. $t cp ../erlang.mk $(APP)/
  968. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  969. $i "Add Cowboy to the list of dependencies and Cowlib to the NO_AUTOPATCH list"
  970. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nNO_AUTOPATCH = cowlib\n"}' $(APP)/Makefile
  971. $i "Build the application"
  972. $t $(MAKE) -C $(APP) $v
  973. $i "Check that all dependencies were fetched"
  974. $t test -d $(APP)/deps/cowboy
  975. $t test -d $(APP)/deps/cowlib
  976. $t test -d $(APP)/deps/ranch
  977. $i "Check that Cowlib was not autopatched"
  978. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  979. core-deps-no-autopatch-erlang-mk: build clean
  980. $i "Bootstrap a new OTP library named $(APP)"
  981. $t mkdir $(APP)/
  982. $t cp ../erlang.mk $(APP)/
  983. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  984. $i "Add Cowlib to the list of dependencies and set NO_AUTOPATCH_ERLANG_MK=1"
  985. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\nNO_AUTOPATCH_ERLANG_MK = 1\n"}' $(APP)/Makefile
  986. $i "Build the application"
  987. $t $(MAKE) -C $(APP) $v
  988. $i "Check that all dependencies were fetched"
  989. $t test -d $(APP)/deps/cowlib
  990. $i "Check that Erlang.mk was not autopatched"
  991. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  992. core-deps-no-autopatch-rebar: build clean
  993. $i "Bootstrap a new OTP library named $(APP)"
  994. $t mkdir $(APP)/
  995. $t cp ../erlang.mk $(APP)/
  996. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  997. $i "Add Lager to the list of dependencies and to the NO_AUTOPATCH list"
  998. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\nNO_AUTOPATCH = lager\n"}' $(APP)/Makefile
  999. $i "Build the application"
  1000. $t $(MAKE) -C $(APP) $v
  1001. $i "Check that all dependencies were fetched"
  1002. $t test -d $(APP)/deps/goldrush
  1003. $t test -d $(APP)/deps/lager
  1004. $i "Check that Lager was not autopatched"
  1005. $t if grep -q erlang\.mk $(APP)/deps/goldrush/Makefile; then false; fi
  1006. $t if grep -q erlang\.mk $(APP)/deps/lager/Makefile; then false; fi
  1007. ifndef LEGACY
  1008. core-deps-otp: build clean
  1009. $i "Bootstrap a new OTP library named $(APP)"
  1010. $t mkdir $(APP)/
  1011. $t cp ../erlang.mk $(APP)/
  1012. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1013. $i "Add Crypto to the list of OTP dependencies"
  1014. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  1015. $i "Build the application"
  1016. $t $(MAKE) -C $(APP) $v
  1017. $i "Check that no dependencies were fetched"
  1018. $t test ! -e $(APP)/deps
  1019. $i "Check that the application was compiled correctly"
  1020. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1021. [ok = application:load(App) || App <- [$(APP), crypto]], \
  1022. {ok, Deps} = application:get_key($(APP), applications), \
  1023. true = lists:member(crypto, Deps), \
  1024. halt()"
  1025. endif
  1026. core-deps-pkg: build clean
  1027. $i "Bootstrap a new OTP library named $(APP)"
  1028. $t mkdir $(APP)/
  1029. $t cp ../erlang.mk $(APP)/
  1030. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1031. $i "Add Cowboy to the list of dependencies"
  1032. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1033. ifdef LEGACY
  1034. $i "Add Cowboy to the applications key in the .app.src file"
  1035. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1036. endif
  1037. $i "Build the application"
  1038. $t $(MAKE) -C $(APP) $v
  1039. $i "Check that all dependencies were fetched"
  1040. $t test -d $(APP)/deps/cowboy
  1041. $t test -d $(APP)/deps/cowlib
  1042. $t test -d $(APP)/deps/ranch
  1043. $i "Check that the application was compiled correctly"
  1044. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1045. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  1046. {ok, Deps} = application:get_key($(APP), applications), \
  1047. true = lists:member(cowboy, Deps), \
  1048. halt()"
  1049. core-deps-rel: build clean
  1050. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  1051. $t mkdir $(APP)/
  1052. $t cp ../erlang.mk $(APP)/
  1053. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  1054. $i "Add Recon to the list of release dependencies"
  1055. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  1056. $i "Add Recon to the relx.config file"
  1057. $t $(ERL) -eval " \
  1058. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  1059. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  1060. ok = file:write_file(\"$(APP)/relx.config\", \
  1061. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  1062. halt()"
  1063. $i "Build the application and its dependencies"
  1064. $t $(MAKE) -C $(APP) deps app $v
  1065. $i "Check that no dependencies were fetched"
  1066. $t test ! -e $(APP)/deps
  1067. $i "Check that the application was compiled correctly"
  1068. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1069. [ok = application:load(App) || App <- [$(APP)]], \
  1070. {ok, Deps} = application:get_key($(APP), applications), \
  1071. false = lists:member(recon, Deps), \
  1072. halt()"
  1073. $i "Build the release"
  1074. $t $(MAKE) -C $(APP) $v
  1075. $i "Check that all dependencies were fetched"
  1076. $t test -d $(APP)/deps/recon
  1077. $i "Check that the application was compiled correctly"
  1078. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1079. [ok = application:load(App) || App <- [$(APP), recon]], \
  1080. {ok, Deps} = application:get_key($(APP), applications), \
  1081. false = lists:member(recon, Deps), \
  1082. halt()"
  1083. # @todo Add check for MSYS2 when releases under Windows become usable.
  1084. # $i "Start the release and check that Recon is loaded"
  1085. ifeq ($(PLATFORM),msys2)
  1086. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  1087. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  1088. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  1089. # application loaded_applications | grep recon`"
  1090. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  1091. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  1092. else
  1093. $i "Start the release and check that Recon is loaded"
  1094. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  1095. $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release rpcterms \
  1096. application loaded_applications | grep recon`"
  1097. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  1098. endif
  1099. core-deps-search: build clean
  1100. $i "Bootstrap a new OTP library named $(APP)"
  1101. $t mkdir $(APP)/
  1102. $t cp ../erlang.mk $(APP)/
  1103. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1104. $i "Run 'make search' and check that it prints packages"
  1105. $t test -n "`$(MAKE) -C $(APP) search`"
  1106. $i "Run 'make search q=cowboy' and check that it prints packages"
  1107. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  1108. core-deps-shell: build clean
  1109. $i "Bootstrap a new OTP library named $(APP)"
  1110. $t mkdir $(APP)/
  1111. $t cp ../erlang.mk $(APP)/
  1112. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1113. $i "Add TDDReloader to the list of shell dependencies"
  1114. $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
  1115. $i "Build the application and its dependencies"
  1116. $t $(MAKE) -C $(APP) deps app $v
  1117. $i "Check that no dependencies were fetched"
  1118. $t test ! -e $(APP)/deps
  1119. $i "Check that the application was compiled correctly"
  1120. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1121. [ok = application:load(App) || App <- [$(APP)]], \
  1122. {ok, Deps} = application:get_key($(APP), applications), \
  1123. false = lists:member(tddreloader, Deps), \
  1124. halt()"
  1125. $i "Run the shell"
  1126. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  1127. ok = application:load($(APP)), \
  1128. ok = application:load(tddreloader), \
  1129. halt()\"" $v
  1130. $i "Check that all dependencies were fetched"
  1131. $t test -d $(APP)/deps/tddreloader
  1132. $i "Check that the application was compiled correctly"
  1133. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1134. [ok = application:load(App) || App <- [$(APP), tddreloader]], \
  1135. {ok, Deps} = application:get_key($(APP), applications), \
  1136. false = lists:member(tddreloader, Deps), \
  1137. halt()"
  1138. core-deps-skip: build clean
  1139. $i "Bootstrap a new OTP library named $(APP)"
  1140. $t mkdir $(APP)/
  1141. $t cp ../erlang.mk $(APP)/
  1142. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1143. $i "Add Cowboy to the list of dependencies"
  1144. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1145. ifdef LEGACY
  1146. $i "Add Cowboy to the applications key in the .app.src file"
  1147. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1148. endif
  1149. $i "Build the application with SKIP_DEPS=1"
  1150. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  1151. $i "Check that no dependencies were fetched"
  1152. $t test ! -e $(APP)/deps
  1153. $i "Build the application"
  1154. $t $(MAKE) -C $(APP) $v
  1155. $i "Check that all dependencies were fetched"
  1156. $t test -d $(APP)/deps/cowlib
  1157. $t test -d $(APP)/deps/cowboy
  1158. $t test -d $(APP)/deps/ranch
  1159. $i "Distclean with SKIP_DEPS=1"
  1160. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  1161. $i "Check that no dependencies were removed"
  1162. $t test -d $(APP)/deps/cowlib
  1163. $t test -d $(APP)/deps/cowboy
  1164. $t test -d $(APP)/deps/ranch
  1165. core-deps-test: build clean
  1166. $i "Bootstrap a new OTP library named $(APP)"
  1167. $t mkdir $(APP)/
  1168. $t cp ../erlang.mk $(APP)/
  1169. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1170. $i "Generate .erl files"
  1171. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1172. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1173. $i "Add triq to the list of test dependencies"
  1174. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  1175. $i "Build the application and its dependencies"
  1176. $t $(MAKE) -C $(APP) deps app $v
  1177. $i "Check that no dependencies were fetched"
  1178. $t test ! -e $(APP)/deps
  1179. $i "Check that the application was compiled correctly"
  1180. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1181. [ok = application:load(App) || App <- [$(APP)]], \
  1182. {ok, Deps} = application:get_key($(APP), applications), \
  1183. false = lists:member(triq, Deps), \
  1184. halt()"
  1185. $i "Run tests"
  1186. $t $(MAKE) -C $(APP) tests $v
  1187. $i "Check that all dependencies were fetched"
  1188. $t test -d $(APP)/deps/triq
  1189. $i "Check that the application was compiled correctly"
  1190. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1191. [ok = application:load(App) || App <- [$(APP), triq]], \
  1192. {ok, Deps} = application:get_key($(APP), applications), \
  1193. false = lists:member(triq, Deps), \
  1194. halt()"