core_deps.mk 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544
  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 " @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. define add_dep_and_subdep
  755. $i "Bootstrap a new OTP library named $(APP)-$(1)subdep"
  756. $t mkdir $(APP)-$(1)subdep/
  757. $t cp ../erlang.mk $(APP)-$(1)subdep/
  758. $t $(MAKE) -C $(APP)-$(1)subdep --no-print-directory -f erlang.mk bootstrap-lib $$v
  759. $i "Create a Git repository for $(APP)-$(1)subdep"
  760. $t (cd $(APP)-$(1)subdep && \
  761. git init -q && \
  762. git config user.name "Testsuite" && \
  763. git config user.email "testsuite@erlang.mk" && \
  764. git add . && \
  765. git commit -q -m "Initial commit")
  766. $i "Bootstrap a new OTP library named $(APP)-$(1)dep"
  767. $t mkdir $(APP)-$(1)dep/
  768. $t cp ../erlang.mk $(APP)-$(1)dep/
  769. $t $(MAKE) -C $(APP)-$(1)dep --no-print-directory -f erlang.mk bootstrap-lib $$v
  770. $i "Add $(APP)-$(1)subdep as a dependency"
  771. $t perl -ni.bak -e \
  772. 'print;if ($$.==1) {print "DEPS = $(1)subdep\ndep_$(1)subdep = git file://$(abspath $(APP)-$(1)subdep) master\n"}' \
  773. $(APP)-$(1)dep/Makefile
  774. $t rm $(APP)-$(1)dep/Makefile.bak
  775. $i "Create a Git repository for $(APP)-$(1)dep"
  776. $t (cd $(APP)-$(1)dep && \
  777. git init -q && \
  778. git config user.name "Testsuite" && \
  779. git config user.email "testsuite@erlang.mk" && \
  780. git add . && \
  781. git commit -q -m "Initial commit")
  782. endef
  783. core-deps-list-deps: build clean
  784. $(call add_dep_and_subdep,)
  785. $(call add_dep_and_subdep,doc)
  786. $(call add_dep_and_subdep,rel)
  787. $(call add_dep_and_subdep,test)
  788. $(call add_dep_and_subdep,shell)
  789. $i "Bootstrap a new OTP library named $(APP)"
  790. $t mkdir $(APP)/
  791. $t cp ../erlang.mk $(APP)/
  792. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  793. $i "Add $(APP)-dep and $(APP)-testdep as a dependency"
  794. $t sed -i.bak '2i\
  795. DEPS = dep\
  796. DOC_DEPS = docdep\
  797. REL_DEPS = reldep\
  798. TEST_DEPS = testdep\
  799. SHELL_DEPS = shelldep\
  800. dep_dep = git file://$(abspath $(APP)-dep) master\
  801. dep_docdep = git file://$(abspath $(APP)-docdep) master\
  802. dep_reldep = git file://$(abspath $(APP)-reldep) master\
  803. dep_testdep = git file://$(abspath $(APP)-testdep) master\
  804. dep_shelldep = git file://$(abspath $(APP)-shelldep) master\
  805. ' $(APP)/Makefile
  806. $t rm $(APP)/Makefile.bak
  807. $i "Create a Git repository for $(APP)"
  808. $t (cd $(APP) && \
  809. git init -q && \
  810. git config user.name "Testsuite" && \
  811. git config user.email "testsuite@erlang.mk" && \
  812. git add . && \
  813. git commit -q -m "Initial commit")
  814. $i "List application dependencies"
  815. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  816. $t test -d $(APP)/deps/subdep
  817. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  818. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  819. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  820. $i "List application doc dependencies"
  821. $t $(MAKE) -C $(APP) --no-print-directory list-doc-deps $v
  822. $t test -d $(APP)/deps/subdep
  823. $t test -d $(APP)/deps/docsubdep
  824. $t printf "%s\n%s\n%s\n%s\n" \
  825. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/docdep $(APP)/deps/docsubdep) \
  826. | sort > $(APP)/expected-doc-deps.txt
  827. $t cmp $(APP)/expected-doc-deps.txt $(APP)/.erlang.mk/recursive-doc-deps-list.log
  828. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  829. $i "List application rel dependencies"
  830. $t $(MAKE) -C $(APP) --no-print-directory list-rel-deps $v
  831. $t test -d $(APP)/deps/subdep
  832. $t test -d $(APP)/deps/relsubdep
  833. $t printf "%s\n%s\n%s\n%s\n" \
  834. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/reldep $(APP)/deps/relsubdep) \
  835. | sort > $(APP)/expected-rel-deps.txt
  836. $t cmp $(APP)/expected-rel-deps.txt $(APP)/.erlang.mk/recursive-rel-deps-list.log
  837. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  838. $i "List application test dependencies"
  839. $t $(MAKE) -C $(APP) --no-print-directory list-test-deps $v
  840. $t test -d $(APP)/deps/subdep
  841. $t test -d $(APP)/deps/testsubdep
  842. $t printf "%s\n%s\n%s\n%s\n" \
  843. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/testdep $(APP)/deps/testsubdep) \
  844. | sort > $(APP)/expected-test-deps.txt
  845. $t cmp $(APP)/expected-test-deps.txt $(APP)/.erlang.mk/recursive-test-deps-list.log
  846. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  847. $i "List application shell dependencies"
  848. $t $(MAKE) -C $(APP) --no-print-directory list-shell-deps $v
  849. $t test -d $(APP)/deps/subdep
  850. $t test -d $(APP)/deps/shellsubdep
  851. $t printf "%s\n%s\n%s\n%s\n" \
  852. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  853. | sort > $(APP)/expected-shell-deps.txt
  854. $t cmp $(APP)/expected-shell-deps.txt $(APP)/.erlang.mk/recursive-shell-deps-list.log
  855. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  856. $i "List application all dependencies (all kinds)"
  857. $t $(MAKE) -C $(APP) --no-print-directory list-deps DEP_TYPES='doc rel test shell' $v
  858. $t test -d $(APP)/deps/subdep
  859. $t test -d $(APP)/deps/docsubdep
  860. $t test -d $(APP)/deps/relsubdep
  861. $t test -d $(APP)/deps/testsubdep
  862. $t test -d $(APP)/deps/shellsubdep
  863. $t printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
  864. $(abspath \
  865. $(APP)/deps/dep $(APP)/deps/subdep \
  866. $(APP)/deps/docdep $(APP)/deps/docsubdep \
  867. $(APP)/deps/reldep $(APP)/deps/relsubdep \
  868. $(APP)/deps/testdep $(APP)/deps/testsubdep \
  869. $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  870. | sort > $(APP)/expected-all-deps.txt
  871. $t cmp $(APP)/expected-all-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  872. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  873. core-deps-mv: build clean
  874. $i "Bootstrap a new OTP library named $(APP)"
  875. $t mkdir $(APP)/
  876. $t cp ../erlang.mk $(APP)/
  877. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  878. $i "Add Cowlib to the list of dependencies"
  879. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  880. $i "Build the application"
  881. $t $(MAKE) -C $(APP) $v
  882. $i "Check that all dependencies were fetched"
  883. $t test -d $(APP)/deps/cowlib
  884. $i "Move the application elsewhere"
  885. $t mv $(APP) $(APP)-moved
  886. $i "Build the application"
  887. $t $(MAKE) -C $(APP)-moved $v
  888. core-deps-mv-rebar: build clean
  889. $i "Bootstrap a new OTP library named $(APP)"
  890. $t mkdir $(APP)/
  891. $t cp ../erlang.mk $(APP)/
  892. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  893. $i "Add Lager to the list of dependencies"
  894. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  895. $i "Build the application"
  896. $t $(MAKE) -C $(APP) $v
  897. $i "Check that all dependencies were fetched"
  898. $t test -d $(APP)/deps/goldrush
  899. $t test -d $(APP)/deps/lager
  900. $i "Move the application elsewhere"
  901. $t mv $(APP) $(APP)-moved
  902. $i "Build the application"
  903. $t $(MAKE) -C $(APP)-moved $v
  904. # A lower-level dependency of the first dependency always
  905. # wins over a lower-level dependency of the second dependency.
  906. core-deps-order-first: build clean
  907. $i "Bootstrap a new OTP library named $(APP)"
  908. $t mkdir $(APP)/
  909. $t cp ../erlang.mk $(APP)/
  910. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  911. $i "Add Cowboy package and my_dep to the list of dependencies"
  912. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  913. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  914. $t mkdir $(APP)/my_dep
  915. $t cp ../erlang.mk $(APP)/my_dep/
  916. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  917. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  918. $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
  919. ifdef LEGACY
  920. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  921. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  922. endif
  923. $i "Build the application"
  924. $t $(MAKE) -C $(APP) $v
  925. $i "Check that all dependencies were fetched"
  926. $t test -d $(APP)/deps/cowboy
  927. $t test -d $(APP)/deps/cowlib
  928. $t test -d $(APP)/deps/my_dep
  929. $t test -d $(APP)/deps/ranch
  930. $i "Check that the application was compiled correctly"
  931. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  932. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  933. {ok, Deps} = application:get_key($(APP), applications), \
  934. true = lists:member(cowboy, Deps), \
  935. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  936. halt()"
  937. # A higher-level dependency always wins.
  938. core-deps-order-top: build clean
  939. $i "Bootstrap a new OTP library named $(APP)"
  940. $t mkdir $(APP)/
  941. $t cp ../erlang.mk $(APP)/
  942. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  943. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  944. $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
  945. ifdef LEGACY
  946. $i "Add Cowboy to the applications key in the .app.src file"
  947. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  948. endif
  949. $i "Build the application"
  950. $t $(MAKE) -C $(APP) $v
  951. $i "Check that all dependencies were fetched"
  952. $t test -d $(APP)/deps/cowboy
  953. $t test -d $(APP)/deps/cowlib
  954. $t test -d $(APP)/deps/ranch
  955. $i "Check that the application was compiled correctly"
  956. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  957. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  958. {ok, Deps} = application:get_key($(APP), applications), \
  959. true = lists:member(cowboy, Deps), \
  960. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  961. halt()"
  962. core-deps-no-autopatch: build clean
  963. $i "Bootstrap a new OTP library named $(APP)"
  964. $t mkdir $(APP)/
  965. $t cp ../erlang.mk $(APP)/
  966. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  967. $i "Add Cowboy to the list of dependencies and Cowlib to the NO_AUTOPATCH list"
  968. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nNO_AUTOPATCH = cowlib\n"}' $(APP)/Makefile
  969. $i "Build the application"
  970. $t $(MAKE) -C $(APP) $v
  971. $i "Check that all dependencies were fetched"
  972. $t test -d $(APP)/deps/cowboy
  973. $t test -d $(APP)/deps/cowlib
  974. $t test -d $(APP)/deps/ranch
  975. $i "Check that Cowlib was not autopatched"
  976. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  977. core-deps-no-autopatch-erlang-mk: build clean
  978. $i "Bootstrap a new OTP library named $(APP)"
  979. $t mkdir $(APP)/
  980. $t cp ../erlang.mk $(APP)/
  981. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  982. $i "Add Cowlib to the list of dependencies and set NO_AUTOPATCH_ERLANG_MK=1"
  983. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\nNO_AUTOPATCH_ERLANG_MK = 1\n"}' $(APP)/Makefile
  984. $i "Build the application"
  985. $t $(MAKE) -C $(APP) $v
  986. $i "Check that all dependencies were fetched"
  987. $t test -d $(APP)/deps/cowlib
  988. $i "Check that Erlang.mk was not autopatched"
  989. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  990. core-deps-no-autopatch-rebar: build clean
  991. $i "Bootstrap a new OTP library named $(APP)"
  992. $t mkdir $(APP)/
  993. $t cp ../erlang.mk $(APP)/
  994. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  995. $i "Add Lager to the list of dependencies and to the NO_AUTOPATCH list"
  996. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\nNO_AUTOPATCH = lager\n"}' $(APP)/Makefile
  997. $i "Build the application"
  998. $t $(MAKE) -C $(APP) $v
  999. $i "Check that all dependencies were fetched"
  1000. $t test -d $(APP)/deps/goldrush
  1001. $t test -d $(APP)/deps/lager
  1002. $i "Check that Lager was not autopatched"
  1003. $t if grep -q erlang\.mk $(APP)/deps/goldrush/Makefile; then false; fi
  1004. $t if grep -q erlang\.mk $(APP)/deps/lager/Makefile; then false; fi
  1005. ifndef LEGACY
  1006. core-deps-otp: build clean
  1007. $i "Bootstrap a new OTP library named $(APP)"
  1008. $t mkdir $(APP)/
  1009. $t cp ../erlang.mk $(APP)/
  1010. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1011. $i "Add Crypto to the list of OTP dependencies"
  1012. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  1013. $i "Build the application"
  1014. $t $(MAKE) -C $(APP) $v
  1015. $i "Check that no dependencies were fetched"
  1016. $t test ! -e $(APP)/deps
  1017. $i "Check that the application was compiled correctly"
  1018. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1019. [ok = application:load(App) || App <- [$(APP), crypto]], \
  1020. {ok, Deps} = application:get_key($(APP), applications), \
  1021. true = lists:member(crypto, Deps), \
  1022. halt()"
  1023. endif
  1024. core-deps-pkg: build clean
  1025. $i "Bootstrap a new OTP library named $(APP)"
  1026. $t mkdir $(APP)/
  1027. $t cp ../erlang.mk $(APP)/
  1028. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1029. $i "Add Cowboy to the list of dependencies"
  1030. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1031. ifdef LEGACY
  1032. $i "Add Cowboy to the applications key in the .app.src file"
  1033. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1034. endif
  1035. $i "Build the application"
  1036. $t $(MAKE) -C $(APP) $v
  1037. $i "Check that all dependencies were fetched"
  1038. $t test -d $(APP)/deps/cowboy
  1039. $t test -d $(APP)/deps/cowlib
  1040. $t test -d $(APP)/deps/ranch
  1041. $i "Check that the application was compiled correctly"
  1042. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1043. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  1044. {ok, Deps} = application:get_key($(APP), applications), \
  1045. true = lists:member(cowboy, Deps), \
  1046. halt()"
  1047. core-deps-rel: build clean
  1048. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  1049. $t mkdir $(APP)/
  1050. $t cp ../erlang.mk $(APP)/
  1051. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  1052. $i "Add Recon to the list of release dependencies"
  1053. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  1054. $i "Add Recon to the relx.config file"
  1055. $t $(ERL) -eval " \
  1056. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  1057. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  1058. ok = file:write_file(\"$(APP)/relx.config\", \
  1059. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  1060. halt()"
  1061. $i "Build the application and its dependencies"
  1062. $t $(MAKE) -C $(APP) deps app $v
  1063. $i "Check that no dependencies were fetched"
  1064. $t test ! -e $(APP)/deps
  1065. $i "Check that the application was compiled correctly"
  1066. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1067. [ok = application:load(App) || App <- [$(APP)]], \
  1068. {ok, Deps} = application:get_key($(APP), applications), \
  1069. false = lists:member(recon, Deps), \
  1070. halt()"
  1071. $i "Build the release"
  1072. $t $(MAKE) -C $(APP) $v
  1073. $i "Check that all dependencies were fetched"
  1074. $t test -d $(APP)/deps/recon
  1075. $i "Check that the application was compiled correctly"
  1076. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1077. [ok = application:load(App) || App <- [$(APP), recon]], \
  1078. {ok, Deps} = application:get_key($(APP), applications), \
  1079. false = lists:member(recon, Deps), \
  1080. halt()"
  1081. # @todo Add check for MSYS2 when releases under Windows become usable.
  1082. # $i "Start the release and check that Recon is loaded"
  1083. ifeq ($(PLATFORM),msys2)
  1084. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  1085. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  1086. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  1087. # application loaded_applications | grep recon`"
  1088. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  1089. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  1090. else
  1091. $i "Start the release and check that Recon is loaded"
  1092. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  1093. $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release rpcterms \
  1094. application loaded_applications | grep recon`"
  1095. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  1096. endif
  1097. core-deps-search: build clean
  1098. $i "Bootstrap a new OTP library named $(APP)"
  1099. $t mkdir $(APP)/
  1100. $t cp ../erlang.mk $(APP)/
  1101. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1102. $i "Run 'make search' and check that it prints packages"
  1103. $t test -n "`$(MAKE) -C $(APP) search`"
  1104. $i "Run 'make search q=cowboy' and check that it prints packages"
  1105. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  1106. core-deps-shell: build clean
  1107. $i "Bootstrap a new OTP library named $(APP)"
  1108. $t mkdir $(APP)/
  1109. $t cp ../erlang.mk $(APP)/
  1110. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1111. $i "Add TDDReloader to the list of shell dependencies"
  1112. $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
  1113. $i "Build the application and its dependencies"
  1114. $t $(MAKE) -C $(APP) deps app $v
  1115. $i "Check that no dependencies were fetched"
  1116. $t test ! -e $(APP)/deps
  1117. $i "Check that the application was compiled correctly"
  1118. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1119. [ok = application:load(App) || App <- [$(APP)]], \
  1120. {ok, Deps} = application:get_key($(APP), applications), \
  1121. false = lists:member(tddreloader, Deps), \
  1122. halt()"
  1123. $i "Run the shell"
  1124. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  1125. ok = application:load($(APP)), \
  1126. ok = application:load(tddreloader), \
  1127. halt()\"" $v
  1128. $i "Check that all dependencies were fetched"
  1129. $t test -d $(APP)/deps/tddreloader
  1130. $i "Check that the application was compiled correctly"
  1131. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1132. [ok = application:load(App) || App <- [$(APP), tddreloader]], \
  1133. {ok, Deps} = application:get_key($(APP), applications), \
  1134. false = lists:member(tddreloader, Deps), \
  1135. halt()"
  1136. core-deps-skip: build clean
  1137. $i "Bootstrap a new OTP library named $(APP)"
  1138. $t mkdir $(APP)/
  1139. $t cp ../erlang.mk $(APP)/
  1140. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1141. $i "Add Cowboy to the list of dependencies"
  1142. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1143. ifdef LEGACY
  1144. $i "Add Cowboy to the applications key in the .app.src file"
  1145. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1146. endif
  1147. $i "Build the application with SKIP_DEPS=1"
  1148. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  1149. $i "Check that no dependencies were fetched"
  1150. $t test ! -e $(APP)/deps
  1151. $i "Build the application"
  1152. $t $(MAKE) -C $(APP) $v
  1153. $i "Check that all dependencies were fetched"
  1154. $t test -d $(APP)/deps/cowlib
  1155. $t test -d $(APP)/deps/cowboy
  1156. $t test -d $(APP)/deps/ranch
  1157. $i "Distclean with SKIP_DEPS=1"
  1158. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  1159. $i "Check that no dependencies were removed"
  1160. $t test -d $(APP)/deps/cowlib
  1161. $t test -d $(APP)/deps/cowboy
  1162. $t test -d $(APP)/deps/ranch
  1163. core-deps-test: build clean
  1164. $i "Bootstrap a new OTP library named $(APP)"
  1165. $t mkdir $(APP)/
  1166. $t cp ../erlang.mk $(APP)/
  1167. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1168. $i "Generate .erl files"
  1169. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1170. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1171. $i "Add triq to the list of test dependencies"
  1172. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  1173. $i "Build the application and its dependencies"
  1174. $t $(MAKE) -C $(APP) deps app $v
  1175. $i "Check that no dependencies were fetched"
  1176. $t test ! -e $(APP)/deps
  1177. $i "Check that the application was compiled correctly"
  1178. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1179. [ok = application:load(App) || App <- [$(APP)]], \
  1180. {ok, Deps} = application:get_key($(APP), applications), \
  1181. false = lists:member(triq, Deps), \
  1182. halt()"
  1183. $i "Run tests"
  1184. $t $(MAKE) -C $(APP) tests $v
  1185. $i "Check that all dependencies were fetched"
  1186. $t test -d $(APP)/deps/triq
  1187. $i "Check that the application was compiled correctly"
  1188. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1189. [ok = application:load(App) || App <- [$(APP), triq]], \
  1190. {ok, Deps} = application:get_key($(APP), applications), \
  1191. false = lists:member(triq, Deps), \
  1192. halt()"