core_deps.mk 53 KB

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