core_deps.mk 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409
  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 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 " @echo -n '#' >> 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 " @echo -n '#' >> 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=my_app t=gen_server n=my_server
  300. $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=supervisor n=my_sup
  301. # Here we disable warnings because templates contain missing behaviors.
  302. $i "Build the application"
  303. $t $(MAKE) -C $(APP)/apps/my_app ERLC_OPTS=+debug_info $v
  304. $i "Check that all compiled files exist"
  305. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  306. $t test -f $(APP)/apps/my_app/ebin/my_fsm.beam
  307. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  308. $t test -f $(APP)/apps/my_app/ebin/my_sup.beam
  309. $i "Check that all the modules can be loaded"
  310. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  311. ok = application:start(my_app), \
  312. {ok, Mods = [my_fsm, my_server, my_sup]} = application:get_key(my_app, modules), \
  313. [{module, M} = code:load_file(M) || M <- Mods], \
  314. halt()"
  315. core-deps-apps-only: build clean
  316. $i "Create a multi application repository with no root application"
  317. $t mkdir $(APP)/
  318. $t cp ../erlang.mk $(APP)/
  319. $t echo "include erlang.mk" > $(APP)/Makefile
  320. $i "Create a new application my_app"
  321. $t $(MAKE) -C $(APP) new-app in=my_app $v
  322. $i "Create a module my_server from gen_server template in my_app"
  323. $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
  324. $i "Add Cowlib to the list of dependencies"
  325. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/apps/my_app/Makefile
  326. $i "Build the application"
  327. $t $(MAKE) -C $(APP) $v
  328. $i "Check that all compiled files exist"
  329. $t test -f $(APP)/apps/my_app/my_app.d
  330. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  331. $t test -f $(APP)/apps/my_app/ebin/my_app_app.beam
  332. $t test -f $(APP)/apps/my_app/ebin/my_app_sup.beam
  333. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  334. $t test -d $(APP)/deps/cowlib/
  335. $i "Check that the application was compiled correctly"
  336. $t $(ERL) -pa $(APP)/apps/*/ebin/ -eval " \
  337. ok = application:load(my_app), \
  338. {ok, Mods = [my_app_app, my_app_sup, my_server]} = application:get_key(my_app, modules), \
  339. [{module, M} = code:load_file(M) || M <- Mods], \
  340. halt()"
  341. $i "Clean the application"
  342. $t $(MAKE) -C $(APP) clean $v
  343. $i "Check that Cowlib is still here"
  344. $t test -d $(APP)/deps/cowlib
  345. $i "Check that all relevant files were removed"
  346. $t test ! -e $(APP)/apps/my_app/my_app.d
  347. $t test ! -e $(APP)/apps/my_app/ebin/my_app.app
  348. $t test ! -e $(APP)/apps/my_app/ebin/my_app_app.beam
  349. $t test ! -e $(APP)/apps/my_app/ebin/my_app_sup.beam
  350. $t test ! -e $(APP)/apps/my_app/ebin/my_server.beam
  351. $i "Distclean the application"
  352. $t $(MAKE) -C $(APP) distclean $v
  353. $i "Check that all relevant files were removed"
  354. $t test ! -e $(APP)/deps
  355. core-deps-autopatch-rebar: build clean
  356. $i "Bootstrap a new OTP library named $(APP)"
  357. $t mkdir $(APP)/
  358. $t cp ../erlang.mk $(APP)/
  359. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  360. $i "Add erlsha2 to the list of dependencies"
  361. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = erlsha2\n"}' $(APP)/Makefile
  362. $i "Build the application"
  363. $t $(MAKE) -C $(APP) $v
  364. $i "Check that erlsha2 was fetched and built"
  365. $t test -d $(APP)/deps/erlsha2
  366. $t test -f $(APP)/deps/erlsha2/ebin/erlsha2.beam
  367. ifneq ($(PLATFORM),msys2)
  368. $t test -f $(APP)/deps/erlsha2/priv/erlsha2_nif.so
  369. endif
  370. ifneq ($(PLATFORM),msys2)
  371. core-deps-build-c-8cc: build clean
  372. $i "Bootstrap a new OTP library named $(APP)"
  373. $t mkdir $(APP)/
  374. $t cp ../erlang.mk $(APP)/
  375. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  376. $i "Add 8cc to the list of build dependencies"
  377. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = 8cc\ndep_8cc = git https://github.com/rui314/8cc master\n"}' $(APP)/Makefile
  378. $i "Build the application"
  379. $t $(MAKE) -C $(APP) $v
  380. $i "Check that all dependencies were fetched"
  381. $t test -d $(APP)/deps/8cc
  382. $i "Check that 8cc can be started"
  383. $t $(APP)/deps/8cc/8cc -h $v
  384. $i "Check that the application was compiled correctly"
  385. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  386. [ok = application:load(App) || App <- [$(APP)]], \
  387. {ok, Deps} = application:get_key($(APP), applications), \
  388. false = lists:member('8cc', Deps), \
  389. halt()"
  390. endif
  391. ifneq ($(PLATFORM),freebsd)
  392. core-deps-build-c-imagejs: build clean
  393. $i "Bootstrap a new OTP library named $(APP)"
  394. $t mkdir $(APP)/
  395. $t cp ../erlang.mk $(APP)/
  396. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  397. $i "Add imagejs to the list of build dependencies"
  398. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = imagejs\ndep_imagejs = git https://github.com/jklmnn/imagejs master\n"}' $(APP)/Makefile
  399. $i "Build the application"
  400. $t $(MAKE) -C $(APP) $v
  401. $i "Check that all dependencies were fetched"
  402. $t test -d $(APP)/deps/imagejs
  403. $i "Check that imagejs works"
  404. $t $(APP)/deps/imagejs/imagejs bmp $(APP)/deps/imagejs/Makefile
  405. $t test -f $(APP)/deps/imagejs/Makefile.bmp
  406. $i "Check that the application was compiled correctly"
  407. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  408. [ok = application:load(App) || App <- [$(APP)]], \
  409. {ok, Deps} = application:get_key($(APP), applications), \
  410. false = lists:member(imagejs, Deps), \
  411. halt()"
  412. endif
  413. core-deps-build-erl: build clean
  414. $i "Bootstrap a new OTP library named $(APP)"
  415. $t mkdir $(APP)/
  416. $t cp ../erlang.mk $(APP)/
  417. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  418. $i "Add cowlib to the list of build dependencies"
  419. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = cowlib\n"}' $(APP)/Makefile
  420. $i "Build the application"
  421. $t $(MAKE) -C $(APP) $v
  422. $i "Check that all dependencies were fetched"
  423. $t test -d $(APP)/deps/cowlib
  424. $i "Check that the application was compiled correctly"
  425. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  426. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  427. {ok, Deps} = application:get_key($(APP), applications), \
  428. false = lists:member(cowlib, Deps), \
  429. halt()"
  430. core-deps-build-js: build clean
  431. $i "Bootstrap a new OTP library named $(APP)"
  432. $t mkdir $(APP)/
  433. $t cp ../erlang.mk $(APP)/
  434. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  435. $i "Add jquery to the list of build dependencies"
  436. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = jquery\ndep_jquery = git https://github.com/jquery/jquery master\n"}' $(APP)/Makefile
  437. $i "Build the application"
  438. $t $(MAKE) -C $(APP) $v
  439. $i "Check that all dependencies were fetched"
  440. $t test -d $(APP)/deps/jquery
  441. $i "Check that the application was compiled correctly"
  442. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  443. [ok = application:load(App) || App <- [$(APP)]], \
  444. {ok, Deps} = application:get_key($(APP), applications), \
  445. false = lists:member(jquery, Deps), \
  446. halt()"
  447. core-deps-dep-commit: build clean
  448. $i "Bootstrap a new OTP library named $(APP)"
  449. $t mkdir $(APP)/
  450. $t cp ../erlang.mk $(APP)/
  451. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  452. $i "Add Cowboy 1.0.0 to the list of dependencies"
  453. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
  454. ifdef LEGACY
  455. $i "Add Cowboy to the applications key in the .app.src file"
  456. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  457. endif
  458. $i "Build the application"
  459. $t $(MAKE) -C $(APP) $v
  460. $i "Check that all dependencies were fetched"
  461. $t test -d $(APP)/deps/cowboy
  462. $t test -d $(APP)/deps/cowlib
  463. $t test -d $(APP)/deps/ranch
  464. $i "Check that the application was compiled correctly"
  465. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  466. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  467. {ok, Deps} = application:get_key($(APP), applications), \
  468. true = lists:member(cowboy, Deps), \
  469. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  470. halt()"
  471. core-deps-dir: build clean
  472. $i "Bootstrap a new OTP library named $(APP)"
  473. $t mkdir $(APP)/
  474. $t cp ../erlang.mk $(APP)/
  475. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  476. $i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
  477. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  478. ifdef LEGACY
  479. $i "Add Cowboy to the applications key in the .app.src file"
  480. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  481. endif
  482. $i "Build the application"
  483. $t $(MAKE) -C $(APP) $v
  484. $i "Check that all dependencies were fetched in the custom DEPS_DIR"
  485. $t test -d $(APP)/deep/libs/cowboy
  486. $t test -d $(APP)/deep/libs/cowlib
  487. $t test -d $(APP)/deep/libs/ranch
  488. $i "Check that the application was compiled correctly"
  489. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  490. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  491. {ok, Deps} = application:get_key($(APP), applications), \
  492. true = lists:member(cowboy, Deps), \
  493. halt()"
  494. core-deps-doc: build clean
  495. $i "Bootstrap a new OTP library named $(APP)"
  496. $t mkdir $(APP)/
  497. $t cp ../erlang.mk $(APP)/
  498. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  499. $i "Generate .erl files"
  500. $t echo "-module(boy)." > $(APP)/src/boy.erl
  501. $t echo "-module(girl)." > $(APP)/src/girl.erl
  502. $i "Add Edown as a documentation building dependency"
  503. $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
  504. $i "Build the application"
  505. $t $(MAKE) -C $(APP) $v
  506. $i "Check that no dependencies were fetched"
  507. $t test ! -e $(APP)/deps
  508. $i "Check that the application was compiled correctly"
  509. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  510. [ok = application:load(App) || App <- [$(APP)]], \
  511. {ok, Deps} = application:get_key($(APP), applications), \
  512. false = lists:member(edown, Deps), \
  513. halt()"
  514. $i "Build the application documentation"
  515. $t $(MAKE) -C $(APP) edoc $v
  516. $i "Check that documentation dependencies were fetched"
  517. $t test -d $(APP)/deps/edown
  518. $i "Check the Edown generated Markdown documentation"
  519. $t test -f $(APP)/doc/boy.md
  520. $t test -f $(APP)/doc/girl.md
  521. core-deps-fetch-cp: build clean
  522. $i "Bootstrap a new OTP library named $(APP)"
  523. $t mkdir $(APP)/
  524. $t cp ../erlang.mk $(APP)/
  525. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  526. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  527. $t mkdir $(APP)/my_dep
  528. $t cp ../erlang.mk $(APP)/my_dep/
  529. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  530. $i "Add my_dep to the list of dependencies"
  531. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  532. ifdef LEGACY
  533. $i "Add my_dep to the applications key in the .app.src file"
  534. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  535. endif
  536. $i "Build the application"
  537. $t $(MAKE) -C $(APP) $v
  538. $i "Check that all dependencies were fetched"
  539. $t test -d $(APP)/deps/my_dep
  540. $i "Check that the application was compiled correctly"
  541. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  542. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  543. {ok, Deps} = application:get_key($(APP), applications), \
  544. true = lists:member(my_dep, Deps), \
  545. halt()"
  546. core-deps-fetch-custom: build clean
  547. $i "Bootstrap a new OTP library named $(APP)"
  548. $t mkdir $(APP)/
  549. $t cp ../erlang.mk $(APP)/
  550. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  551. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  552. $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
  553. ifdef LEGACY
  554. $i "Add boop to the applications key in the .app.src file"
  555. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
  556. endif
  557. $i "Build the application"
  558. $t $(MAKE) -C $(APP) $v
  559. $i "Check that all dependencies were fetched"
  560. $t test -d $(APP)/deps/boop
  561. $i "Check that the application was compiled correctly"
  562. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  563. ok = application:load($(APP)), \
  564. {ok, Deps} = application:get_key($(APP), applications), \
  565. true = lists:member(boop, Deps), \
  566. halt()"
  567. core-deps-fetch-fail-bad: build clean
  568. $i "Bootstrap a new OTP library named $(APP)"
  569. $t mkdir $(APP)/
  570. $t cp ../erlang.mk $(APP)/
  571. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  572. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  573. $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
  574. $i "Check that building the application fails"
  575. $t ! $(MAKE) -C $(APP) $v
  576. core-deps-fetch-fail-unknown: build clean
  577. $i "Bootstrap a new OTP library named $(APP)"
  578. $t mkdir $(APP)/
  579. $t cp ../erlang.mk $(APP)/
  580. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  581. $i "Add an unknown application as a dependency"
  582. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
  583. $i "Check that building the application fails"
  584. $t ! $(MAKE) -C $(APP) $v
  585. core-deps-fetch-git: build clean
  586. $i "Bootstrap a new OTP library named $(APP)"
  587. $t mkdir $(APP)/
  588. $t cp ../erlang.mk $(APP)/
  589. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  590. $i "Add Cowboy 1.0.0 to the list of dependencies"
  591. $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
  592. ifdef LEGACY
  593. $i "Add Cowboy to the applications key in the .app.src file"
  594. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  595. endif
  596. $i "Build the application"
  597. $t $(MAKE) -C $(APP) $v
  598. $i "Check that all dependencies were fetched"
  599. $t test -d $(APP)/deps/cowboy
  600. $t test -d $(APP)/deps/cowlib
  601. $t test -d $(APP)/deps/ranch
  602. $i "Check that the application was compiled correctly"
  603. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  604. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  605. {ok, Deps} = application:get_key($(APP), applications), \
  606. true = lists:member(cowboy, Deps), \
  607. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  608. halt()"
  609. core-deps-fetch-git-submodule: build clean
  610. $i "Bootstrap a new OTP library named $(APP)"
  611. $t mkdir $(APP)/
  612. $t cp ../erlang.mk $(APP)/
  613. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  614. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  615. $t mkdir $(APP)/my_dep
  616. $t cp ../erlang.mk $(APP)/my_dep/
  617. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  618. # Create an empty file so src/ gets committed.
  619. $t touch $(APP)/my_dep/src/README
  620. $t cd $(APP)/my_dep && \
  621. git init -q && \
  622. git config user.email "testsuite@erlang.mk" && \
  623. git config user.name "test suite" && \
  624. git add . && \
  625. git commit -q -m "Tests"
  626. $i "Add the submodule to my_dep"
  627. $t mkdir $(APP)/deps
  628. $t cd $(APP) && \
  629. git init -q && \
  630. git submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
  631. git config user.email "testsuite@erlang.mk" && \
  632. git config user.name "test suite" && \
  633. git add . && \
  634. git commit -q -m "Tests"
  635. $i "Distclean the application"
  636. $t $(MAKE) -C $(APP) distclean $v
  637. $i "Add my_dep to the list of dependencies"
  638. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-submodule\n"}' $(APP)/Makefile
  639. ifdef LEGACY
  640. $i "Add my_dep to the applications key in the .app.src file"
  641. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  642. endif
  643. $i "Build the application"
  644. $t $(MAKE) -C $(APP) $v
  645. $i "Check that all dependencies were fetched"
  646. $t test -d $(APP)/deps/my_dep
  647. $i "Check that the application was compiled correctly"
  648. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  649. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  650. {ok, Deps} = application:get_key($(APP), applications), \
  651. true = lists:member(my_dep, Deps), \
  652. halt()"
  653. core-deps-fetch-hex: build clean
  654. $i "Bootstrap a new OTP library named $(APP)"
  655. $t mkdir $(APP)/
  656. $t cp ../erlang.mk $(APP)/
  657. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  658. $i "Add Cowboy 1.0.0 to the list of dependencies"
  659. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
  660. ifdef LEGACY
  661. $i "Add Cowboy to the applications key in the .app.src file"
  662. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  663. endif
  664. $i "Build the application"
  665. $t $(MAKE) -C $(APP) $v
  666. $i "Check that all dependencies were fetched"
  667. $t test -d $(APP)/deps/cowboy
  668. $t test -d $(APP)/deps/cowlib
  669. $t test -d $(APP)/deps/ranch
  670. $i "Check that the application was compiled correctly"
  671. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  672. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  673. {ok, Deps} = application:get_key($(APP), applications), \
  674. true = lists:member(cowboy, Deps), \
  675. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  676. halt()"
  677. core-deps-fetch-hg: build clean
  678. $i "Bootstrap a new OTP library named $(APP)"
  679. $t mkdir $(APP)/
  680. $t cp ../erlang.mk $(APP)/
  681. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  682. $i "Add Ehsa 4.0.3 to the list of dependencies"
  683. $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
  684. ifdef LEGACY
  685. $i "Add ehsa to the applications key in the .app.src file"
  686. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
  687. endif
  688. $i "Build the application"
  689. $t $(MAKE) -C $(APP) $v
  690. $i "Check that all dependencies were fetched"
  691. $t test -d $(APP)/deps/ehsa
  692. $i "Check that the application was compiled correctly"
  693. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  694. [ok = application:load(App) || App <- [$(APP), ehsa]], \
  695. {ok, Deps} = application:get_key($(APP), applications), \
  696. true = lists:member(ehsa, Deps), \
  697. {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  698. halt()"
  699. # Legacy must fail for the top-level application, but work for dependencies.
  700. core-deps-fetch-legacy: build clean
  701. $i "Bootstrap a new OTP library named $(APP)"
  702. $t mkdir $(APP)/
  703. $t cp ../erlang.mk $(APP)/
  704. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  705. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  706. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  707. $i "Check that building the application fails"
  708. $t ! $(MAKE) -C $(APP) $v
  709. $i "Check that building the application works with IS_DEP=1"
  710. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  711. core-deps-fetch-svn: build clean
  712. $i "Bootstrap a new OTP library named $(APP)"
  713. $t mkdir $(APP)/
  714. $t cp ../erlang.mk $(APP)/
  715. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  716. $i "Add Cowlib 1.0.0 to the list of dependencies"
  717. $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
  718. ifdef LEGACY
  719. $i "Add Cowlib to the applications key in the .app.src file"
  720. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  721. endif
  722. $i "Build the application"
  723. $t $(MAKE) -C $(APP) $v
  724. $i "Check that all dependencies were fetched"
  725. $t test -d $(APP)/deps/cowlib
  726. $i "Check that the application was compiled correctly"
  727. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  728. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  729. {ok, Deps} = application:get_key($(APP), applications), \
  730. true = lists:member(cowlib, Deps), \
  731. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  732. halt()"
  733. core-deps-ignore: build clean
  734. $i "Bootstrap a new OTP library named $(APP)"
  735. $t mkdir $(APP)/
  736. $t cp ../erlang.mk $(APP)/
  737. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  738. $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  739. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  740. ifdef LEGACY
  741. $i "Add Cowboy to the applications key in the .app.src file"
  742. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  743. endif
  744. $i "Build the application"
  745. $t $(MAKE) -C $(APP) $v
  746. $i "Check that the correct dependencies were fetched"
  747. $t test -d $(APP)/deps/cowboy
  748. $t test -d $(APP)/deps/cowlib
  749. $t test ! -e $(APP)/deps/ranch
  750. $i "Build the test dependencies"
  751. $t $(MAKE) -C $(APP) test-deps $v
  752. $i "Check that the correct dependencies were fetched"
  753. $t test -d $(APP)/deps/ranch
  754. core-deps-mv: build clean
  755. $i "Bootstrap a new OTP library named $(APP)"
  756. $t mkdir $(APP)/
  757. $t cp ../erlang.mk $(APP)/
  758. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  759. $i "Add Cowlib to the list of dependencies"
  760. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  761. $i "Build the application"
  762. $t $(MAKE) -C $(APP) $v
  763. $i "Check that all dependencies were fetched"
  764. $t test -d $(APP)/deps/cowlib
  765. $i "Move the application elsewhere"
  766. $t mv $(APP) $(APP)-moved
  767. $i "Build the application"
  768. $t $(MAKE) -C $(APP)-moved $v
  769. core-deps-mv-rebar: build clean
  770. $i "Bootstrap a new OTP library named $(APP)"
  771. $t mkdir $(APP)/
  772. $t cp ../erlang.mk $(APP)/
  773. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  774. $i "Add Lager to the list of dependencies"
  775. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  776. $i "Build the application"
  777. $t $(MAKE) -C $(APP) $v
  778. $i "Check that all dependencies were fetched"
  779. $t test -d $(APP)/deps/goldrush
  780. $t test -d $(APP)/deps/lager
  781. $i "Move the application elsewhere"
  782. $t mv $(APP) $(APP)-moved
  783. $i "Build the application"
  784. $t $(MAKE) -C $(APP)-moved $v
  785. # A lower-level dependency of the first dependency always
  786. # wins over a lower-level dependency of the second dependency.
  787. core-deps-order-first: build clean
  788. $i "Bootstrap a new OTP library named $(APP)"
  789. $t mkdir $(APP)/
  790. $t cp ../erlang.mk $(APP)/
  791. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  792. $i "Add Cowboy package and my_dep to the list of dependencies"
  793. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  794. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  795. $t mkdir $(APP)/my_dep
  796. $t cp ../erlang.mk $(APP)/my_dep/
  797. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  798. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  799. $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
  800. ifdef LEGACY
  801. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  802. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  803. endif
  804. $i "Build the application"
  805. $t $(MAKE) -C $(APP) $v
  806. $i "Check that all dependencies were fetched"
  807. $t test -d $(APP)/deps/cowboy
  808. $t test -d $(APP)/deps/cowlib
  809. $t test -d $(APP)/deps/my_dep
  810. $t test -d $(APP)/deps/ranch
  811. $i "Check that the application was compiled correctly"
  812. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  813. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  814. {ok, Deps} = application:get_key($(APP), applications), \
  815. true = lists:member(cowboy, Deps), \
  816. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  817. halt()"
  818. # A higher-level dependency always wins.
  819. core-deps-order-top: build clean
  820. $i "Bootstrap a new OTP library named $(APP)"
  821. $t mkdir $(APP)/
  822. $t cp ../erlang.mk $(APP)/
  823. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  824. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  825. $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
  826. ifdef LEGACY
  827. $i "Add Cowboy to the applications key in the .app.src file"
  828. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  829. endif
  830. $i "Build the application"
  831. $t $(MAKE) -C $(APP) $v
  832. $i "Check that all dependencies were fetched"
  833. $t test -d $(APP)/deps/cowboy
  834. $t test -d $(APP)/deps/cowlib
  835. $t test -d $(APP)/deps/ranch
  836. $i "Check that the application was compiled correctly"
  837. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  838. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  839. {ok, Deps} = application:get_key($(APP), applications), \
  840. true = lists:member(cowboy, Deps), \
  841. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  842. halt()"
  843. core-deps-no-autopatch: build clean
  844. $i "Bootstrap a new OTP library named $(APP)"
  845. $t mkdir $(APP)/
  846. $t cp ../erlang.mk $(APP)/
  847. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  848. $i "Add Cowboy to the list of dependencies and Cowlib to the NO_AUTOPATCH list"
  849. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nNO_AUTOPATCH = cowlib\n"}' $(APP)/Makefile
  850. $i "Build the application"
  851. $t $(MAKE) -C $(APP) $v
  852. $i "Check that all dependencies were fetched"
  853. $t test -d $(APP)/deps/cowboy
  854. $t test -d $(APP)/deps/cowlib
  855. $t test -d $(APP)/deps/ranch
  856. $i "Check that Cowlib was not autopatched"
  857. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  858. core-deps-no-autopatch-erlang-mk: build clean
  859. $i "Bootstrap a new OTP library named $(APP)"
  860. $t mkdir $(APP)/
  861. $t cp ../erlang.mk $(APP)/
  862. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  863. $i "Add Cowlib to the list of dependencies and set NO_AUTOPATCH_ERLANG_MK=1"
  864. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\nNO_AUTOPATCH_ERLANG_MK = 1\n"}' $(APP)/Makefile
  865. $i "Build the application"
  866. $t $(MAKE) -C $(APP) $v
  867. $i "Check that all dependencies were fetched"
  868. $t test -d $(APP)/deps/cowlib
  869. $i "Check that Erlang.mk was not autopatched"
  870. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  871. core-deps-no-autopatch-rebar: build clean
  872. $i "Bootstrap a new OTP library named $(APP)"
  873. $t mkdir $(APP)/
  874. $t cp ../erlang.mk $(APP)/
  875. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  876. $i "Add Lager to the list of dependencies and to the NO_AUTOPATCH list"
  877. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\nNO_AUTOPATCH = lager\n"}' $(APP)/Makefile
  878. $i "Build the application"
  879. $t $(MAKE) -C $(APP) $v
  880. $i "Check that all dependencies were fetched"
  881. $t test -d $(APP)/deps/goldrush
  882. $t test -d $(APP)/deps/lager
  883. $i "Check that Lager was not autopatched"
  884. $t if grep -q erlang\.mk $(APP)/deps/goldrush/Makefile; then false; fi
  885. $t if grep -q erlang\.mk $(APP)/deps/lager/Makefile; then false; fi
  886. ifndef LEGACY
  887. core-deps-otp: build clean
  888. $i "Bootstrap a new OTP library named $(APP)"
  889. $t mkdir $(APP)/
  890. $t cp ../erlang.mk $(APP)/
  891. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  892. $i "Add Crypto to the list of OTP dependencies"
  893. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  894. $i "Build the application"
  895. $t $(MAKE) -C $(APP) $v
  896. $i "Check that no dependencies were fetched"
  897. $t test ! -e $(APP)/deps
  898. $i "Check that the application was compiled correctly"
  899. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  900. [ok = application:load(App) || App <- [$(APP), crypto]], \
  901. {ok, Deps} = application:get_key($(APP), applications), \
  902. true = lists:member(crypto, Deps), \
  903. halt()"
  904. endif
  905. core-deps-pkg: build clean
  906. $i "Bootstrap a new OTP library named $(APP)"
  907. $t mkdir $(APP)/
  908. $t cp ../erlang.mk $(APP)/
  909. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  910. $i "Add Cowboy to the list of dependencies"
  911. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  912. ifdef LEGACY
  913. $i "Add Cowboy to the applications key in the .app.src file"
  914. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  915. endif
  916. $i "Build the application"
  917. $t $(MAKE) -C $(APP) $v
  918. $i "Check that all dependencies were fetched"
  919. $t test -d $(APP)/deps/cowboy
  920. $t test -d $(APP)/deps/cowlib
  921. $t test -d $(APP)/deps/ranch
  922. $i "Check that the application was compiled correctly"
  923. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  924. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  925. {ok, Deps} = application:get_key($(APP), applications), \
  926. true = lists:member(cowboy, Deps), \
  927. halt()"
  928. core-deps-rel: build clean
  929. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  930. $t mkdir $(APP)/
  931. $t cp ../erlang.mk $(APP)/
  932. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  933. $i "Add Recon to the list of release dependencies"
  934. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  935. $i "Add Recon to the relx.config file"
  936. $t $(ERL) -eval " \
  937. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  938. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  939. ok = file:write_file(\"$(APP)/relx.config\", \
  940. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  941. halt()"
  942. $i "Build the application and its dependencies"
  943. $t $(MAKE) -C $(APP) deps app $v
  944. $i "Check that no dependencies were fetched"
  945. $t test ! -e $(APP)/deps
  946. $i "Check that the application was compiled correctly"
  947. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  948. [ok = application:load(App) || App <- [$(APP)]], \
  949. {ok, Deps} = application:get_key($(APP), applications), \
  950. false = lists:member(recon, Deps), \
  951. halt()"
  952. $i "Build the release"
  953. $t $(MAKE) -C $(APP) $v
  954. $i "Check that all dependencies were fetched"
  955. $t test -d $(APP)/deps/recon
  956. $i "Check that the application was compiled correctly"
  957. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  958. [ok = application:load(App) || App <- [$(APP), recon]], \
  959. {ok, Deps} = application:get_key($(APP), applications), \
  960. false = lists:member(recon, Deps), \
  961. halt()"
  962. # @todo Add check for MSYS2 when releases under Windows become usable.
  963. # $i "Start the release and check that Recon is loaded"
  964. ifeq ($(PLATFORM),msys2)
  965. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  966. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  967. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  968. # application loaded_applications | grep recon`"
  969. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  970. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  971. else
  972. $i "Start the release and check that Recon is loaded"
  973. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  974. $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release rpcterms \
  975. application loaded_applications | grep recon`"
  976. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  977. endif
  978. core-deps-search: build clean
  979. $i "Bootstrap a new OTP library named $(APP)"
  980. $t mkdir $(APP)/
  981. $t cp ../erlang.mk $(APP)/
  982. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  983. $i "Run 'make search' and check that it prints packages"
  984. $t test -n "`$(MAKE) -C $(APP) search`"
  985. $i "Run 'make search q=cowboy' and check that it prints packages"
  986. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  987. core-deps-shell: build clean
  988. $i "Bootstrap a new OTP library named $(APP)"
  989. $t mkdir $(APP)/
  990. $t cp ../erlang.mk $(APP)/
  991. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  992. $i "Add TDDReloader to the list of shell dependencies"
  993. $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
  994. $i "Build the application and its dependencies"
  995. $t $(MAKE) -C $(APP) deps app $v
  996. $i "Check that no dependencies were fetched"
  997. $t test ! -e $(APP)/deps
  998. $i "Check that the application was compiled correctly"
  999. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1000. [ok = application:load(App) || App <- [$(APP)]], \
  1001. {ok, Deps} = application:get_key($(APP), applications), \
  1002. false = lists:member(tddreloader, Deps), \
  1003. halt()"
  1004. $i "Run the shell"
  1005. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  1006. ok = application:load($(APP)), \
  1007. ok = application:load(tddreloader), \
  1008. halt()\"" $v
  1009. $i "Check that all dependencies were fetched"
  1010. $t test -d $(APP)/deps/tddreloader
  1011. $i "Check that the application was compiled correctly"
  1012. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1013. [ok = application:load(App) || App <- [$(APP), tddreloader]], \
  1014. {ok, Deps} = application:get_key($(APP), applications), \
  1015. false = lists:member(tddreloader, Deps), \
  1016. halt()"
  1017. core-deps-skip: build clean
  1018. $i "Bootstrap a new OTP library named $(APP)"
  1019. $t mkdir $(APP)/
  1020. $t cp ../erlang.mk $(APP)/
  1021. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1022. $i "Add Cowboy to the list of dependencies"
  1023. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1024. ifdef LEGACY
  1025. $i "Add Cowboy to the applications key in the .app.src file"
  1026. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1027. endif
  1028. $i "Build the application with SKIP_DEPS=1"
  1029. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  1030. $i "Check that no dependencies were fetched"
  1031. $t test ! -e $(APP)/deps
  1032. $i "Build the application"
  1033. $t $(MAKE) -C $(APP) $v
  1034. $i "Check that all dependencies were fetched"
  1035. $t test -d $(APP)/deps/cowlib
  1036. $t test -d $(APP)/deps/cowboy
  1037. $t test -d $(APP)/deps/ranch
  1038. $i "Distclean with SKIP_DEPS=1"
  1039. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  1040. $i "Check that no dependencies were removed"
  1041. $t test -d $(APP)/deps/cowlib
  1042. $t test -d $(APP)/deps/cowboy
  1043. $t test -d $(APP)/deps/ranch
  1044. core-deps-test: build clean
  1045. $i "Bootstrap a new OTP library named $(APP)"
  1046. $t mkdir $(APP)/
  1047. $t cp ../erlang.mk $(APP)/
  1048. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1049. $i "Generate .erl files"
  1050. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1051. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1052. $i "Add triq to the list of test dependencies"
  1053. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  1054. $i "Build the application and its dependencies"
  1055. $t $(MAKE) -C $(APP) deps app $v
  1056. $i "Check that no dependencies were fetched"
  1057. $t test ! -e $(APP)/deps
  1058. $i "Check that the application was compiled correctly"
  1059. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1060. [ok = application:load(App) || App <- [$(APP)]], \
  1061. {ok, Deps} = application:get_key($(APP), applications), \
  1062. false = lists:member(triq, Deps), \
  1063. halt()"
  1064. $i "Run tests"
  1065. $t $(MAKE) -C $(APP) tests $v
  1066. $i "Check that all dependencies were fetched"
  1067. $t test -d $(APP)/deps/triq
  1068. $i "Check that the application was compiled correctly"
  1069. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1070. [ok = application:load(App) || App <- [$(APP), triq]], \
  1071. {ok, Deps} = application:get_key($(APP), applications), \
  1072. false = lists:member(triq, Deps), \
  1073. halt()"