core_app.mk 92 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848
  1. # Core: Building applications.
  2. CORE_APP_TARGETS = $(call list_targets,core-app)
  3. .PHONY: core-app $(CORE_APP_TARGETS)
  4. core-app: $(CORE_APP_TARGETS)
  5. ifdef LEGACY
  6. core-app-appsrc-change: init
  7. $i "Bootstrap a new OTP application named $(APP)"
  8. $t mkdir $(APP)/
  9. $t cp ../erlang.mk $(APP)/
  10. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  11. $i "Build the application"
  12. $t $(MAKE) -C $(APP) $v
  13. $i "Touch the .app.src file; check that only the .app file gets rebuilt"
  14. $t printf "%s\n" $(APP)/ebin/$(APP).app > $(APP)/EXPECT
  15. $t $(SLEEP)
  16. $t touch $(APP)/src/$(APP).app.src
  17. $t $(SLEEP)
  18. $t $(MAKE) -C $(APP) $v
  19. $t find $(APP) -type f -newer $(APP)/src/$(APP).app.src | sort | diff $(APP)/EXPECT -
  20. $t rm $(APP)/EXPECT
  21. endif
  22. core-app-appup: init
  23. $i "Bootstrap a new OTP library named $(APP)"
  24. $t mkdir $(APP)/
  25. $t cp ../erlang.mk $(APP)/
  26. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  27. $i "Generate a .appup file"
  28. $t touch $(APP)/src/$(APP).appup
  29. $i "Build the application"
  30. $t $(MAKE) -C $(APP) $v
  31. $i "Check that the appup file was copied into ebin/"
  32. $t test -f $(APP)/ebin/$(APP).appup
  33. $i "Clean the application"
  34. $t $(MAKE) -C $(APP) clean $v
  35. $i "Check that the source file still exists"
  36. $t test -f $(APP)/src/$(APP).appup
  37. $i "Check that the file copied into ebin/ was removed"
  38. $t test ! -e $(APP)/ebin/$(APP).appup
  39. core-app-asn1: init
  40. $i "Bootstrap a new OTP library named $(APP)"
  41. $t mkdir $(APP)/
  42. $t cp ../erlang.mk $(APP)/
  43. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  44. $i "Download .asn1 files from Erlang/OTP"
  45. $t mkdir $(APP)/asn1/
  46. $t curl -s -o $(APP)/asn1/CAP.asn1 $(OTP_MASTER)/lib/asn1/test/asn1_SUITE_data/CAP.asn1
  47. $t curl -s -o $(APP)/asn1/Def.asn1 $(OTP_MASTER)/lib/asn1/test/asn1_SUITE_data/Def.asn1
  48. $i "Generate .erl files dependent from headers generated by .asn1 files"
  49. $t printf "%s\n" "-module(use_cap)." "-include(\"CAP.hrl\")." > $(APP)/src/use_cap.erl
  50. $t printf "%s\n" "-module(use_def)." "-include(\"Def.hrl\")." > $(APP)/src/use_def.erl
  51. $i "Generate an unrelated .hrl file"
  52. $t mkdir $(APP)/include/
  53. $t touch $(APP)/include/unrelated.hrl
  54. $i "Build the application"
  55. $t $(MAKE) -C $(APP) $v
  56. $i "Check that all compiled files exist"
  57. $t test -f $(APP)/$(APP).d
  58. $t test -f $(APP)/ebin/$(APP).app
  59. $t test -f $(APP)/ebin/CAP.beam
  60. $t test -f $(APP)/ebin/Def.beam
  61. $t test -f $(APP)/ebin/use_cap.beam
  62. $t test -f $(APP)/ebin/use_def.beam
  63. $t test -f $(APP)/include/CAP.asn1db
  64. $t test -f $(APP)/include/CAP.hrl
  65. $t test -f $(APP)/include/Def.asn1db
  66. $t test -f $(APP)/include/Def.hrl
  67. $t test -f $(APP)/src/CAP.erl
  68. $t test -f $(APP)/src/Def.erl
  69. $i "Check that the application was compiled correctly"
  70. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  71. ok = application:start($(APP)), \
  72. {ok, Mods = ['CAP', 'Def', use_cap, use_def]} \
  73. = application:get_key($(APP), modules), \
  74. [{module, M} = code:load_file(M) || M <- Mods], \
  75. halt()"
  76. $i "Touch one .asn1 file; check that only required files are rebuilt"
  77. # The use_cap.erl gets touched because of its dependency to CAP.hrl.
  78. $t printf "%s\n" \
  79. $(APP)/$(APP).d \
  80. $(APP)/ebin/$(APP).app \
  81. $(APP)/ebin/CAP.beam \
  82. $(APP)/ebin/use_cap.beam \
  83. $(APP)/include/CAP.asn1db \
  84. $(APP)/include/CAP.hrl \
  85. $(APP)/src/CAP.erl \
  86. $(APP)/src/use_cap.erl | sort > $(APP)/EXPECT
  87. $t $(SLEEP)
  88. $t touch $(APP)/asn1/CAP.asn1
  89. $t $(SLEEP)
  90. $t $(MAKE) -C $(APP) $v
  91. $t find $(APP) -type f -newer $(APP)/asn1/CAP.asn1 | sort | diff $(APP)/EXPECT -
  92. $t rm $(APP)/EXPECT
  93. $i "Check that the application was compiled correctly"
  94. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  95. ok = application:start($(APP)), \
  96. {ok, Mods = ['CAP', 'Def', use_cap, use_def]} \
  97. = application:get_key($(APP), modules), \
  98. [{module, M} = code:load_file(M) || M <- Mods], \
  99. halt()"
  100. $i "Clean the application"
  101. $t $(MAKE) -C $(APP) clean $v
  102. $i "Check that source files still exist"
  103. $t test -f $(APP)/Makefile
  104. $t test -f $(APP)/erlang.mk
  105. $t test -f $(APP)/asn1/CAP.asn1
  106. $t test -f $(APP)/asn1/Def.asn1
  107. $t test -f $(APP)/include/unrelated.hrl
  108. ifdef LEGACY
  109. $t test -f $(APP)/src/$(APP).app.src
  110. endif
  111. $t test -f $(APP)/src/use_cap.erl
  112. $t test -f $(APP)/src/use_def.erl
  113. $i "Check that all build artifacts are removed, including intermediates"
  114. $t test ! -e $(APP)/$(APP).d
  115. $t test ! -e $(APP)/ebin/
  116. $t test ! -e $(APP)/include/CAP.asn1db
  117. $t test ! -e $(APP)/include/CAP.hrl
  118. $t test ! -e $(APP)/include/Def.asn1db
  119. $t test ! -e $(APP)/include/Def.hrl
  120. $t test ! -e $(APP)/src/CAP.erl
  121. $t test ! -e $(APP)/src/Def.erl
  122. $i "Build the application again"
  123. $t $(MAKE) -C $(APP) $v
  124. $i "Check that all compiled files exist"
  125. $t test -f $(APP)/$(APP).d
  126. $t test -f $(APP)/ebin/$(APP).app
  127. $t test -f $(APP)/ebin/CAP.beam
  128. $t test -f $(APP)/ebin/Def.beam
  129. $t test -f $(APP)/ebin/use_cap.beam
  130. $t test -f $(APP)/ebin/use_def.beam
  131. $t test -f $(APP)/include/CAP.asn1db
  132. $t test -f $(APP)/include/CAP.hrl
  133. $t test -f $(APP)/include/Def.asn1db
  134. $t test -f $(APP)/include/Def.hrl
  135. $t test -f $(APP)/src/CAP.erl
  136. $t test -f $(APP)/src/Def.erl
  137. $i "Check that the application was compiled correctly"
  138. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  139. ok = application:start($(APP)), \
  140. {ok, Mods = ['CAP', 'Def', use_cap, use_def]} \
  141. = application:get_key($(APP), modules), \
  142. [{module, M} = code:load_file(M) || M <- Mods], \
  143. halt()"
  144. $i "Clean the application"
  145. $t $(MAKE) -C $(APP) clean $v
  146. $i "Build the application with ERLC_ASN1_OPTS set"
  147. $t echo "ERLC_ASN1_OPTS += +'{record_name_prefix,\"FOO-\"}'" >> $(APP)/Makefile
  148. $t $(MAKE) -C $(APP) $v
  149. $i "Check that the application was built with ERLC_ASN1_OPTS set"
  150. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  151. Attrs = 'Def':module_info(attributes), \
  152. Asn1Info = proplists:get_value(asn1_info, Attrs), \
  153. Opts = proplists:get_value(options, Asn1Info), \
  154. true = lists:member({record_name_prefix, \"FOO-\"}, Opts), \
  155. halt()"
  156. core-app-asn1-maps: init
  157. $i "Bootstrap a new OTP library named $(APP)"
  158. $t mkdir $(APP)/
  159. $t cp ../erlang.mk $(APP)/
  160. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  161. $i "Set ERLC_ASN1_OPTS = +maps in the Makefile"
  162. $t perl -ni.bak -e 'print;if ($$.==1) {print "ERLC_ASN1_OPTS = +maps\n"}' $(APP)/Makefile
  163. $i "Download .asn1 files from Erlang/OTP"
  164. $t mkdir $(APP)/asn1/
  165. $t curl -s -o $(APP)/asn1/CAP.asn1 $(OTP_MASTER)/lib/asn1/test/asn1_SUITE_data/CAP.asn1
  166. $t curl -s -o $(APP)/asn1/Def.asn1 $(OTP_MASTER)/lib/asn1/test/asn1_SUITE_data/Def.asn1
  167. $i "Build the application"
  168. $t $(MAKE) -C $(APP) $v
  169. $i "Check that all compiled files exist"
  170. $t test -f $(APP)/$(APP).d
  171. $t test -f $(APP)/ebin/$(APP).app
  172. $t test -f $(APP)/ebin/CAP.beam
  173. $t test -f $(APP)/ebin/Def.beam
  174. $t test -f $(APP)/include/CAP.asn1db
  175. $t ! test -e $(APP)/include/CAP.hrl
  176. $t test -f $(APP)/include/Def.asn1db
  177. $t ! test -e $(APP)/include/Def.hrl
  178. $t test -f $(APP)/src/CAP.erl
  179. $t test -f $(APP)/src/Def.erl
  180. $i "Check that the application was compiled correctly"
  181. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  182. ok = application:start($(APP)), \
  183. {ok, Mods = ['CAP', 'Def']} \
  184. = application:get_key($(APP), modules), \
  185. [{module, M} = code:load_file(M) || M <- Mods], \
  186. halt()"
  187. core-app-auto-git-id: init
  188. $i "Bootstrap a new OTP library named $(APP)"
  189. $t mkdir $(APP)/
  190. $t cp ../erlang.mk $(APP)/
  191. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  192. $i "Make it a git repository"
  193. $t cd $(APP) && \
  194. git init -q && \
  195. git config user.email "testsuite@erlang.mk" && \
  196. git config user.name "test suite" && \
  197. git add . && \
  198. git commit -q --no-gpg-sign -m "Tests"
  199. $i "Build the application"
  200. $t $(MAKE) -C $(APP) $v
  201. ifdef LEGACY
  202. # Legacy replaces {id, "git"} always regardless of built as a dependency.
  203. $i "Check that the generated .app file has an id key"
  204. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  205. ok = application:start($(APP)), \
  206. {ok, ID} = application:get_key($(APP), id), \
  207. true = ID =/= [], \
  208. halt()"
  209. else
  210. # If there is no .app.src though, only fill in id when built as a dependency.
  211. $i "Check that the generated .app file has no id key"
  212. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  213. ok = application:start($(APP)), \
  214. {ok, []} = application:get_key($(APP), id), \
  215. halt()"
  216. endif
  217. $i "Clean the application"
  218. $t $(MAKE) -C $(APP) clean $v
  219. $i "Build the application with IS_DEP=1"
  220. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  221. $i "Check that the generated .app file has an id key"
  222. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  223. ok = application:start($(APP)), \
  224. {ok, ID} = application:get_key($(APP), id), \
  225. true = ID =/= [], \
  226. halt()"
  227. core-app-compile-first: init
  228. $i "Bootstrap a new OTP library named $(APP)"
  229. $t mkdir $(APP)/
  230. $t cp ../erlang.mk $(APP)/
  231. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  232. $i "Generate .erl files"
  233. $t echo "-module(boy)." > $(APP)/src/boy.erl
  234. $t echo "-module(girl)." > $(APP)/src/girl.erl
  235. $t echo "-module(first)." > $(APP)/src/first.erl
  236. $i "Define COMPILE_FIRST"
  237. $t echo "COMPILE_FIRST = first" >> $(APP)/Makefile
  238. $i "Build the application"
  239. $t $(MAKE) -C $(APP) $v
  240. $i "Check that the application was compiled correctly"
  241. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  242. ok = application:start($(APP)), \
  243. {ok, Mods = [boy, first, girl]} \
  244. = application:get_key($(APP), modules), \
  245. [{module, M} = code:load_file(M) || M <- Mods], \
  246. halt()"
  247. core-app-compile-first-sub-directory: init
  248. $i "Bootstrap a new OTP library named $(APP)"
  249. $t mkdir $(APP)/
  250. $t cp ../erlang.mk $(APP)/
  251. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  252. $i "Generate .erl files"
  253. $t echo "-module(boy)." > $(APP)/src/boy.erl
  254. $t echo "-module(girl)." > $(APP)/src/girl.erl
  255. $t mkdir $(APP)/src/sub/
  256. $t echo "-module(first)." > $(APP)/src/sub/first.erl
  257. $i "Define COMPILE_FIRST with a module in a sub-directory"
  258. $t echo "COMPILE_FIRST = sub/first" >> $(APP)/Makefile
  259. $i "Build the application"
  260. $t $(MAKE) -C $(APP) $v
  261. $i "Check that the application was compiled correctly"
  262. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  263. ok = application:start($(APP)), \
  264. {ok, Mods = [boy, first, girl]} \
  265. = application:get_key($(APP), modules), \
  266. [{module, M} = code:load_file(M) || M <- Mods], \
  267. halt()"
  268. ifndef LEGACY
  269. core-app-env: init
  270. $i "Bootstrap a new OTP library named $(APP)"
  271. $t mkdir $(APP)/
  272. $t cp ../erlang.mk $(APP)/
  273. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  274. $i "Define PROJECT_ENV"
  275. $t echo "PROJECT_ENV = [{test_key, test_value}]" >> $(APP)/Makefile
  276. $i "Build the application"
  277. $t $(MAKE) -C $(APP) $v
  278. $i "Check that the application was compiled correctly"
  279. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  280. ok = application:load($(APP)), \
  281. {ok, test_value} = application:get_env($(APP), test_key), \
  282. halt()"
  283. $i "Define PROJECT_ENV with escape in string, special char"
  284. $t echo "PROJECT_ENV = [{test_atom, '\\\$$\$$test'}, {test_key, \"\\\"test_\\tvalue\\\"\"}]" >> $(APP)/Makefile
  285. $i "Build the application"
  286. $t $(MAKE) -C $(APP) $v
  287. $i "Check that the application was compiled correctly"
  288. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  289. ok = application:load($(APP)), \
  290. {ok, \"\\\"test_\\tvalue\\\"\"} = application:get_env($(APP), test_key), \
  291. {ok, '\\\$$test'} = application:get_env($(APP), test_atom), \
  292. halt()"
  293. core-app-env-invalid: init
  294. $i "Bootstrap a new OTP library named $(APP)"
  295. $t mkdir $(APP)/
  296. $t cp ../erlang.mk $(APP)/
  297. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  298. $i "Define an invalid PROJECT_ENV"
  299. $t echo "PROJECT_ENV = [{test_key, test_value" >> $(APP)/Makefile
  300. $i "Build the application"
  301. $t ! $(MAKE) -C $(APP) $v
  302. endif
  303. core-app-erlc-exclude: init
  304. $i "Bootstrap a new OTP library named $(APP)"
  305. $t mkdir $(APP)/
  306. $t cp ../erlang.mk $(APP)/
  307. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  308. $i "Generate .erl files"
  309. $t echo "-module(boy)." > $(APP)/src/boy.erl
  310. $t echo "-module(girl)." > $(APP)/src/girl.erl
  311. $i "Exclude boy.erl from the compilation"
  312. $t echo "ERLC_EXCLUDE = boy" >> $(APP)/Makefile
  313. $i "Build the application"
  314. $t $(MAKE) -C $(APP) $v
  315. $i "Check that boy.erl was not compiled"
  316. $t test ! -e $(APP)/ebin/boy.beam
  317. $i "Check that the application was compiled correctly (without boy.erl)"
  318. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  319. ok = application:start($(APP)), \
  320. {ok, Mods = [girl]} \
  321. = application:get_key($(APP), modules), \
  322. [{module, M} = code:load_file(M) || M <- Mods], \
  323. halt()"
  324. core-app-erlc-opts: init
  325. $i "Bootstrap a new OTP library named $(APP)"
  326. $t mkdir $(APP)/
  327. $t cp ../erlang.mk $(APP)/
  328. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  329. $i "Define an empty ERLC_OPTS (without debug_info)"
  330. $t echo "ERLC_OPTS =" >> $(APP)/Makefile
  331. $i "Generate .erl files"
  332. $t echo "-module(boy)." > $(APP)/src/boy.erl
  333. $t echo "-module(girl)." > $(APP)/src/girl.erl
  334. $i "Build the application"
  335. $t $(MAKE) -C $(APP) $v
  336. $i "Check that the application was compiled correctly (without debug_info)"
  337. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  338. ok = application:start($(APP)), \
  339. {ok, Mods = [boy, girl]} \
  340. = application:get_key($(APP), modules), \
  341. [{module, M} = code:load_file(M) || M <- Mods], \
  342. false = proplists:is_defined(debug_info, proplists:get_value(options, boy:module_info(compile))), \
  343. false = proplists:is_defined(debug_info, proplists:get_value(options, girl:module_info(compile))), \
  344. halt()"
  345. core-app-erlc-opts-filter: init
  346. $i "Bootstrap a new OTP library named $(APP)"
  347. $t mkdir $(APP)/
  348. $t cp ../erlang.mk $(APP)/
  349. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  350. $i "Define ERLC_OPTS filtering out debug_info"
  351. $t echo "ERLC_OPTS := \$$(filter-out +debug_info,\$$(ERLC_OPTS))" >> $(APP)/Makefile
  352. $i "Generate .erl files"
  353. $t echo "-module(boy)." > $(APP)/src/boy.erl
  354. $t echo "-module(girl)." > $(APP)/src/girl.erl
  355. $i "Build the application"
  356. $t $(MAKE) -C $(APP) $v
  357. $i "Check that the application was compiled correctly (without debug_info)"
  358. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  359. ok = application:start($(APP)), \
  360. {ok, Mods = [boy, girl]} \
  361. = application:get_key($(APP), modules), \
  362. [{module, M} = code:load_file(M) || M <- Mods], \
  363. false = proplists:is_defined(debug_info, proplists:get_value(options, boy:module_info(compile))), \
  364. false = proplists:is_defined(debug_info, proplists:get_value(options, girl:module_info(compile))), \
  365. halt()"
  366. core-app-erlc-symlink: init
  367. $i "Bootstrap a new OTP library named $(APP)"
  368. $t mkdir $(APP)/
  369. $t cp ../erlang.mk $(APP)/
  370. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  371. $i "Generate .erl files"
  372. $t echo "-module(boy)." > $(APP)/src/boy.erl
  373. $t echo "-module(girl)." > $(APP)/girl.erl
  374. $i "Symlink .erl file"
  375. $t ln -s ../girl.erl $(APP)/src/girl.erl
  376. $i "Build the application"
  377. $t $(MAKE) -C $(APP) $v
  378. $i "Check that the application was compiled correctly"
  379. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  380. ok = application:start($(APP)), \
  381. {ok, Mods = [boy, girl]} \
  382. = application:get_key($(APP), modules), \
  383. [{module, M} = code:load_file(M) || M <- Mods], \
  384. halt()"
  385. core-app-error: init
  386. $i "Bootstrap a new OTP library named $(APP)"
  387. $t mkdir $(APP)/
  388. $t cp ../erlang.mk $(APP)/
  389. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  390. $i "Generate a bad .erl files"
  391. $t touch $(APP)/src/breaking.erl
  392. $i "Generate unrelated .erl files"
  393. $t echo "-module(boy)." > $(APP)/src/boy.erl
  394. $t echo "-module(girl)." > $(APP)/src/girl.erl
  395. $i "Check that trying to build returns non-zero"
  396. $t ! $(MAKE) -C $(APP) $v
  397. ifndef LEGACY
  398. core-app-extra-keys: init
  399. $i "Bootstrap a new OTP library named $(APP)"
  400. $t mkdir $(APP)/
  401. $t cp ../erlang.mk $(APP)/
  402. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  403. $i "Define PROJECT_APP_EXTRA_KEYS"
  404. $t printf "define PROJECT_APP_EXTRA_KEYS\n\t{maxT, 10000},\n\t{non_standard_key, test_value}\nendef\n" >> $(APP)/Makefile
  405. $i "Build the application"
  406. $t $(MAKE) -C $(APP) $v
  407. $i "Check that the application was compiled correctly"
  408. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  409. ok = application:load($(APP)), \
  410. {ok, 10000} = application:get_key($(APP), maxT), \
  411. AppFile = filename:join(code:lib_dir($(APP), ebin), atom_to_list($(APP)) ++ \".app\"), \
  412. {ok, [App]} = file:consult(AppFile), \
  413. {application, $(APP), Props} = App, \
  414. test_value = proplists:get_value(non_standard_key, Props),\
  415. halt()"
  416. $i "Define PROJECT_APP_EXTRA_KEYS with escape in string, special char"
  417. $t echo "PROJECT_APP_EXTRA_KEYS = {non_standard_atom, '\\\$$\$$my_app'}, {non_standard_string, \"\\\"test_\\tvalue\\\"\"}" >> $(APP)/Makefile
  418. $i "Build the application"
  419. $t $(MAKE) -C $(APP) $v
  420. $i "Check that the application was compiled correctly"
  421. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  422. ok = application:load($(APP)), \
  423. AppFile = filename:join(code:lib_dir($(APP), ebin), atom_to_list($(APP)) ++ \".app\"), \
  424. {ok, [App]} = file:consult(AppFile), \
  425. {application, $(APP), Props} = App, \
  426. '\\\$$my_app' = proplists:get_value(non_standard_atom, Props),\
  427. \"\\\"test_\\tvalue\\\"\" = proplists:get_value(non_standard_string, Props),\
  428. halt()"
  429. endif
  430. core-app-generate-erl: init
  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 "Create a fake script file to be used as dependency"
  436. $t touch $(APP)/script.sh
  437. $i "Append rules to the Makefile to generate a .erl module"
  438. $t echo "\$$(PROJECT).d:: src/generated.erl" >> $(APP)/Makefile
  439. $t echo "src/generated.erl:: script.sh; echo \"-module(generated).\" > \$$@" >> $(APP)/Makefile
  440. $i "Generate unrelated .erl files"
  441. $t echo "-module(boy)." > $(APP)/src/boy.erl
  442. $t echo "-module(girl)." > $(APP)/src/girl.erl
  443. $i "Build the application"
  444. $t $(MAKE) -C $(APP) $v
  445. $i "Check that all compiled files exist"
  446. $t test -f $(APP)/$(APP).d
  447. $t test -f $(APP)/ebin/$(APP).app
  448. $t test -f $(APP)/ebin/boy.beam
  449. $t test -f $(APP)/ebin/generated.beam
  450. $t test -f $(APP)/ebin/girl.beam
  451. $t test -f $(APP)/src/generated.erl
  452. $i "Check that the application was compiled correctly"
  453. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  454. ok = application:start($(APP)), \
  455. {ok, Mods = [boy, generated, girl]} \
  456. = application:get_key($(APP), modules), \
  457. [{module, M} = code:load_file(M) || M <- Mods], \
  458. halt()"
  459. $i "Touch the script file; check that only required files are rebuilt"
  460. $t printf "%s\n" \
  461. $(APP)/$(APP).d \
  462. $(APP)/ebin/$(APP).app \
  463. $(APP)/ebin/generated.beam \
  464. $(APP)/src/generated.erl | sort > $(APP)/EXPECT
  465. $t $(SLEEP)
  466. $t touch $(APP)/script.sh
  467. $t $(SLEEP)
  468. $t $(MAKE) -C $(APP) $v
  469. $t find $(APP) -type f -newer $(APP)/script.sh | sort | diff $(APP)/EXPECT -
  470. $t rm $(APP)/EXPECT
  471. $i "Check that the application was compiled correctly"
  472. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  473. ok = application:start($(APP)), \
  474. {ok, Mods = [boy, generated, girl]} \
  475. = application:get_key($(APP), modules), \
  476. [{module, M} = code:load_file(M) || M <- Mods], \
  477. halt()"
  478. $i "Clean the application"
  479. $t $(MAKE) -C $(APP) clean $v
  480. $i "Check that source files still exist"
  481. $t test -f $(APP)/Makefile
  482. $t test -f $(APP)/erlang.mk
  483. $t test -f $(APP)/script.sh
  484. ifdef LEGACY
  485. $t test -f $(APP)/src/$(APP).app.src
  486. endif
  487. $t test -f $(APP)/src/boy.erl
  488. $t test -f $(APP)/src/girl.erl
  489. $i "Check that the generated .erl file still exists"
  490. $t test -f $(APP)/src/generated.erl
  491. $i "Check that all build artifacts are removed"
  492. $t test ! -e $(APP)/$(APP).d
  493. $t test ! -e $(APP)/ebin/
  494. $i "Add a rule to remove the generated .erl file on clean"
  495. $t echo "clean:: ; rm src/generated.erl" >> $(APP)/Makefile
  496. $i "Clean the application again"
  497. $t $(MAKE) -C $(APP) clean $v
  498. $i "Check that the generated .erl file was removed"
  499. $t test ! -e $(APP)/src/generated.erl
  500. $i "Build the application again"
  501. $t $(MAKE) -C $(APP) $v
  502. $i "Check that all compiled files exist"
  503. $t test -f $(APP)/$(APP).d
  504. $t test -f $(APP)/ebin/$(APP).app
  505. $t test -f $(APP)/ebin/boy.beam
  506. $t test -f $(APP)/ebin/generated.beam
  507. $t test -f $(APP)/ebin/girl.beam
  508. $t test -f $(APP)/src/generated.erl
  509. $i "Check that the application was compiled correctly"
  510. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  511. ok = application:start($(APP)), \
  512. {ok, Mods = [boy, generated, girl]} \
  513. = application:get_key($(APP), modules), \
  514. [{module, M} = code:load_file(M) || M <- Mods], \
  515. halt()"
  516. core-app-generate-erl-include: init
  517. $i "Bootstrap a new OTP library named $(APP)"
  518. $t mkdir $(APP)/
  519. $t cp ../erlang.mk $(APP)/
  520. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  521. $i "Create a fake script file to be used as dependency"
  522. $t touch $(APP)/script.sh
  523. $i "Append rules to the Makefile to generate a .erl module"
  524. $t echo "\$$(PROJECT).d:: src/generated.erl" >> $(APP)/Makefile
  525. $t echo "src/generated.erl:: script.sh; echo \"-module(generated).\" > \$$@; echo \"-include(\\\"included.hrl\\\").\" >> \$$@" >> $(APP)/Makefile
  526. $i "Generate the .hrl file"
  527. $t mkdir $(APP)/include/
  528. $t touch $(APP)/include/included.hrl
  529. $i "Generate unrelated .erl files"
  530. $t echo "-module(boy)." > $(APP)/src/boy.erl
  531. $t echo "-module(girl)." > $(APP)/src/girl.erl
  532. $i "Build the application"
  533. $t $(MAKE) -C $(APP) $v
  534. $i "Check that all compiled files exist"
  535. $t test -f $(APP)/$(APP).d
  536. $t test -f $(APP)/ebin/$(APP).app
  537. $t test -f $(APP)/ebin/boy.beam
  538. $t test -f $(APP)/ebin/generated.beam
  539. $t test -f $(APP)/ebin/girl.beam
  540. $t test -f $(APP)/src/generated.erl
  541. $i "Check that the application was compiled correctly"
  542. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  543. ok = application:start($(APP)), \
  544. {ok, Mods = [boy, generated, girl]} \
  545. = application:get_key($(APP), modules), \
  546. [{module, M} = code:load_file(M) || M <- Mods], \
  547. halt()"
  548. $i "Touch the .hrl file; check that only required files are rebuilt"
  549. $t printf "%s\n" \
  550. $(APP)/$(APP).d \
  551. $(APP)/ebin/$(APP).app \
  552. $(APP)/ebin/generated.beam \
  553. $(APP)/src/generated.erl | sort > $(APP)/EXPECT
  554. $t $(SLEEP)
  555. $t touch $(APP)/include/included.hrl
  556. $t $(SLEEP)
  557. $t $(MAKE) -C $(APP) $v
  558. $t find $(APP) -type f -newer $(APP)/include/included.hrl | sort | diff $(APP)/EXPECT -
  559. $t rm $(APP)/EXPECT
  560. $i "Check that the application was compiled correctly"
  561. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  562. ok = application:start($(APP)), \
  563. {ok, Mods = [boy, generated, girl]} \
  564. = application:get_key($(APP), modules), \
  565. [{module, M} = code:load_file(M) || M <- Mods], \
  566. halt()"
  567. core-app-generate-erl-prepend: init
  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 "Create a fake script file to be used as dependency"
  573. $t touch $(APP)/script.sh
  574. $i "Generate a Makefile and prepend rules that generate a .erl module"
  575. $t echo "PROJECT = $(APP)" > $(APP)/Makefile
  576. $t echo ".DEFAULT_GOAL = all" >> $(APP)/Makefile
  577. $t echo "\$$(PROJECT).d:: src/generated.erl" >> $(APP)/Makefile
  578. $t echo "src/generated.erl:: script.sh; echo \"-module(generated).\" > \$$@" >> $(APP)/Makefile
  579. $t echo "include erlang.mk" >> $(APP)/Makefile
  580. $i "Generate unrelated .erl files"
  581. $t echo "-module(boy)." > $(APP)/src/boy.erl
  582. $t echo "-module(girl)." > $(APP)/src/girl.erl
  583. $i "Build the application"
  584. $t $(MAKE) -C $(APP) $v
  585. $i "Check that all compiled files exist"
  586. $t test -f $(APP)/$(APP).d
  587. $t test -f $(APP)/ebin/$(APP).app
  588. $t test -f $(APP)/ebin/boy.beam
  589. $t test -f $(APP)/ebin/generated.beam
  590. $t test -f $(APP)/ebin/girl.beam
  591. $t test -f $(APP)/src/generated.erl
  592. $i "Check that the application was compiled correctly"
  593. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  594. ok = application:start($(APP)), \
  595. {ok, Mods = [boy, generated, girl]} \
  596. = application:get_key($(APP), modules), \
  597. [{module, M} = code:load_file(M) || M <- Mods], \
  598. halt()"
  599. $i "Touch the script file; check that only required files are rebuilt"
  600. $t printf "%s\n" \
  601. $(APP)/$(APP).d \
  602. $(APP)/ebin/$(APP).app \
  603. $(APP)/ebin/generated.beam \
  604. $(APP)/src/generated.erl | sort > $(APP)/EXPECT
  605. $t $(SLEEP)
  606. $t touch $(APP)/script.sh
  607. $t $(SLEEP)
  608. $t $(MAKE) -C $(APP) $v
  609. $t find $(APP) -type f -newer $(APP)/script.sh | sort | diff $(APP)/EXPECT -
  610. $t rm $(APP)/EXPECT
  611. $i "Check that the application was compiled correctly"
  612. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  613. ok = application:start($(APP)), \
  614. {ok, Mods = [boy, generated, girl]} \
  615. = application:get_key($(APP), modules), \
  616. [{module, M} = code:load_file(M) || M <- Mods], \
  617. halt()"
  618. $i "Clean the application"
  619. $t $(MAKE) -C $(APP) clean $v
  620. $i "Check that source files still exist"
  621. $t test -f $(APP)/Makefile
  622. $t test -f $(APP)/erlang.mk
  623. $t test -f $(APP)/script.sh
  624. ifdef LEGACY
  625. $t test -f $(APP)/src/$(APP).app.src
  626. endif
  627. $t test -f $(APP)/src/boy.erl
  628. $t test -f $(APP)/src/girl.erl
  629. $i "Check that the generated .erl file still exists"
  630. $t test -f $(APP)/src/generated.erl
  631. $i "Check that all build artifacts are removed"
  632. $t test ! -e $(APP)/$(APP).d
  633. $t test ! -e $(APP)/ebin/
  634. $i "Add a rule to remove the generated .erl file on clean"
  635. $t echo "clean:: ; rm src/generated.erl" >> $(APP)/Makefile
  636. $i "Clean the application again"
  637. $t $(MAKE) -C $(APP) clean $v
  638. $i "Check that the generated .erl file was removed"
  639. $t test ! -e $(APP)/src/generated.erl
  640. $i "Build the application again"
  641. $t $(MAKE) -C $(APP) $v
  642. $i "Check that all compiled files exist"
  643. $t test -f $(APP)/$(APP).d
  644. $t test -f $(APP)/ebin/$(APP).app
  645. $t test -f $(APP)/ebin/boy.beam
  646. $t test -f $(APP)/ebin/generated.beam
  647. $t test -f $(APP)/ebin/girl.beam
  648. $t test -f $(APP)/src/generated.erl
  649. $i "Check that the application was compiled correctly"
  650. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  651. ok = application:start($(APP)), \
  652. {ok, Mods = [boy, generated, girl]} \
  653. = application:get_key($(APP), modules), \
  654. [{module, M} = code:load_file(M) || M <- Mods], \
  655. halt()"
  656. core-app-hrl: init
  657. $i "Bootstrap a new OTP library named $(APP)"
  658. $t mkdir $(APP)/
  659. $t cp ../erlang.mk $(APP)/
  660. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  661. $i "Generate .hrl files"
  662. $t mkdir $(APP)/include/
  663. $t touch $(APP)/include/blue.hrl $(APP)/include/red.hrl
  664. $i "Generate .erl files dependent from headers"
  665. $t printf "%s\n" "-module(use_blue)." "-include(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  666. $t printf "%s\n" "-module(use_red)." "-include(\"red.hrl\")." > $(APP)/src/use_red.erl
  667. $i "Build the application"
  668. $t $(MAKE) -C $(APP) $v
  669. $i "Check that all compiled files exist"
  670. $t test -f $(APP)/$(APP).d
  671. $t test -f $(APP)/ebin/$(APP).app
  672. $t test -f $(APP)/ebin/use_blue.beam
  673. $t test -f $(APP)/ebin/use_red.beam
  674. $i "Check that the application was compiled correctly"
  675. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  676. ok = application:start($(APP)), \
  677. {ok, Mods = [use_blue, use_red]} \
  678. = application:get_key($(APP), modules), \
  679. [{module, M} = code:load_file(M) || M <- Mods], \
  680. halt()"
  681. $i "Touch one .hrl file; check that only required files are rebuilt"
  682. # The use_red.erl gets touched because of its dependency to red.hrl.
  683. $t printf "%s\n" \
  684. $(APP)/$(APP).d \
  685. $(APP)/ebin/$(APP).app \
  686. $(APP)/ebin/use_red.beam \
  687. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  688. $t $(SLEEP)
  689. $t touch $(APP)/include/red.hrl
  690. $t $(SLEEP)
  691. $t $(MAKE) -C $(APP) $v
  692. $t find $(APP) -type f -newer $(APP)/include/red.hrl | sort | diff $(APP)/EXPECT -
  693. $t rm $(APP)/EXPECT
  694. $i "Check that the application was compiled correctly"
  695. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  696. ok = application:start($(APP)), \
  697. {ok, Mods = [use_blue, use_red]} \
  698. = application:get_key($(APP), modules), \
  699. [{module, M} = code:load_file(M) || M <- Mods], \
  700. halt()"
  701. $i "Clean the application"
  702. $t $(MAKE) -C $(APP) clean $v
  703. $i "Check that source files still exist"
  704. $t test -f $(APP)/Makefile
  705. $t test -f $(APP)/erlang.mk
  706. $t test -f $(APP)/include/blue.hrl
  707. $t test -f $(APP)/include/red.hrl
  708. ifdef LEGACY
  709. $t test -f $(APP)/src/$(APP).app.src
  710. endif
  711. $t test -f $(APP)/src/use_blue.erl
  712. $t test -f $(APP)/src/use_red.erl
  713. $i "Check that all build artifacts are removed"
  714. $t test ! -e $(APP)/$(APP).d
  715. $t test ! -e $(APP)/ebin/
  716. $i "Build the application again"
  717. $t $(MAKE) -C $(APP) $v
  718. $i "Check that all compiled files exist"
  719. $t test -f $(APP)/$(APP).d
  720. $t test -f $(APP)/ebin/$(APP).app
  721. $t test -f $(APP)/ebin/use_blue.beam
  722. $t test -f $(APP)/ebin/use_red.beam
  723. $i "Check that the application was compiled correctly"
  724. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  725. ok = application:start($(APP)), \
  726. {ok, Mods = [use_blue, use_red]} \
  727. = application:get_key($(APP), modules), \
  728. [{module, M} = code:load_file(M) || M <- Mods], \
  729. halt()"
  730. core-app-hrl-recursive: init
  731. $i "Bootstrap a new OTP library named $(APP)"
  732. $t mkdir $(APP)/
  733. $t cp ../erlang.mk $(APP)/
  734. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  735. $i "Generate .hrl files"
  736. $t mkdir $(APP)/include/
  737. $t touch $(APP)/include/blue.hrl $(APP)/include/pill.hrl
  738. $t echo "-include(\"pill.hrl\")." > $(APP)/include/red.hrl
  739. $i "Generate .erl files dependent from headers"
  740. $t printf "%s\n" "-module(use_blue)." "-include(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  741. $t printf "%s\n" "-module(use_red)." "-include(\"red.hrl\")." > $(APP)/src/use_red.erl
  742. $i "Build the application"
  743. $t $(MAKE) -C $(APP) $v
  744. $i "Check that all compiled files exist"
  745. $t test -f $(APP)/$(APP).d
  746. $t test -f $(APP)/ebin/$(APP).app
  747. $t test -f $(APP)/ebin/use_blue.beam
  748. $t test -f $(APP)/ebin/use_red.beam
  749. $i "Check that the application was compiled correctly"
  750. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  751. ok = application:start($(APP)), \
  752. {ok, Mods = [use_blue, use_red]} \
  753. = application:get_key($(APP), modules), \
  754. [{module, M} = code:load_file(M) || M <- Mods], \
  755. halt()"
  756. $i "Touch the deepest .hrl file; check that only required files are rebuilt"
  757. # The use_red.erl gets touched because of its dependency to red.hrl and pill.hrl.
  758. $t printf "%s\n" \
  759. $(APP)/$(APP).d \
  760. $(APP)/ebin/$(APP).app \
  761. $(APP)/ebin/use_red.beam \
  762. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  763. $t $(SLEEP)
  764. $t touch $(APP)/include/pill.hrl
  765. $t $(SLEEP)
  766. $t $(MAKE) -C $(APP) $v
  767. $t find $(APP) -type f -newer $(APP)/include/pill.hrl | sort | diff $(APP)/EXPECT -
  768. $t rm $(APP)/EXPECT
  769. $i "Check that the application was compiled correctly"
  770. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  771. ok = application:start($(APP)), \
  772. {ok, Mods = [use_blue, use_red]} \
  773. = application:get_key($(APP), modules), \
  774. [{module, M} = code:load_file(M) || M <- Mods], \
  775. halt()"
  776. $i "Clean the application"
  777. $t $(MAKE) -C $(APP) clean $v
  778. $i "Check that source files still exist"
  779. $t test -f $(APP)/Makefile
  780. $t test -f $(APP)/erlang.mk
  781. $t test -f $(APP)/include/blue.hrl
  782. $t test -f $(APP)/include/pill.hrl
  783. $t test -f $(APP)/include/red.hrl
  784. ifdef LEGACY
  785. $t test -f $(APP)/src/$(APP).app.src
  786. endif
  787. $t test -f $(APP)/src/use_blue.erl
  788. $t test -f $(APP)/src/use_red.erl
  789. $i "Check that all build artifacts are removed"
  790. $t test ! -e $(APP)/$(APP).d
  791. $t test ! -e $(APP)/ebin/
  792. $i "Build the application again"
  793. $t $(MAKE) -C $(APP) $v
  794. $i "Check that all compiled files exist"
  795. $t test -f $(APP)/$(APP).d
  796. $t test -f $(APP)/ebin/$(APP).app
  797. $t test -f $(APP)/ebin/use_blue.beam
  798. $t test -f $(APP)/ebin/use_red.beam
  799. $i "Check that the application was compiled correctly"
  800. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  801. ok = application:start($(APP)), \
  802. {ok, Mods = [use_blue, use_red]} \
  803. = application:get_key($(APP), modules), \
  804. [{module, M} = code:load_file(M) || M <- Mods], \
  805. halt()"
  806. core-app-makefile-change: init
  807. $i "Bootstrap a new OTP application named $(APP)"
  808. $t mkdir $(APP)/
  809. $t cp ../erlang.mk $(APP)/
  810. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  811. $i "Build the application"
  812. $t $(MAKE) -C $(APP) $v
  813. $i "Touch the Makefile; check that all files get rebuilt"
  814. $t printf "%s\n" \
  815. $(APP)/$(APP).d \
  816. $(APP)/ebin/$(APP).app \
  817. $(APP)/ebin/$(APP)_app.beam \
  818. $(APP)/ebin/$(APP)_sup.beam \
  819. $(APP)/src/$(APP)_app.erl \
  820. $(APP)/src/$(APP)_sup.erl | sort > $(APP)/EXPECT
  821. $t $(SLEEP)
  822. $t touch $(APP)/Makefile
  823. $t $(SLEEP)
  824. $t $(MAKE) -C $(APP) $v
  825. $t find $(APP) -type f -newer $(APP)/Makefile -not -path "$(APP)/.erlang.mk/*" | sort | diff $(APP)/EXPECT -
  826. $t rm $(APP)/EXPECT
  827. core-app-mib: init
  828. $i "Bootstrap a new OTP library named $(APP)"
  829. $t mkdir $(APP)/
  830. $t cp ../erlang.mk $(APP)/
  831. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  832. $i "Download .mib files from Erlang/OTP"
  833. $t mkdir $(APP)/mibs/
  834. $t curl -s -o $(APP)/mibs/EX1-MIB.mib $(OTP_MASTER)/lib/snmp/examples/ex1/EX1-MIB.mib
  835. $t curl -s -o $(APP)/mibs/OTP-REG.mib $(OTP_MASTER)/lib/snmp/mibs/OTP-REG.mib
  836. $i "Generate .erl files dependent from headers generated by .mib files"
  837. $t printf "%s\n" "-module(use_v1)." "-include(\"EX1-MIB.hrl\")." > $(APP)/src/use_v1.erl
  838. $t printf "%s\n" "-module(use_v2)." "-include(\"OTP-REG.hrl\")." > $(APP)/src/use_v2.erl
  839. $i "Generate an unrelated .hrl file"
  840. $t mkdir $(APP)/include/
  841. $t touch $(APP)/include/unrelated.hrl
  842. $i "Build the application"
  843. $t $(MAKE) -C $(APP) $v
  844. $i "Check that all compiled files exist"
  845. $t test -f $(APP)/$(APP).d
  846. $t test -f $(APP)/ebin/$(APP).app
  847. $t test -f $(APP)/ebin/use_v1.beam
  848. $t test -f $(APP)/ebin/use_v2.beam
  849. $t test -f $(APP)/include/EX1-MIB.hrl
  850. $t test -f $(APP)/include/OTP-REG.hrl
  851. $t test -f $(APP)/priv/mibs/EX1-MIB.bin
  852. $t test -f $(APP)/priv/mibs/OTP-REG.bin
  853. $i "Check that the application was compiled correctly"
  854. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  855. ok = application:start($(APP)), \
  856. {ok, Mods = [use_v1, use_v2]} \
  857. = application:get_key($(APP), modules), \
  858. [{module, M} = code:load_file(M) || M <- Mods], \
  859. halt()"
  860. $i "Touch one .mib file; check that only required files are rebuilt"
  861. # The use_v1.erl gets touched because of its dependency to EX1-MIB.hrl.
  862. $t printf "%s\n" \
  863. $(APP)/$(APP).d \
  864. $(APP)/ebin/$(APP).app \
  865. $(APP)/ebin/use_v1.beam \
  866. $(APP)/include/EX1-MIB.hrl \
  867. $(APP)/priv/mibs/EX1-MIB.bin \
  868. $(APP)/src/use_v1.erl | sort > $(APP)/EXPECT
  869. $t $(SLEEP)
  870. $t touch $(APP)/mibs/EX1-MIB.mib
  871. $t $(SLEEP)
  872. $t $(MAKE) -C $(APP) $v
  873. $t find $(APP) -type f -newer $(APP)/mibs/EX1-MIB.mib | sort | diff $(APP)/EXPECT -
  874. $t rm $(APP)/EXPECT
  875. $i "Check that the application was compiled correctly"
  876. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  877. ok = application:start($(APP)), \
  878. {ok, Mods = [use_v1, use_v2]} \
  879. = application:get_key($(APP), modules), \
  880. [{module, M} = code:load_file(M) || M <- Mods], \
  881. halt()"
  882. $i "Clean the application"
  883. $t $(MAKE) -C $(APP) clean $v
  884. $i "Check that source files still exist"
  885. $t test -f $(APP)/Makefile
  886. $t test -f $(APP)/erlang.mk
  887. $t test -f $(APP)/include/unrelated.hrl
  888. $t test -f $(APP)/mibs/EX1-MIB.mib
  889. $t test -f $(APP)/mibs/OTP-REG.mib
  890. ifdef LEGACY
  891. $t test -f $(APP)/src/$(APP).app.src
  892. endif
  893. $t test -f $(APP)/src/use_v1.erl
  894. $t test -f $(APP)/src/use_v2.erl
  895. $i "Check that all build artifacts are removed, including intermediates"
  896. $t test ! -e $(APP)/$(APP).d
  897. $t test ! -e $(APP)/ebin/
  898. $t test ! -e $(APP)/include/EX1-MIB.hrl
  899. $t test ! -e $(APP)/include/OTP-REG.hrl
  900. $t test ! -e $(APP)/priv/mibs/
  901. $i "Build the application again"
  902. $t $(MAKE) -C $(APP) $v
  903. $i "Check that all compiled files exist"
  904. $t test -f $(APP)/$(APP).d
  905. $t test -f $(APP)/ebin/$(APP).app
  906. $t test -f $(APP)/ebin/use_v1.beam
  907. $t test -f $(APP)/ebin/use_v2.beam
  908. $t test -f $(APP)/include/EX1-MIB.hrl
  909. $t test -f $(APP)/include/OTP-REG.hrl
  910. $t test -f $(APP)/priv/mibs/EX1-MIB.bin
  911. $t test -f $(APP)/priv/mibs/OTP-REG.bin
  912. $i "Check that the application was compiled correctly"
  913. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  914. ok = application:start($(APP)), \
  915. {ok, Mods = [use_v1, use_v2]} \
  916. = application:get_key($(APP), modules), \
  917. [{module, M} = code:load_file(M) || M <- Mods], \
  918. halt()"
  919. ifndef LEGACY
  920. core-app-name-special-char: init
  921. $i "Bootstrap a new OTP library named $(APP)"
  922. $t mkdir $(APP)/
  923. $t cp ../erlang.mk $(APP)/
  924. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  925. $i "Set PROJECT_DESCRIPTION = test % in the Makefile"
  926. $t echo "PROJECT_DESCRIPTION = test %" >> $(APP)/Makefile
  927. $i "Build the application"
  928. $t $(MAKE) -C $(APP) $v
  929. $i "Check that the application was compiled correctly"
  930. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  931. ok = application:load($(APP)), \
  932. {ok,\"test %\"} = application:get_key($(APP), description), \
  933. halt()"
  934. endif
  935. core-app-no-app: init
  936. $i "Bootstrap a project without an OTP library"
  937. $t mkdir $(APP)/
  938. $t cp ../erlang.mk $(APP)/
  939. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  940. $t rm -rf $(APP)/src
  941. $i "Build the project"
  942. $t $(MAKE) -C $(APP) $v
  943. core-app-no-makedep: init
  944. $i "Bootstrap a new OTP library named $(APP)"
  945. $t mkdir $(APP)/
  946. $t cp ../erlang.mk $(APP)/
  947. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  948. $i "Set NO_MAKEDEP ?= 1 in the Makefile"
  949. $t perl -ni.bak -e 'print;if ($$.==1) {print "NO_MAKEDEP ?= 1\n"}' $(APP)/Makefile
  950. $i "Generate .hrl files"
  951. $t mkdir $(APP)/include/
  952. $t touch $(APP)/include/blue.hrl $(APP)/include/red.hrl
  953. $i "Generate .erl files dependent from headers"
  954. $t printf "%s\n" "-module(use_blue)." "-include(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  955. $t printf "%s\n" "-module(use_red)." "-include(\"red.hrl\")." > $(APP)/src/use_red.erl
  956. $i "Build the application"
  957. $t $(MAKE) -C $(APP) $v
  958. $i "Check that all compiled files exist"
  959. $t test -f $(APP)/$(APP).d
  960. $t test -f $(APP)/ebin/$(APP).app
  961. $t test -f $(APP)/ebin/use_blue.beam
  962. $t test -f $(APP)/ebin/use_red.beam
  963. $i "Check that the application was compiled correctly"
  964. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  965. ok = application:start($(APP)), \
  966. {ok, Mods = [use_blue, use_red]} \
  967. = application:get_key($(APP), modules), \
  968. [{module, M} = code:load_file(M) || M <- Mods], \
  969. halt()"
  970. $i "Touch one .hrl file; check that only required files are rebuilt"
  971. # The use_red.erl gets touched because of its dependency to red.hrl.
  972. $t printf "%s\n" \
  973. $(APP)/ebin/$(APP).app \
  974. $(APP)/ebin/use_red.beam \
  975. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  976. $t $(SLEEP)
  977. $t touch $(APP)/include/red.hrl
  978. $t $(SLEEP)
  979. $t $(MAKE) -C $(APP) $v
  980. $t find $(APP) -type f -newer $(APP)/include/red.hrl | sort | diff $(APP)/EXPECT -
  981. $t rm $(APP)/EXPECT
  982. $i "Check that the application was compiled correctly"
  983. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  984. ok = application:start($(APP)), \
  985. {ok, Mods = [use_blue, use_red]} \
  986. = application:get_key($(APP), modules), \
  987. [{module, M} = code:load_file(M) || M <- Mods], \
  988. halt()"
  989. $i "Touch one .hrl file; disable NO_MAKEDEP and check that only required files are rebuilt"
  990. # The use_red.erl gets touched because of its dependency to red.hrl.
  991. $t printf "%s\n" \
  992. $(APP)/$(APP).d \
  993. $(APP)/ebin/$(APP).app \
  994. $(APP)/ebin/use_red.beam \
  995. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  996. $t $(SLEEP)
  997. $t touch $(APP)/include/red.hrl
  998. $t $(SLEEP)
  999. $t NO_MAKEDEP= $(MAKE) -C $(APP) $v
  1000. $t find $(APP) -type f -newer $(APP)/include/red.hrl | sort | diff $(APP)/EXPECT -
  1001. $t rm $(APP)/EXPECT
  1002. $i "Check that the application was compiled correctly"
  1003. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1004. ok = application:start($(APP)), \
  1005. {ok, Mods = [use_blue, use_red]} \
  1006. = application:get_key($(APP), modules), \
  1007. [{module, M} = code:load_file(M) || M <- Mods], \
  1008. halt()"
  1009. $i "Clean the application"
  1010. $t $(MAKE) -C $(APP) clean $v
  1011. $i "Check that source files still exist"
  1012. $t test -f $(APP)/Makefile
  1013. $t test -f $(APP)/erlang.mk
  1014. $t test -f $(APP)/include/blue.hrl
  1015. $t test -f $(APP)/include/red.hrl
  1016. ifdef LEGACY
  1017. $t test -f $(APP)/src/$(APP).app.src
  1018. endif
  1019. $t test -f $(APP)/src/use_blue.erl
  1020. $t test -f $(APP)/src/use_red.erl
  1021. $i "Check that all build artifacts are removed"
  1022. $t test ! -e $(APP)/$(APP).d
  1023. $t test ! -e $(APP)/ebin/
  1024. $i "Build the application again"
  1025. $t $(MAKE) -C $(APP) $v
  1026. $i "Check that all compiled files exist"
  1027. $t test -f $(APP)/$(APP).d
  1028. $t test -f $(APP)/ebin/$(APP).app
  1029. $t test -f $(APP)/ebin/use_blue.beam
  1030. $t test -f $(APP)/ebin/use_red.beam
  1031. $i "Check that the application was compiled correctly"
  1032. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1033. ok = application:start($(APP)), \
  1034. {ok, Mods = [use_blue, use_red]} \
  1035. = application:get_key($(APP), modules), \
  1036. [{module, M} = code:load_file(M) || M <- Mods], \
  1037. halt()"
  1038. core-app-project-mod: init
  1039. $i "Bootstrap a new OTP library named $(APP)"
  1040. $t mkdir $(APP)/
  1041. $t cp ../erlang.mk $(APP)/
  1042. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1043. $i "Generate an application module"
  1044. $t printf "%s\n" \
  1045. "-module(app_mod)." \
  1046. "-export([start/2, stop/1])." \
  1047. "start(_StartType, _StartArgs) -> {ok, self()}." \
  1048. "stop(_State) -> ok." > $(APP)/src/app_mod.erl
  1049. $i "Build the application with PROJECT_MOD"
  1050. $t $(MAKE) -C $(APP) PROJECT_MOD=app_mod $v
  1051. $i "Check that the application starts correctly"
  1052. $t $(ERL) -pa $(APP)/ebin/ -eval "ok = application:start($(APP)), halt()"
  1053. core-app-pt: init
  1054. $i "Bootstrap a new OTP library named $(APP)"
  1055. $t mkdir $(APP)/
  1056. $t cp ../erlang.mk $(APP)/
  1057. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1058. $i "Generate a parse_transform module"
  1059. $t printf "%s\n" \
  1060. "-module(my_pt)." \
  1061. "-export([parse_transform/2])." \
  1062. "parse_transform(Forms, _) ->" \
  1063. " io:format(\"# Running my_pt parse_transform.~n\")," \
  1064. " Forms." > $(APP)/src/my_pt.erl
  1065. $i "Generate a .erl file that uses the my_pt parse_transform"
  1066. $t printf "%s\n" \
  1067. "-module(my_user)." \
  1068. "-compile({parse_transform, my_pt})." > $(APP)/src/my_user.erl
  1069. $i "Build the application; confirm the parse_transform is used"
  1070. $t $(MAKE) -C $(APP) | grep "Running my_pt parse_transform."
  1071. $i "Check that the application was compiled correctly"
  1072. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1073. ok = application:start($(APP)), \
  1074. {ok, Mods = [my_pt, my_user]} = application:get_key($(APP), modules), \
  1075. [{module, M} = code:load_file(M) || M <- Mods], \
  1076. halt()"
  1077. core-app-pt-erlc-opts: init
  1078. $i "Bootstrap a new OTP library named $(APP)"
  1079. $t mkdir $(APP)/
  1080. $t cp ../erlang.mk $(APP)/
  1081. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1082. $i "Bootstrap a new OTP library in $(APP)/deps/my_pt_dep"
  1083. $t mkdir -p $(APP)/deps/my_pt_dep/
  1084. $t cp ../erlang.mk $(APP)/deps/my_pt_dep/
  1085. $t $(MAKE) -C $(APP)/deps/my_pt_dep/ -f erlang.mk bootstrap-lib $v
  1086. $i "Generate a parse_transform module in my_pt_dep"
  1087. $t printf "%s\n" \
  1088. "-module(my_pt)." \
  1089. "-export([parse_transform/2])." \
  1090. "parse_transform(Forms, _) ->" \
  1091. " io:format(\"# Running my_pt parse_transform.~n\")," \
  1092. " Forms." > $(APP)/deps/my_pt_dep/src/my_pt.erl
  1093. $i "Add my_pt_dep to the list of dependencies"
  1094. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = my_pt_dep\n"}' $(APP)/Makefile
  1095. $i "Generate .erl files"
  1096. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1097. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1098. $i "Add the my_pt parse_transform to ERLC_OPTS"
  1099. $t echo "ERLC_OPTS += +'{parse_transform, my_pt}'" >> $(APP)/Makefile
  1100. $i "Build the application; confirm the parse_transform is used"
  1101. $t $(MAKE) -C $(APP) | grep "Running my_pt parse_transform."
  1102. $i "Check that the application was compiled correctly"
  1103. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1104. ok = application:start($(APP)), \
  1105. {ok, Mods = [boy, girl]} = application:get_key($(APP), modules), \
  1106. [{module, M} = code:load_file(M) || M <- Mods], \
  1107. halt()"
  1108. core-app-xrl: init
  1109. $i "Bootstrap a new OTP library named $(APP)"
  1110. $t mkdir $(APP)/
  1111. $t cp ../erlang.mk $(APP)/
  1112. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1113. $i "Download .xrl files from Robert"
  1114. $t curl -s -o $(APP)/src/erlang_scan.xrl https://raw.githubusercontent.com/rvirding/leex/master/examples/erlang_scan.xrl
  1115. $t curl -s -o $(APP)/src/lfe_scan.xrl https://raw.githubusercontent.com/rvirding/leex/master/examples/lfe_scan.xrl
  1116. $i "Generate unrelated .erl files"
  1117. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1118. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1119. $i "Disable warnings; our test .xrl files aren't perfect"
  1120. $t echo "ERLC_OPTS=+debug_info" >> $(APP)/Makefile
  1121. $i "Build the application"
  1122. $t $(MAKE) -C $(APP) $v
  1123. $i "Check that all compiled files exist"
  1124. $t test -f $(APP)/$(APP).d
  1125. $t test -f $(APP)/ebin/$(APP).app
  1126. $t test -f $(APP)/ebin/boy.beam
  1127. $t test -f $(APP)/ebin/erlang_scan.beam
  1128. $t test -f $(APP)/ebin/girl.beam
  1129. $t test -f $(APP)/ebin/lfe_scan.beam
  1130. $t test -f $(APP)/src/erlang_scan.erl
  1131. $t test -f $(APP)/src/lfe_scan.erl
  1132. $i "Check that the application was compiled correctly"
  1133. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1134. ok = application:start($(APP)), \
  1135. {ok, Mods = [boy, erlang_scan, girl, lfe_scan]} \
  1136. = application:get_key($(APP), modules), \
  1137. [{module, M} = code:load_file(M) || M <- Mods], \
  1138. halt()"
  1139. $i "Touch one .xrl file; check that only required files are rebuilt"
  1140. $t printf "%s\n" \
  1141. $(APP)/$(APP).d \
  1142. $(APP)/ebin/$(APP).app \
  1143. $(APP)/ebin/erlang_scan.beam \
  1144. $(APP)/src/erlang_scan.erl | sort > $(APP)/EXPECT
  1145. $t $(SLEEP)
  1146. $t touch $(APP)/src/erlang_scan.xrl
  1147. $t $(SLEEP)
  1148. $t $(MAKE) -C $(APP) $v
  1149. $t find $(APP) -type f -newer $(APP)/src/erlang_scan.xrl | sort | diff $(APP)/EXPECT -
  1150. $t rm $(APP)/EXPECT
  1151. $i "Check that the application was compiled correctly"
  1152. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1153. ok = application:start($(APP)), \
  1154. {ok, Mods = [boy, erlang_scan, girl, lfe_scan]} \
  1155. = application:get_key($(APP), modules), \
  1156. [{module, M} = code:load_file(M) || M <- Mods], \
  1157. halt()"
  1158. $i "Clean the application"
  1159. $t $(MAKE) -C $(APP) clean $v
  1160. $i "Check that source files still exist"
  1161. $t test -f $(APP)/Makefile
  1162. $t test -f $(APP)/erlang.mk
  1163. ifdef LEGACY
  1164. $t test -f $(APP)/src/$(APP).app.src
  1165. endif
  1166. $t test -f $(APP)/src/boy.erl
  1167. $t test -f $(APP)/src/erlang_scan.xrl
  1168. $t test -f $(APP)/src/girl.erl
  1169. $t test -f $(APP)/src/lfe_scan.xrl
  1170. $i "Check that all build artifacts are removed, including intermediates"
  1171. $t test ! -e $(APP)/$(APP).d
  1172. $t test ! -e $(APP)/ebin/
  1173. $t test ! -e $(APP)/src/erlang_scan.erl
  1174. $t test ! -e $(APP)/src/lfe_scan.erl
  1175. $i "Build the application again"
  1176. $t $(MAKE) -C $(APP) $v
  1177. $i "Check that all compiled files exist"
  1178. $t test -f $(APP)/$(APP).d
  1179. $t test -f $(APP)/ebin/$(APP).app
  1180. $t test -f $(APP)/ebin/boy.beam
  1181. $t test -f $(APP)/ebin/erlang_scan.beam
  1182. $t test -f $(APP)/ebin/girl.beam
  1183. $t test -f $(APP)/ebin/lfe_scan.beam
  1184. $t test -f $(APP)/src/erlang_scan.erl
  1185. $t test -f $(APP)/src/lfe_scan.erl
  1186. $i "Check that the application was compiled correctly"
  1187. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1188. ok = application:start($(APP)), \
  1189. {ok, Mods = [boy, erlang_scan, girl, lfe_scan]} \
  1190. = application:get_key($(APP), modules), \
  1191. [{module, M} = code:load_file(M) || M <- Mods], \
  1192. halt()"
  1193. core-app-xrl-help: init
  1194. $i "Bootstrap a new OTP library named $(APP)"
  1195. $t mkdir $(APP)/
  1196. $t cp ../erlang.mk $(APP)/
  1197. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1198. $i "Download an .xrl file from Robert"
  1199. $t curl -s -o $(APP)/src/erlang_scan.xrl https://raw.githubusercontent.com/rvirding/leex/master/examples/erlang_scan.xrl
  1200. $i "Disable warnings; our test .xrl files aren't perfect"
  1201. $t echo "ERLC_OPTS=+debug_info" >> $(APP)/Makefile
  1202. $i "Run 'make help'"
  1203. $t $(MAKE) -C $(APP) help $v
  1204. $i "Check that no files were compiled"
  1205. $t test ! -e $(APP)/$(APP).d
  1206. $t test ! -e $(APP)/ebin/$(APP).app
  1207. $t test ! -e $(APP)/ebin/erlang_scan.beam
  1208. $t test ! -e $(APP)/src/erlang_scan.erl
  1209. core-app-xrl-include: init
  1210. $i "Bootstrap a new OTP library named $(APP)"
  1211. $t mkdir $(APP)/
  1212. $t cp ../erlang.mk $(APP)/
  1213. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1214. $i "Download a .xrl file with numerous includes from Gordon"
  1215. $t curl -s -o $(APP)/src/xfl_lexer.xrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/formula_engine-1.0/priv/xfl_lexer.xrl
  1216. $t curl -s -o $(APP)/src/errvals.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/errvals.hrl
  1217. $t curl -s -o $(APP)/src/muin_proc_dict.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/muin_proc_dict.hrl
  1218. $t curl -s -o $(APP)/src/muin_records.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/muin_records.hrl
  1219. $t curl -s -o $(APP)/src/typechecks.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/typechecks.hrl
  1220. $i "Generate unrelated .erl files"
  1221. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1222. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1223. $i "Disable warnings; our test .xrl files aren't perfect"
  1224. $t echo "ERLC_OPTS=+debug_info" >> $(APP)/Makefile
  1225. $i "Build the application"
  1226. $t $(MAKE) -C $(APP) $v
  1227. $i "Check that all compiled files exist"
  1228. $t test -f $(APP)/$(APP).d
  1229. $t test -f $(APP)/ebin/$(APP).app
  1230. $t test -f $(APP)/ebin/boy.beam
  1231. $t test -f $(APP)/ebin/girl.beam
  1232. $t test -f $(APP)/ebin/xfl_lexer.beam
  1233. $t test -f $(APP)/src/xfl_lexer.erl
  1234. $i "Check that the application was compiled correctly"
  1235. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1236. ok = application:start($(APP)), \
  1237. {ok, Mods = [boy, girl, xfl_lexer]} \
  1238. = application:get_key($(APP), modules), \
  1239. [{module, M} = code:load_file(M) || M <- Mods], \
  1240. halt()"
  1241. $i "Touch the .xrl file; check that only required files are rebuilt"
  1242. $t printf "%s\n" \
  1243. $(APP)/$(APP).d \
  1244. $(APP)/ebin/$(APP).app \
  1245. $(APP)/ebin/xfl_lexer.beam \
  1246. $(APP)/src/xfl_lexer.erl | sort > $(APP)/EXPECT
  1247. $t $(SLEEP)
  1248. $t touch $(APP)/src/xfl_lexer.xrl
  1249. $t $(SLEEP)
  1250. $t $(MAKE) -C $(APP) $v
  1251. $t find $(APP) -type f -newer $(APP)/src/xfl_lexer.xrl | sort | diff $(APP)/EXPECT -
  1252. $t rm $(APP)/EXPECT
  1253. $i "Check that the application was compiled correctly"
  1254. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1255. ok = application:start($(APP)), \
  1256. {ok, Mods = [boy, girl, xfl_lexer]} \
  1257. = application:get_key($(APP), modules), \
  1258. [{module, M} = code:load_file(M) || M <- Mods], \
  1259. halt()"
  1260. $i "Touch a .hrl file included directly; check that only required files are rebuilt"
  1261. $t printf "%s\n" \
  1262. $(APP)/$(APP).d \
  1263. $(APP)/ebin/$(APP).app \
  1264. $(APP)/ebin/xfl_lexer.beam \
  1265. $(APP)/src/xfl_lexer.erl | sort > $(APP)/EXPECT
  1266. $t $(SLEEP)
  1267. $t touch $(APP)/src/typechecks.hrl
  1268. $t $(SLEEP)
  1269. $t $(MAKE) -C $(APP) $v
  1270. $t find $(APP) -type f -newer $(APP)/src/typechecks.hrl | sort | diff $(APP)/EXPECT -
  1271. $t rm $(APP)/EXPECT
  1272. $i "Check that the application was compiled correctly"
  1273. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1274. ok = application:start($(APP)), \
  1275. {ok, Mods = [boy, girl, xfl_lexer]} \
  1276. = application:get_key($(APP), modules), \
  1277. [{module, M} = code:load_file(M) || M <- Mods], \
  1278. halt()"
  1279. $i "Touch a .hrl file included indirectly; check that only required files are rebuilt"
  1280. $t printf "%s\n" \
  1281. $(APP)/$(APP).d \
  1282. $(APP)/ebin/$(APP).app \
  1283. $(APP)/ebin/xfl_lexer.beam \
  1284. $(APP)/src/xfl_lexer.erl | sort > $(APP)/EXPECT
  1285. $t $(SLEEP)
  1286. $t touch $(APP)/src/errvals.hrl
  1287. $t $(SLEEP)
  1288. $t $(MAKE) -C $(APP) $v
  1289. $t find $(APP) -type f -newer $(APP)/src/errvals.hrl | sort | diff $(APP)/EXPECT -
  1290. $t rm $(APP)/EXPECT
  1291. $i "Check that the application was compiled correctly"
  1292. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1293. ok = application:start($(APP)), \
  1294. {ok, Mods = [boy, girl, xfl_lexer]} \
  1295. = application:get_key($(APP), modules), \
  1296. [{module, M} = code:load_file(M) || M <- Mods], \
  1297. halt()"
  1298. $i "Clean the application"
  1299. $t $(MAKE) -C $(APP) clean $v
  1300. $i "Check that source files still exist"
  1301. $t test -f $(APP)/Makefile
  1302. $t test -f $(APP)/erlang.mk
  1303. ifdef LEGACY
  1304. $t test -f $(APP)/src/$(APP).app.src
  1305. endif
  1306. $t test -f $(APP)/src/boy.erl
  1307. $t test -f $(APP)/src/girl.erl
  1308. $t test -f $(APP)/src/errvals.hrl
  1309. $t test -f $(APP)/src/muin_proc_dict.hrl
  1310. $t test -f $(APP)/src/muin_records.hrl
  1311. $t test -f $(APP)/src/typechecks.hrl
  1312. $t test -f $(APP)/src/xfl_lexer.xrl
  1313. $i "Check that all build artifacts are removed, including intermediates"
  1314. $t test ! -e $(APP)/$(APP).d
  1315. $t test ! -e $(APP)/ebin/
  1316. $t test ! -e $(APP)/src/xfl_lexer.erl
  1317. $i "Build the application again"
  1318. $t $(MAKE) -C $(APP) $v
  1319. $i "Check that all compiled files exist"
  1320. $t test -f $(APP)/$(APP).d
  1321. $t test -f $(APP)/ebin/$(APP).app
  1322. $t test -f $(APP)/ebin/boy.beam
  1323. $t test -f $(APP)/ebin/girl.beam
  1324. $t test -f $(APP)/ebin/xfl_lexer.beam
  1325. $t test -f $(APP)/src/xfl_lexer.erl
  1326. $i "Check that the application was compiled correctly"
  1327. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1328. ok = application:start($(APP)), \
  1329. {ok, Mods = [boy, girl, xfl_lexer]} \
  1330. = application:get_key($(APP), modules), \
  1331. [{module, M} = code:load_file(M) || M <- Mods], \
  1332. halt()"
  1333. core-app-yrl: init
  1334. $i "Bootstrap a new OTP library named $(APP)"
  1335. $t mkdir $(APP)/
  1336. $t cp ../erlang.mk $(APP)/
  1337. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1338. $i "Download .yrl files from Erlang/OTP"
  1339. $t curl -s -o $(APP)/src/xmerl_xpath_parse.yrl $(OTP_MASTER)/lib/xmerl/src/xmerl_xpath_parse.yrl
  1340. $t curl -s -o $(APP)/src/xref_parser.yrl $(OTP_MASTER)/lib/tools/src/xref_parser.yrl
  1341. $i "Generate unrelated .erl files"
  1342. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1343. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1344. $i "Build the application"
  1345. $t $(MAKE) -C $(APP) $v
  1346. $i "Check that all compiled files exist"
  1347. $t test -f $(APP)/$(APP).d
  1348. $t test -f $(APP)/ebin/$(APP).app
  1349. $t test -f $(APP)/ebin/boy.beam
  1350. $t test -f $(APP)/ebin/girl.beam
  1351. $t test -f $(APP)/ebin/xmerl_xpath_parse.beam
  1352. $t test -f $(APP)/ebin/xref_parser.beam
  1353. $t test -f $(APP)/src/xmerl_xpath_parse.erl
  1354. $t test -f $(APP)/src/xref_parser.erl
  1355. $i "Check that the application was compiled correctly"
  1356. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1357. ok = application:start($(APP)), \
  1358. {ok, Mods = [boy, girl, xmerl_xpath_parse, xref_parser]} \
  1359. = application:get_key($(APP), modules), \
  1360. [{module, M} = code:load_file(M) || M <- Mods], \
  1361. halt()"
  1362. $i "Touch one .yrl file; check that only required files are rebuilt"
  1363. $t printf "%s\n" \
  1364. $(APP)/$(APP).d \
  1365. $(APP)/ebin/$(APP).app \
  1366. $(APP)/ebin/xref_parser.beam \
  1367. $(APP)/src/xref_parser.erl | sort > $(APP)/EXPECT
  1368. $t $(SLEEP)
  1369. $t touch $(APP)/src/xref_parser.yrl
  1370. $t $(SLEEP)
  1371. $t $(MAKE) -C $(APP) $v
  1372. $t find $(APP) -type f -newer $(APP)/src/xref_parser.yrl | sort | diff $(APP)/EXPECT -
  1373. $t rm $(APP)/EXPECT
  1374. $i "Check that the application was compiled correctly"
  1375. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1376. ok = application:start($(APP)), \
  1377. {ok, Mods = [boy, girl, xmerl_xpath_parse, xref_parser]} \
  1378. = application:get_key($(APP), modules), \
  1379. [{module, M} = code:load_file(M) || M <- Mods], \
  1380. halt()"
  1381. $i "Clean the application"
  1382. $t $(MAKE) -C $(APP) clean $v
  1383. $i "Check that source files still exist"
  1384. $t test -f $(APP)/Makefile
  1385. $t test -f $(APP)/erlang.mk
  1386. ifdef LEGACY
  1387. $t test -f $(APP)/src/$(APP).app.src
  1388. endif
  1389. $t test -f $(APP)/src/boy.erl
  1390. $t test -f $(APP)/src/girl.erl
  1391. $t test -f $(APP)/src/xmerl_xpath_parse.yrl
  1392. $t test -f $(APP)/src/xref_parser.yrl
  1393. $i "Check that all build artifacts are removed, including intermediates"
  1394. $t test ! -e $(APP)/$(APP).d
  1395. $t test ! -e $(APP)/ebin/
  1396. $t test ! -e $(APP)/src/xmerl_xpath_parse.erl
  1397. $t test ! -e $(APP)/src/xref_parser.erl
  1398. $i "Build the application again"
  1399. $t $(MAKE) -C $(APP) $v
  1400. $i "Check that all compiled files exist"
  1401. $t test -f $(APP)/$(APP).d
  1402. $t test -f $(APP)/ebin/$(APP).app
  1403. $t test -f $(APP)/ebin/boy.beam
  1404. $t test -f $(APP)/ebin/girl.beam
  1405. $t test -f $(APP)/ebin/xmerl_xpath_parse.beam
  1406. $t test -f $(APP)/ebin/xref_parser.beam
  1407. $t test -f $(APP)/src/xmerl_xpath_parse.erl
  1408. $t test -f $(APP)/src/xref_parser.erl
  1409. $i "Check that the application was compiled correctly"
  1410. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1411. ok = application:start($(APP)), \
  1412. {ok, Mods = [boy, girl, xmerl_xpath_parse, xref_parser]} \
  1413. = application:get_key($(APP), modules), \
  1414. [{module, M} = code:load_file(M) || M <- Mods], \
  1415. halt()"
  1416. core-app-yrl-header: init
  1417. $i "Bootstrap a new OTP library named $(APP)"
  1418. $t mkdir $(APP)/
  1419. $t cp ../erlang.mk $(APP)/
  1420. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1421. $i "Create a .yrl file"
  1422. $t echo "Nonterminals E T F." > $(APP)/src/y_parse.yrl
  1423. $t echo "Terminals '+' '*' '(' ')' number." >> $(APP)/src/y_parse.yrl
  1424. $t echo "Rootsymbol E." >> $(APP)/src/y_parse.yrl
  1425. $t echo "E -> E '+' T: {'\$$2', '\$$1', '\$$3'}." >> $(APP)/src/y_parse.yrl
  1426. $t echo "E -> T : '\$$1'." >> $(APP)/src/y_parse.yrl
  1427. $t echo "T -> T '*' F: {'\$$2', '\$$1', '\$$3'}." >> $(APP)/src/y_parse.yrl
  1428. $t echo "T -> F : '\$$1'." >> $(APP)/src/y_parse.yrl
  1429. $t echo "F -> '(' E ')' : '\$$2'." >> $(APP)/src/y_parse.yrl
  1430. $t echo "F -> number : '\$$1'. " >> $(APP)/src/y_parse.yrl
  1431. $i "Create the yrl header file"
  1432. $t mkdir $(APP)/include
  1433. $t echo "-export([forty_two/0])." > $(APP)/include/yecc_header.hrl
  1434. # A bunch of gobbldygook we don't actually care about, they just
  1435. # need to exist so we don't get errors.
  1436. $t echo "-export([yeccpars1/5])." >> $(APP)/include/yecc_header.hrl
  1437. $t echo "-export([yeccerror/1])." >> $(APP)/include/yecc_header.hrl
  1438. $t echo "yeccpars1(_,_,_,_,_) -> throw(not_implemented)." >> $(APP)/include/yecc_header.hrl
  1439. $t echo "yeccerror(_) -> throw(not_implemented)." >> $(APP)/include/yecc_header.hrl
  1440. # Required bits done, now part we'll actually test for.
  1441. $t echo "forty_two() -> 42." >> $(APP)/include/yecc_header.hrl
  1442. $i "Generate unrelated .erl files"
  1443. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1444. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1445. $i "Build the application"
  1446. $t YRL_ERLC_OPTS="-I include/yecc_header.hrl" $(MAKE) -C $(APP) $v
  1447. $i "Check that all compiled files exist"
  1448. $t test -f $(APP)/$(APP).d
  1449. $t test -f $(APP)/ebin/$(APP).app
  1450. $t test -f $(APP)/ebin/boy.beam
  1451. $t test -f $(APP)/ebin/girl.beam
  1452. $t test -f $(APP)/ebin/y_parse.beam
  1453. $t test -f $(APP)/src/y_parse.erl
  1454. $i "Check that the application was compiled correctly"
  1455. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1456. ok = application:start($(APP)), \
  1457. {ok, Mods = [boy, girl, y_parse]} \
  1458. = application:get_key($(APP), modules), \
  1459. [{module, M} = code:load_file(M) || M <- Mods], \
  1460. halt()"
  1461. $i "Check the built yecc module used the header"
  1462. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1463. {module, y_parse} = code:load_file(y_parse), \
  1464. 42 = y_parse:forty_two(), \
  1465. halt()"
  1466. $i "Check that the application was compiled correctly"
  1467. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1468. ok = application:start($(APP)), \
  1469. {ok, Mods = [boy, girl, y_parse]} \
  1470. = application:get_key($(APP), modules), \
  1471. [{module, M} = code:load_file(M) || M <- Mods], \
  1472. halt()"
  1473. core-app-yrl-include: init
  1474. $i "Bootstrap a new OTP library named $(APP)"
  1475. $t mkdir $(APP)/
  1476. $t cp ../erlang.mk $(APP)/
  1477. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1478. $i "Download a .yrl file with includes from Erlang/OTP"
  1479. $t curl -s -o $(APP)/src/core_parse.yrl $(OTP_MASTER)/lib/compiler/src/core_parse.yrl
  1480. $t curl -s -o $(APP)/src/core_parse.hrl $(OTP_MASTER)/lib/compiler/src/core_parse.hrl
  1481. $i "Generate unrelated .erl files"
  1482. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1483. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1484. $i "Build the application"
  1485. $t $(MAKE) -C $(APP) $v
  1486. $i "Check that all compiled files exist"
  1487. $t test -f $(APP)/$(APP).d
  1488. $t test -f $(APP)/ebin/$(APP).app
  1489. $t test -f $(APP)/ebin/boy.beam
  1490. $t test -f $(APP)/ebin/core_parse.beam
  1491. $t test -f $(APP)/ebin/girl.beam
  1492. $t test -f $(APP)/src/core_parse.erl
  1493. $i "Check that the application was compiled correctly"
  1494. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1495. ok = application:start($(APP)), \
  1496. {ok, Mods = [boy, core_parse, girl]} \
  1497. = application:get_key($(APP), modules), \
  1498. [{module, M} = code:load_file(M) || M <- Mods], \
  1499. halt()"
  1500. $i "Touch the .yrl file; check that only required files are rebuilt"
  1501. $t printf "%s\n" \
  1502. $(APP)/$(APP).d \
  1503. $(APP)/ebin/$(APP).app \
  1504. $(APP)/ebin/core_parse.beam \
  1505. $(APP)/src/core_parse.erl | sort > $(APP)/EXPECT
  1506. $t $(SLEEP)
  1507. $t touch $(APP)/src/core_parse.yrl
  1508. $t $(SLEEP)
  1509. $t $(MAKE) -C $(APP) $v
  1510. $t find $(APP) -type f -newer $(APP)/src/core_parse.yrl | sort | diff $(APP)/EXPECT -
  1511. $t rm $(APP)/EXPECT
  1512. $i "Check that the application was compiled correctly"
  1513. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1514. ok = application:start($(APP)), \
  1515. {ok, Mods = [boy, core_parse, girl]} \
  1516. = application:get_key($(APP), modules), \
  1517. [{module, M} = code:load_file(M) || M <- Mods], \
  1518. halt()"
  1519. $i "Touch the .hrl file included; check that only required files are rebuilt"
  1520. $t printf "%s\n" \
  1521. $(APP)/$(APP).d \
  1522. $(APP)/ebin/$(APP).app \
  1523. $(APP)/ebin/core_parse.beam \
  1524. $(APP)/src/core_parse.erl | sort > $(APP)/EXPECT
  1525. $t $(SLEEP)
  1526. $t touch $(APP)/src/core_parse.hrl
  1527. $t $(SLEEP)
  1528. $t $(MAKE) -C $(APP) $v
  1529. $t find $(APP) -type f -newer $(APP)/src/core_parse.hrl | sort | diff $(APP)/EXPECT -
  1530. $t rm $(APP)/EXPECT
  1531. $i "Check that the application was compiled correctly"
  1532. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1533. ok = application:start($(APP)), \
  1534. {ok, Mods = [boy, core_parse, girl]} \
  1535. = application:get_key($(APP), modules), \
  1536. [{module, M} = code:load_file(M) || M <- Mods], \
  1537. halt()"
  1538. $i "Clean the application"
  1539. $t $(MAKE) -C $(APP) clean $v
  1540. $i "Check that source files still exist"
  1541. $t test -f $(APP)/Makefile
  1542. $t test -f $(APP)/erlang.mk
  1543. ifdef LEGACY
  1544. $t test -f $(APP)/src/$(APP).app.src
  1545. endif
  1546. $t test -f $(APP)/src/boy.erl
  1547. $t test -f $(APP)/src/core_parse.hrl
  1548. $t test -f $(APP)/src/core_parse.yrl
  1549. $t test -f $(APP)/src/girl.erl
  1550. $i "Check that all build artifacts are removed, including intermediates"
  1551. $t test ! -e $(APP)/$(APP).d
  1552. $t test ! -e $(APP)/ebin/
  1553. $t test ! -e $(APP)/src/core_parse.erl
  1554. $i "Build the application again"
  1555. $t $(MAKE) -C $(APP) $v
  1556. $i "Check that all compiled files exist"
  1557. $t test -f $(APP)/$(APP).d
  1558. $t test -f $(APP)/ebin/$(APP).app
  1559. $t test -f $(APP)/ebin/boy.beam
  1560. $t test -f $(APP)/ebin/core_parse.beam
  1561. $t test -f $(APP)/ebin/girl.beam
  1562. $t test -f $(APP)/src/core_parse.erl
  1563. $i "Check that the application was compiled correctly"
  1564. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1565. ok = application:start($(APP)), \
  1566. {ok, Mods = [boy, core_parse, girl]} \
  1567. = application:get_key($(APP), modules), \
  1568. [{module, M} = code:load_file(M) || M <- Mods], \
  1569. halt()"
  1570. core-app-yrl-test-build-then-normal-build: init
  1571. $i "Bootstrap a new OTP library named $(APP)"
  1572. $t mkdir $(APP)/
  1573. $t cp ../erlang.mk $(APP)/
  1574. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1575. $i "Create the parser .yrl file"
  1576. $t printf "%s\n" \
  1577. "Nonterminals top." \
  1578. "Terminals plus num." \
  1579. "Rootsymbol top." \
  1580. "top -> num plus num : {'$1', '$3'}." > $(APP)/src/$(APP)_parser.yrl
  1581. $i "Create the test suite"
  1582. $t mkdir $(APP)/test
  1583. $t printf "%s\n" \
  1584. "-module(test_SUITE)." \
  1585. "-export([all/0, test/1])." \
  1586. "all() -> [test]." \
  1587. "test(_) -> 0=0." > $(APP)/test/test_SUITE.erl
  1588. $i "Build the application in test mode"
  1589. $t $(MAKE) -C $(APP) ct $v
  1590. $i "Build the application in normal mode"
  1591. $t $(MAKE) -C $(APP) $v
  1592. core-app-hrl-include-lib: init
  1593. $i "Bootstrap a new OTP library named $(APP)"
  1594. $t mkdir $(APP)/
  1595. $t cp ../erlang.mk $(APP)/
  1596. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1597. $i "Generate .hrl files"
  1598. $t mkdir $(APP)/include/
  1599. $t touch $(APP)/include/blue.hrl $(APP)/include/red.hrl
  1600. $i "Generate .erl files dependent from headers"
  1601. $t printf "%s\n" "-module(use_blue)." "-include_lib(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  1602. $t printf "%s\n" "-module(use_red)." "-include_lib(\"red.hrl\")." > $(APP)/src/use_red.erl
  1603. $i "Build the application"
  1604. $t $(MAKE) -C $(APP) $v
  1605. $i "Check that all compiled files exist"
  1606. $t test -f $(APP)/$(APP).d
  1607. $t test -f $(APP)/ebin/$(APP).app
  1608. $t test -f $(APP)/ebin/use_blue.beam
  1609. $t test -f $(APP)/ebin/use_red.beam
  1610. $i "Check that the application was compiled correctly"
  1611. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1612. ok = application:start($(APP)), \
  1613. {ok, Mods = [use_blue, use_red]} \
  1614. = application:get_key($(APP), modules), \
  1615. [{module, M} = code:load_file(M) || M <- Mods], \
  1616. halt()"
  1617. $i "Touch one .hrl file; check that only required files are rebuilt"
  1618. # The use_red.erl gets touched because of its dependency to red.hrl.
  1619. $t printf "%s\n" \
  1620. $(APP)/$(APP).d \
  1621. $(APP)/ebin/$(APP).app \
  1622. $(APP)/ebin/use_red.beam \
  1623. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  1624. $t $(SLEEP)
  1625. $t touch $(APP)/include/red.hrl
  1626. $t $(SLEEP)
  1627. $t $(MAKE) -C $(APP) $v
  1628. $t find $(APP) -type f -newer $(APP)/include/red.hrl | sort | diff $(APP)/EXPECT -
  1629. $t rm $(APP)/EXPECT
  1630. $i "Check that the application was compiled correctly"
  1631. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1632. ok = application:start($(APP)), \
  1633. {ok, Mods = [use_blue, use_red]} \
  1634. = application:get_key($(APP), modules), \
  1635. [{module, M} = code:load_file(M) || M <- Mods], \
  1636. halt()"
  1637. $i "Clean the application"
  1638. $t $(MAKE) -C $(APP) clean $v
  1639. $i "Check that source files still exist"
  1640. $t test -f $(APP)/Makefile
  1641. $t test -f $(APP)/erlang.mk
  1642. $t test -f $(APP)/include/blue.hrl
  1643. $t test -f $(APP)/include/red.hrl
  1644. ifdef LEGACY
  1645. $t test -f $(APP)/src/$(APP).app.src
  1646. endif
  1647. $t test -f $(APP)/src/use_blue.erl
  1648. $t test -f $(APP)/src/use_red.erl
  1649. $i "Check that all build artifacts are removed"
  1650. $t test ! -e $(APP)/$(APP).d
  1651. $t test ! -e $(APP)/ebin/
  1652. $i "Build the application again"
  1653. $t $(MAKE) -C $(APP) $v
  1654. $i "Check that all compiled files exist"
  1655. $t test -f $(APP)/$(APP).d
  1656. $t test -f $(APP)/ebin/$(APP).app
  1657. $t test -f $(APP)/ebin/use_blue.beam
  1658. $t test -f $(APP)/ebin/use_red.beam
  1659. $i "Check that the application was compiled correctly"
  1660. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1661. ok = application:start($(APP)), \
  1662. {ok, Mods = [use_blue, use_red]} \
  1663. = application:get_key($(APP), modules), \
  1664. [{module, M} = code:load_file(M) || M <- Mods], \
  1665. halt()"
  1666. core-app-hrl-include-lib-recursive: init
  1667. $i "Bootstrap a new OTP library named $(APP)"
  1668. $t mkdir $(APP)/
  1669. $t cp ../erlang.mk $(APP)/
  1670. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1671. $i "Generate .hrl files"
  1672. $t mkdir $(APP)/include/
  1673. $t touch $(APP)/include/blue.hrl $(APP)/include/pill.hrl
  1674. $t echo "-include_lib(\"pill.hrl\")." > $(APP)/include/red.hrl
  1675. $i "Generate .erl files dependent from headers"
  1676. $t printf "%s\n" "-module(use_blue)." "-include_lib(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  1677. $t printf "%s\n" "-module(use_red)." "-include_lib(\"red.hrl\")." > $(APP)/src/use_red.erl
  1678. $i "Build the application"
  1679. $t $(MAKE) -C $(APP) $v
  1680. $i "Check that all compiled files exist"
  1681. $t test -f $(APP)/$(APP).d
  1682. $t test -f $(APP)/ebin/$(APP).app
  1683. $t test -f $(APP)/ebin/use_blue.beam
  1684. $t test -f $(APP)/ebin/use_red.beam
  1685. $i "Check that the application was compiled correctly"
  1686. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1687. ok = application:start($(APP)), \
  1688. {ok, Mods = [use_blue, use_red]} \
  1689. = application:get_key($(APP), modules), \
  1690. [{module, M} = code:load_file(M) || M <- Mods], \
  1691. halt()"
  1692. $i "Touch the deepest .hrl file; check that only required files are rebuilt"
  1693. # The use_red.erl gets touched because of its dependency to red.hrl and pill.hrl.
  1694. $t printf "%s\n" \
  1695. $(APP)/$(APP).d \
  1696. $(APP)/ebin/$(APP).app \
  1697. $(APP)/ebin/use_red.beam \
  1698. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  1699. $t $(SLEEP)
  1700. $t touch $(APP)/include/pill.hrl
  1701. $t $(SLEEP)
  1702. $t $(MAKE) -C $(APP) $v
  1703. $t find $(APP) -type f -newer $(APP)/include/pill.hrl | sort | diff $(APP)/EXPECT -
  1704. $t rm $(APP)/EXPECT
  1705. $i "Check that the application was compiled correctly"
  1706. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1707. ok = application:start($(APP)), \
  1708. {ok, Mods = [use_blue, use_red]} \
  1709. = application:get_key($(APP), modules), \
  1710. [{module, M} = code:load_file(M) || M <- Mods], \
  1711. halt()"
  1712. $i "Clean the application"
  1713. $t $(MAKE) -C $(APP) clean $v
  1714. $i "Check that source files still exist"
  1715. $t test -f $(APP)/Makefile
  1716. $t test -f $(APP)/erlang.mk
  1717. $t test -f $(APP)/include/blue.hrl
  1718. $t test -f $(APP)/include/pill.hrl
  1719. $t test -f $(APP)/include/red.hrl
  1720. ifdef LEGACY
  1721. $t test -f $(APP)/src/$(APP).app.src
  1722. endif
  1723. $t test -f $(APP)/src/use_blue.erl
  1724. $t test -f $(APP)/src/use_red.erl
  1725. $i "Check that all build artifacts are removed"
  1726. $t test ! -e $(APP)/$(APP).d
  1727. $t test ! -e $(APP)/ebin/
  1728. $i "Build the application again"
  1729. $t $(MAKE) -C $(APP) $v
  1730. $i "Check that all compiled files exist"
  1731. $t test -f $(APP)/$(APP).d
  1732. $t test -f $(APP)/ebin/$(APP).app
  1733. $t test -f $(APP)/ebin/use_blue.beam
  1734. $t test -f $(APP)/ebin/use_red.beam
  1735. $i "Check that the application was compiled correctly"
  1736. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1737. ok = application:start($(APP)), \
  1738. {ok, Mods = [use_blue, use_red]} \
  1739. = application:get_key($(APP), modules), \
  1740. [{module, M} = code:load_file(M) || M <- Mods], \
  1741. halt()"
  1742. core-app-hrl-multiapps-include-lib: init
  1743. $i "Create a multi application repository with no root application"
  1744. $t mkdir $(APP)/
  1745. $t cp ../erlang.mk $(APP)/
  1746. $t echo "include erlang.mk" > $(APP)/Makefile
  1747. $i "Create a new application named my_app"
  1748. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  1749. $i "Create a new library named my_lib"
  1750. $t $(MAKE) -C $(APP) new-lib in=my_lib $v
  1751. $i "Add my_lib as LOCAL_DEPS of my_app"
  1752. $t echo "LOCAL_DEPS = my_lib" >> $(APP)/apps/my_app/Makefile
  1753. $i "Generate .hrl files"
  1754. $t mkdir $(APP)/apps/my_lib/include/
  1755. $t touch $(APP)/apps/my_lib/include/blue.hrl $(APP)/apps/my_lib/include/red.hrl
  1756. $i "Generate .erl files dependent from headers"
  1757. $t printf "%s\n" "-module(use_blue)." "-include_lib(\"my_lib/include/blue.hrl\")." > $(APP)/apps/my_app/src/use_blue.erl
  1758. $t printf "%s\n" "-module(use_red)." "-include_lib(\"my_lib/include/red.hrl\")." > $(APP)/apps/my_app/src/use_red.erl
  1759. $i "Build the application"
  1760. $t $(MAKE) -C $(APP) $v
  1761. $i "Check that all compiled files exist"
  1762. $t test -f $(APP)/apps/my_app/my_app.d
  1763. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  1764. $t test -f $(APP)/apps/my_app/ebin/use_blue.beam
  1765. $t test -f $(APP)/apps/my_app/ebin/use_red.beam
  1766. $i "Check that the application was compiled correctly"
  1767. $t $(ERL) -pa $(APP)/apps/my_app/ebin/ $(APP)/apps/my_lib/ebin/ -eval " \
  1768. {ok, _Apps } = application:ensure_all_started(my_app), \
  1769. {ok, Mods = [use_blue, use_red]} \
  1770. = application:get_key(my_app, modules), \
  1771. [{module, M} = code:load_file(M) || M <- Mods], \
  1772. halt()"
  1773. $i "Touch one .hrl file; check that only required files are rebuilt"
  1774. # The use_red.erl gets touched because of its dependency to red.hrl.
  1775. $t printf "%s\n" \
  1776. $(APP)/apps/my_app/my_app.d \
  1777. $(APP)/apps/my_app/ebin/my_app.app \
  1778. $(APP)/apps/my_app/ebin/use_red.beam \
  1779. $(APP)/apps/my_app/src/use_red.erl | sort > $(APP)/EXPECT
  1780. $t $(SLEEP)
  1781. $t touch $(APP)/apps/my_lib/include/red.hrl
  1782. $t $(SLEEP)
  1783. $t $(MAKE) -C $(APP) $v
  1784. $t find $(APP)/apps/my_app -type f -newer $(APP)/apps/my_lib/include/red.hrl | sort | diff $(APP)/EXPECT -
  1785. $t rm $(APP)/EXPECT
  1786. $i "Check that the application was compiled correctly"
  1787. $t $(ERL) -pa $(APP)/apps/my_app/ebin/ $(APP)/apps/my_lib/ebin/ -eval " \
  1788. {ok, _Apps } = application:ensure_all_started(my_app), \
  1789. {ok, Mods = [use_blue, use_red]} \
  1790. = application:get_key(my_app, modules), \
  1791. [{module, M} = code:load_file(M) || M <- Mods], \
  1792. halt()"
  1793. $i "Clean the application"
  1794. $t $(MAKE) -C $(APP) clean $v
  1795. $i "Check that source files still exist"
  1796. $t test -f $(APP)/Makefile
  1797. $t test -f $(APP)/erlang.mk
  1798. $t test -f $(APP)/apps/my_lib/Makefile
  1799. $t test -f $(APP)/apps/my_lib/include/blue.hrl
  1800. $t test -f $(APP)/apps/my_lib/include/red.hrl
  1801. $t test -f $(APP)/apps/my_app/Makefile
  1802. $t test -f $(APP)/apps/my_app/src/use_blue.erl
  1803. $t test -f $(APP)/apps/my_app/src/use_red.erl
  1804. ifdef LEGACY
  1805. $t test -f $(APP)/apps/my_lib/src/my_lib.app.src
  1806. $t test -f $(APP)/apps/my_app/src/my_app.app.src
  1807. endif
  1808. $i "Check that all build artifacts are removed"
  1809. $t test ! -e $(APP)/apps/my_lib/my_app.d
  1810. $t test ! -e $(APP)/apps/my_lib/ebin/
  1811. $t test ! -e $(APP)/apps/my_app/my_app.d
  1812. $t test ! -e $(APP)/apps/my_app/ebin/
  1813. $i "Build the application again"
  1814. $t $(MAKE) -C $(APP) $v
  1815. $i "Check that all compiled files exist"
  1816. $t test -f $(APP)/apps/my_app/my_app.d
  1817. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  1818. $t test -f $(APP)/apps/my_app/ebin/use_blue.beam
  1819. $t test -f $(APP)/apps/my_app/ebin/use_red.beam
  1820. $i "Check that the application was compiled correctly"
  1821. $t $(ERL) -pa $(APP)/apps/my_app/ebin/ $(APP)/apps/my_lib/ebin/ -eval " \
  1822. {ok, _Apps } = application:ensure_all_started(my_app), \
  1823. {ok, Mods = [use_blue, use_red]} \
  1824. = application:get_key(my_app, modules), \
  1825. [{module, M} = code:load_file(M) || M <- Mods], \
  1826. halt()"
  1827. core-app-hrl-multiapps-include-lib-recursive: init
  1828. $i "Create a multi application repository with no root application"
  1829. $t mkdir $(APP)/
  1830. $t cp ../erlang.mk $(APP)/
  1831. $t echo "include erlang.mk" > $(APP)/Makefile
  1832. $i "Create a new application named my_app"
  1833. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  1834. $i "Create a new library named my_lib"
  1835. $t $(MAKE) -C $(APP) new-lib in=my_lib $v
  1836. $i "Add my_lib as LOCAL_DEPS of my_app"
  1837. $t echo "LOCAL_DEPS = my_lib" >> $(APP)/apps/my_app/Makefile
  1838. $i "Generate .hrl files"
  1839. $t mkdir $(APP)/apps/my_lib/include/
  1840. $t touch $(APP)/apps/my_lib/include/blue.hrl $(APP)/apps/my_lib/include/red.hrl $(APP)/apps/my_lib/include/pill.hrl
  1841. $t echo "-include(\"pill.hrl\")." > $(APP)/apps/my_lib/include/red.hrl
  1842. $i "Generate .erl files dependent from headers"
  1843. $t printf "%s\n" "-module(use_blue)." "-include_lib(\"my_lib/include/blue.hrl\")." > $(APP)/apps/my_app/src/use_blue.erl
  1844. $t printf "%s\n" "-module(use_red)." "-include_lib(\"my_lib/include/red.hrl\")." > $(APP)/apps/my_app/src/use_red.erl
  1845. $i "Build the application"
  1846. $t $(MAKE) -C $(APP) $v
  1847. $i "Check that all compiled files exist"
  1848. $t test -f $(APP)/apps/my_app/my_app.d
  1849. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  1850. $t test -f $(APP)/apps/my_app/ebin/use_blue.beam
  1851. $t test -f $(APP)/apps/my_app/ebin/use_red.beam
  1852. $i "Check that the application was compiled correctly"
  1853. $t $(ERL) -pa $(APP)/apps/my_app/ebin/ $(APP)/apps/my_lib/ebin/ -eval " \
  1854. {ok, _Apps } = application:ensure_all_started(my_app), \
  1855. {ok, Mods = [use_blue, use_red]} \
  1856. = application:get_key(my_app, modules), \
  1857. [{module, M} = code:load_file(M) || M <- Mods], \
  1858. halt()"
  1859. $i "Touch one .hrl file; check that only required files are rebuilt"
  1860. # The use_red.erl gets touched because of its dependency to red.hrl.
  1861. $t printf "%s\n" \
  1862. $(APP)/apps/my_app/my_app.d \
  1863. $(APP)/apps/my_app/ebin/my_app.app \
  1864. $(APP)/apps/my_app/ebin/use_red.beam \
  1865. $(APP)/apps/my_app/src/use_red.erl | sort > $(APP)/EXPECT
  1866. $t $(SLEEP)
  1867. $t touch $(APP)/apps/my_lib/include/pill.hrl
  1868. $t $(SLEEP)
  1869. $t $(MAKE) -C $(APP) $v
  1870. $t find $(APP)/apps/my_app -type f -newer $(APP)/apps/my_lib/include/pill.hrl | sort | diff $(APP)/EXPECT -
  1871. $t rm $(APP)/EXPECT
  1872. $i "Check that the application was compiled correctly"
  1873. $t $(ERL) -pa $(APP)/apps/my_app/ebin/ $(APP)/apps/my_lib/ebin/ -eval " \
  1874. {ok, _Apps } = application:ensure_all_started(my_app), \
  1875. {ok, Mods = [use_blue, use_red]} \
  1876. = application:get_key(my_app, modules), \
  1877. [{module, M} = code:load_file(M) || M <- Mods], \
  1878. halt()"
  1879. $i "Clean the application"
  1880. $t $(MAKE) -C $(APP) clean $v
  1881. $i "Check that source files still exist"
  1882. $t test -f $(APP)/Makefile
  1883. $t test -f $(APP)/erlang.mk
  1884. $t test -f $(APP)/apps/my_lib/Makefile
  1885. $t test -f $(APP)/apps/my_lib/include/blue.hrl
  1886. $t test -f $(APP)/apps/my_lib/include/red.hrl
  1887. $t test -f $(APP)/apps/my_lib/include/pill.hrl
  1888. $t test -f $(APP)/apps/my_app/Makefile
  1889. $t test -f $(APP)/apps/my_app/src/use_blue.erl
  1890. $t test -f $(APP)/apps/my_app/src/use_red.erl
  1891. ifdef LEGACY
  1892. $t test -f $(APP)/apps/my_lib/src/my_lib.app.src
  1893. $t test -f $(APP)/apps/my_app/src/my_app.app.src
  1894. endif
  1895. $i "Check that all build artifacts are removed"
  1896. $t test ! -e $(APP)/apps/my_lib/my_app.d
  1897. $t test ! -e $(APP)/apps/my_lib/ebin/
  1898. $t test ! -e $(APP)/apps/my_app/my_app.d
  1899. $t test ! -e $(APP)/apps/my_app/ebin/
  1900. $i "Build the application again"
  1901. $t $(MAKE) -C $(APP) $v
  1902. $i "Check that all compiled files exist"
  1903. $t test -f $(APP)/apps/my_app/my_app.d
  1904. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  1905. $t test -f $(APP)/apps/my_app/ebin/use_blue.beam
  1906. $t test -f $(APP)/apps/my_app/ebin/use_red.beam
  1907. $i "Check that the application was compiled correctly"
  1908. $t $(ERL) -pa $(APP)/apps/my_app/ebin/ $(APP)/apps/my_lib/ebin/ -eval " \
  1909. {ok, _Apps } = application:ensure_all_started(my_app), \
  1910. {ok, Mods = [use_blue, use_red]} \
  1911. = application:get_key(my_app, modules), \
  1912. [{module, M} = code:load_file(M) || M <- Mods], \
  1913. halt()"
  1914. core-app-hrl-include-lib-src: init
  1915. $i "Bootstrap a new OTP library named $(APP)"
  1916. $t mkdir $(APP)/
  1917. $t cp ../erlang.mk $(APP)/
  1918. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1919. $t touch $(APP)/src/blue.hrl $(APP)/src/red.hrl
  1920. $i "Generate .erl files dependent from headers"
  1921. $t printf "%s\n" "-module(use_blue)." "-include_lib(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  1922. $t printf "%s\n" "-module(use_red)." "-include_lib(\"red.hrl\")." > $(APP)/src/use_red.erl
  1923. $i "Build the application"
  1924. $t $(MAKE) -C $(APP) $v
  1925. $i "Check that all compiled files exist"
  1926. $t test -f $(APP)/$(APP).d
  1927. $t test -f $(APP)/ebin/$(APP).app
  1928. $t test -f $(APP)/ebin/use_blue.beam
  1929. $t test -f $(APP)/ebin/use_red.beam
  1930. $i "Check that the application was compiled correctly"
  1931. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1932. ok = application:start($(APP)), \
  1933. {ok, Mods = [use_blue, use_red]} \
  1934. = application:get_key($(APP), modules), \
  1935. [{module, M} = code:load_file(M) || M <- Mods], \
  1936. halt()"
  1937. $i "Touch one .hrl file; check that only required files are rebuilt"
  1938. # The use_red.erl gets touched because of its dependency to red.hrl.
  1939. $t printf "%s\n" \
  1940. $(APP)/$(APP).d \
  1941. $(APP)/ebin/$(APP).app \
  1942. $(APP)/ebin/use_red.beam \
  1943. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  1944. $t $(SLEEP)
  1945. $t touch $(APP)/src/red.hrl
  1946. $t $(SLEEP)
  1947. $t $(MAKE) -C $(APP) $v
  1948. $t find $(APP) -type f -newer $(APP)/src/red.hrl | sort | diff $(APP)/EXPECT -
  1949. $t rm $(APP)/EXPECT
  1950. $i "Check that the application was compiled correctly"
  1951. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1952. ok = application:start($(APP)), \
  1953. {ok, Mods = [use_blue, use_red]} \
  1954. = application:get_key($(APP), modules), \
  1955. [{module, M} = code:load_file(M) || M <- Mods], \
  1956. halt()"
  1957. $i "Clean the application"
  1958. $t $(MAKE) -C $(APP) clean $v
  1959. $i "Check that source files still exist"
  1960. $t test -f $(APP)/Makefile
  1961. $t test -f $(APP)/erlang.mk
  1962. $t test -f $(APP)/src/blue.hrl
  1963. $t test -f $(APP)/src/red.hrl
  1964. ifdef LEGACY
  1965. $t test -f $(APP)/src/$(APP).app.src
  1966. endif
  1967. $t test -f $(APP)/src/use_blue.erl
  1968. $t test -f $(APP)/src/use_red.erl
  1969. $i "Check that all build artifacts are removed"
  1970. $t test ! -e $(APP)/$(APP).d
  1971. $t test ! -e $(APP)/ebin/
  1972. $i "Build the application again"
  1973. $t $(MAKE) -C $(APP) $v
  1974. $i "Check that all compiled files exist"
  1975. $t test -f $(APP)/$(APP).d
  1976. $t test -f $(APP)/ebin/$(APP).app
  1977. $t test -f $(APP)/ebin/use_blue.beam
  1978. $t test -f $(APP)/ebin/use_red.beam
  1979. $i "Check that the application was compiled correctly"
  1980. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1981. ok = application:start($(APP)), \
  1982. {ok, Mods = [use_blue, use_red]} \
  1983. = application:get_key($(APP), modules), \
  1984. [{module, M} = code:load_file(M) || M <- Mods], \
  1985. halt()"
  1986. core-app-hrl-include-lib-src-recursive: init
  1987. $i "Bootstrap a new OTP library named $(APP)"
  1988. $t mkdir $(APP)/
  1989. $t cp ../erlang.mk $(APP)/
  1990. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1991. $i "Generate .hrl files"
  1992. $t touch $(APP)/src/blue.hrl $(APP)/src/pill.hrl
  1993. $t echo "-include_lib(\"pill.hrl\")." > $(APP)/src/red.hrl
  1994. $i "Generate .erl files dependent from headers"
  1995. $t printf "%s\n" "-module(use_blue)." "-include_lib(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  1996. $t printf "%s\n" "-module(use_red)." "-include_lib(\"red.hrl\")." > $(APP)/src/use_red.erl
  1997. $i "Build the application"
  1998. $t $(MAKE) -C $(APP) $v
  1999. $i "Check that all compiled files exist"
  2000. $t test -f $(APP)/$(APP).d
  2001. $t test -f $(APP)/ebin/$(APP).app
  2002. $t test -f $(APP)/ebin/use_blue.beam
  2003. $t test -f $(APP)/ebin/use_red.beam
  2004. $i "Check that the application was compiled correctly"
  2005. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  2006. ok = application:start($(APP)), \
  2007. {ok, Mods = [use_blue, use_red]} \
  2008. = application:get_key($(APP), modules), \
  2009. [{module, M} = code:load_file(M) || M <- Mods], \
  2010. halt()"
  2011. $i "Touch the deepest .hrl file; check that only required files are rebuilt"
  2012. # The use_red.erl gets touched because of its dependency to red.hrl and pill.hrl.
  2013. $t printf "%s\n" \
  2014. $(APP)/$(APP).d \
  2015. $(APP)/ebin/$(APP).app \
  2016. $(APP)/ebin/use_red.beam \
  2017. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  2018. $t $(SLEEP)
  2019. $t touch $(APP)/src/pill.hrl
  2020. $t $(SLEEP)
  2021. $t $(MAKE) -C $(APP) $v
  2022. $t find $(APP) -type f -newer $(APP)/src/pill.hrl | sort | diff $(APP)/EXPECT -
  2023. $t rm $(APP)/EXPECT
  2024. $i "Check that the application was compiled correctly"
  2025. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  2026. ok = application:start($(APP)), \
  2027. {ok, Mods = [use_blue, use_red]} \
  2028. = application:get_key($(APP), modules), \
  2029. [{module, M} = code:load_file(M) || M <- Mods], \
  2030. halt()"
  2031. $i "Clean the application"
  2032. $t $(MAKE) -C $(APP) clean $v
  2033. $i "Check that source files still exist"
  2034. $t test -f $(APP)/Makefile
  2035. $t test -f $(APP)/erlang.mk
  2036. $t test -f $(APP)/src/blue.hrl
  2037. $t test -f $(APP)/src/pill.hrl
  2038. $t test -f $(APP)/src/red.hrl
  2039. ifdef LEGACY
  2040. $t test -f $(APP)/src/$(APP).app.src
  2041. endif
  2042. $t test -f $(APP)/src/use_blue.erl
  2043. $t test -f $(APP)/src/use_red.erl
  2044. $i "Check that all build artifacts are removed"
  2045. $t test ! -e $(APP)/$(APP).d
  2046. $t test ! -e $(APP)/ebin/
  2047. $i "Build the application again"
  2048. $t $(MAKE) -C $(APP) $v
  2049. $i "Check that all compiled files exist"
  2050. $t test -f $(APP)/$(APP).d
  2051. $t test -f $(APP)/ebin/$(APP).app
  2052. $t test -f $(APP)/ebin/use_blue.beam
  2053. $t test -f $(APP)/ebin/use_red.beam
  2054. $i "Check that the application was compiled correctly"
  2055. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  2056. ok = application:start($(APP)), \
  2057. {ok, Mods = [use_blue, use_red]} \
  2058. = application:get_key($(APP), modules), \
  2059. [{module, M} = code:load_file(M) || M <- Mods], \
  2060. halt()"
  2061. core-app-hrl-deps: init
  2062. $i "Create a multi application repository with no root application"
  2063. $t mkdir $(APP)/
  2064. $t cp ../erlang.mk $(APP)/
  2065. $t echo "include erlang.mk" > $(APP)/Makefile
  2066. $i "Create a new application named my_app"
  2067. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  2068. $t echo "DEPS = cowlib" > $(APP)/apps/my_app/Makefile
  2069. $t echo "dep_cowlib_commit = master" >> $(APP)/apps/my_app/Makefile
  2070. $t echo "include ../../erlang.mk" >> $(APP)/apps/my_app/Makefile
  2071. $t printf "%s\n" "-module(boy)." "-include_lib(\"cowlib/include/cow_inline.hrl\")." > $(APP)/apps/my_app/src/boy.erl
  2072. $t printf "%s\n" "-module(girl)." > $(APP)/apps/my_app/src/girl.erl
  2073. $i "Build the application"
  2074. $t $(MAKE) -C $(APP) $v
  2075. $i "Check that all compiled files exist"
  2076. $t test -f $(APP)/apps/my_app/my_app.d
  2077. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  2078. $t test -f $(APP)/apps/my_app/ebin/boy.beam
  2079. $t test -f $(APP)/apps/my_app/ebin/girl.beam
  2080. $t test -f $(APP)/deps/cowlib/ebin/cowlib.app
  2081. ifndef LEGACY
  2082. $i "Check that the application was compiled correctly"
  2083. $t $(ERL) -pa $(APP)/apps/*/ebin/ -eval " \
  2084. ok = application:load(my_app), \
  2085. {ok, MyAppDeps} = application:get_key(my_app, applications), \
  2086. true = lists:member(cowlib, MyAppDeps), \
  2087. halt()"
  2088. endif
  2089. $i "Touch cowlib .hrl file; check that only required files are rebuilt"
  2090. $t printf "%s\n" \
  2091. $(APP)/apps/my_app/my_app.d \
  2092. $(APP)/apps/my_app/ebin/my_app.app \
  2093. $(APP)/apps/my_app/ebin/boy.beam \
  2094. $(APP)/apps/my_app/src/boy.erl | sort > $(APP)/EXPECT
  2095. $t $(SLEEP)
  2096. $t touch $(APP)/deps/cowlib/include/cow_inline.hrl
  2097. $t $(SLEEP)
  2098. $t $(MAKE) -C $(APP) $v
  2099. $t find $(APP)/apps/my_app -type f -newer $(APP)/deps/cowlib/include/cow_inline.hrl | sort | diff $(APP)/EXPECT -
  2100. $t rm $(APP)/EXPECT
  2101. $i "Clean Cowlib"
  2102. $t $(MAKE) -C $(APP)/deps/cowlib clean $v
  2103. $i "Check that Cowlib compiled files were removed"
  2104. $t test ! -e $(APP)/deps/cowlib/ebin/cowlib.app
  2105. $i "Build the application again"
  2106. $t $(MAKE) -C $(APP) $v
  2107. $i "Check that Cowlib compiled files exist"
  2108. $t test -f $(APP)/deps/cowlib/ebin/cowlib.app
  2109. $i "Clean the application"
  2110. $t $(MAKE) -C $(APP) clean $v
  2111. $i "Check that Cowlib is still here"
  2112. $t test -d $(APP)/deps/cowlib
  2113. $i "Check that all relevant files were removed"
  2114. $t test ! -e $(APP)/apps/my_app/my_app.d
  2115. $t test ! -e $(APP)/apps/my_app/ebin/my_app.app
  2116. $t test ! -e $(APP)/apps/my_app/ebin/boy.beam
  2117. $t test ! -e $(APP)/apps/my_app/ebin/girl.beam
  2118. $i "Distclean the application"
  2119. $t $(MAKE) -C $(APP) distclean $v
  2120. $i "Check that all relevant files were removed"
  2121. $t test ! -e $(APP)/deps
  2122. $i "Build the application"
  2123. $t $(MAKE) -C $(APP) $v
  2124. $i "Check that all compiled files exist"
  2125. $t test -f $(APP)/apps/my_app/my_app.d
  2126. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  2127. $t test -f $(APP)/apps/my_app/ebin/boy.beam
  2128. $t test -f $(APP)/apps/my_app/ebin/girl.beam
  2129. $t test -d $(APP)/deps/cowlib
  2130. ifndef LEGACY
  2131. $i "Check that the application was compiled correctly"
  2132. $t $(ERL) -pa $(APP)/apps/*/ebin/ -eval " \
  2133. ok = application:load(my_app), \
  2134. {ok, MyAppDeps} = application:get_key(my_app, applications), \
  2135. true = lists:member(cowlib, MyAppDeps), \
  2136. halt()"
  2137. endif
  2138. core-app-hrl-include-loop: init
  2139. $i "Bootstrap a new OTP library named $(APP)"
  2140. $t mkdir $(APP)/
  2141. $t cp ../erlang.mk $(APP)/
  2142. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  2143. $i "Generate .hrl files with header loop"
  2144. $t mkdir $(APP)/include/
  2145. $t printf "%s\n" "-include(\"blue.hrl\")." > $(APP)/include/red.hrl
  2146. $t printf "%s\n" "-include(\"red.hrl\")." > $(APP)/include/blue.hrl
  2147. $i "Generate .erl files dependent from headers"
  2148. $t printf "%s\n" "-module(use_blue)." "-include(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  2149. $t printf "%s\n" "-module(use_red)." "-include(\"red.hrl\")." > $(APP)/src/use_red.erl
  2150. $i "Build the application. Compilation should fail"
  2151. $t ! $(MAKE) -C $(APP) $v
  2152. $i "Check .d file"
  2153. $t grep -q "src/use_blue.erl:: include/blue.hrl include/red.hrl; @touch" $(APP)/$(APP).d
  2154. $t grep -q "src/use_red.erl:: include/blue.hrl include/red.hrl; @touch" $(APP)/$(APP).d
  2155. core-app-hrl-include_lib-loop: init
  2156. $i "Bootstrap a new OTP library named $(APP)"
  2157. $t mkdir $(APP)/
  2158. $t cp ../erlang.mk $(APP)/
  2159. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  2160. $i "Generate .hrl files with heaeder loop"
  2161. $t mkdir $(APP)/include/
  2162. $t printf "%s\n" "-include_lib(\"blue.hrl\")." > $(APP)/include/red.hrl
  2163. $t printf "%s\n" "-include_lib(\"red.hrl\")." > $(APP)/include/blue.hrl
  2164. $i "Generate .erl files dependent from headers"
  2165. $t printf "%s\n" "-module(use_blue)." "-include_lib(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  2166. $t printf "%s\n" "-module(use_red)." "-include_lib(\"red.hrl\")." > $(APP)/src/use_red.erl
  2167. $i "Build the application. Compilation should fail"
  2168. $t ! $(MAKE) -C $(APP) $v
  2169. $i "Check .d file"
  2170. $t grep -q "src/use_blue.erl:: include/blue.hrl include/red.hrl; @touch" $(APP)/$(APP).d
  2171. $t grep -q "src/use_red.erl:: include/blue.hrl include/red.hrl; @touch" $(APP)/$(APP).d
  2172. core-app-hrl-include-loop-define-protected: init
  2173. $i "Bootstrap a new OTP library named $(APP)"
  2174. $t mkdir $(APP)/
  2175. $t cp ../erlang.mk $(APP)/
  2176. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  2177. $i "Generate .hrl files with hrl loop protection "
  2178. $t mkdir $(APP)/include/
  2179. $t printf "%s\n" "-ifndef(BLUE_HRL_LOADED)." "-define(BLUE_HRL_LOADED,true)." "-include(\"red.hrl\")." "-endif." > $(APP)/include/blue.hrl
  2180. $t printf "%s\n" "-ifndef(RED_HRL_LOADED)." "-define(RED_HRL_LOADED,true)." "-include(\"blue.hrl\")." "-endif." > $(APP)/include/red.hrl
  2181. $i "Generate .erl files dependent from headers"
  2182. $t printf "%s\n" "-module(use_blue)." "-include(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  2183. $t printf "%s\n" "-module(use_red)." "-include(\"red.hrl\")." > $(APP)/src/use_red.erl
  2184. $i "Build the application. Compilation should fail"
  2185. $t ! $(MAKE) -C $(APP) $v ; ret=$$?
  2186. $i "Check .d file"
  2187. $t grep -q "src/use_blue.erl:: include/blue.hrl include/red.hrl; @touch" $(APP)/$(APP).d
  2188. $t grep -q "src/use_red.erl:: include/blue.hrl include/red.hrl; @touch" $(APP)/$(APP).d
  2189. core-app-hrl-include_lib-loop-define-protected: init
  2190. $i "Bootstrap a new OTP library named $(APP)"
  2191. $t mkdir $(APP)/
  2192. $t cp ../erlang.mk $(APP)/
  2193. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  2194. $i "Generate .hrl files with hrl loop protection "
  2195. $t mkdir $(APP)/include/
  2196. $t printf "%s\n" "-ifndef(BLUE_HRL_LOADED)." "-define(BLUE_HRL_LOADED,true)." "-include_lib(\"red.hrl\")." "-endif." > $(APP)/include/blue.hrl
  2197. $t printf "%s\n" "-ifndef(RED_HRL_LOADED)." "-define(RED_HRL_LOADED,true)." "-include_lib(\"blue.hrl\")." "-endif." > $(APP)/include/red.hrl
  2198. $i "Generate .erl files dependent from headers"
  2199. $t printf "%s\n" "-module(use_blue)." "-include_lib(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  2200. $t printf "%s\n" "-module(use_red)." "-include_lib(\"red.hrl\")." > $(APP)/src/use_red.erl
  2201. $i "Build the application"
  2202. $t $(MAKE) -C $(APP) $v ; ret=$$?
  2203. $i "Check .d file"
  2204. $t grep -q "src/use_blue.erl:: include/blue.hrl include/red.hrl; @touch" $(APP)/$(APP).d
  2205. $t grep -q "src/use_red.erl:: include/blue.hrl include/red.hrl; @touch" $(APP)/$(APP).d
  2206. core-app-hrl-multiapps-include-loop-define-protected: init
  2207. $i "Create a multi application repository with no root application"
  2208. $t mkdir $(APP)/
  2209. $t cp ../erlang.mk $(APP)/
  2210. $t echo "include erlang.mk" > $(APP)/Makefile
  2211. $i "Create a new application named my_app"
  2212. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  2213. $i "Create a new library named my_lib"
  2214. $t $(MAKE) -C $(APP) new-lib in=my_lib $v
  2215. $i "Add my_lib as LOCAL_DEPS of my_app"
  2216. $t echo "LOCAL_DEPS = my_lib" >> $(APP)/apps/my_app/Makefile
  2217. $i "Generate .hrl files"
  2218. $t mkdir $(APP)/apps/my_lib/include/
  2219. $t printf "%s\n" "-ifndef(BLUE_HRL_LOADED)." "-define(BLUE_HRL_LOADED,true)." "-include_lib(\"red.hrl\")." "-endif." > $(APP)/apps/my_lib/include/blue.hrl
  2220. $t printf "%s\n" "-ifndef(RED_HRL_LOADED)." "-define(RED_HRL_LOADED,true)." "-include_lib(\"blue.hrl\")." "-endif." > $(APP)/apps/my_lib/include/red.hrl
  2221. $i "Generate .erl files dependent from headers"
  2222. $t printf "%s\n" "-module(use_blue)." "-include_lib(\"my_lib/include/blue.hrl\")." > $(APP)/apps/my_app/src/use_blue.erl
  2223. $t printf "%s\n" "-module(use_red)." "-include_lib(\"my_lib/include/red.hrl\")." > $(APP)/apps/my_app/src/use_red.erl
  2224. $i "Build the application"
  2225. $t $(MAKE) -C $(APP) $v
  2226. $i "Check that all compiled files exist"
  2227. $t test -f $(APP)/apps/my_app/my_app.d
  2228. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  2229. $t test -f $(APP)/apps/my_app/ebin/use_blue.beam
  2230. $t test -f $(APP)/apps/my_app/ebin/use_red.beam
  2231. $i "Check that the application was compiled correctly"
  2232. $t $(ERL) -pa $(APP)/apps/my_app/ebin/ $(APP)/apps/my_lib/ebin/ -eval " \
  2233. {ok, _Apps } = application:ensure_all_started(my_app), \
  2234. {ok, Mods = [use_blue, use_red]} \
  2235. = application:get_key(my_app, modules), \
  2236. [{module, M} = code:load_file(M) || M <- Mods], \
  2237. halt()"
  2238. $i "Touch one .hrl file; check that only required files are rebuilt"
  2239. # The use_red.erl gets touched because of its dependency to red.hrl.
  2240. $t printf "%s\n" \
  2241. $(APP)/apps/my_app/my_app.d \
  2242. $(APP)/apps/my_app/ebin/my_app.app \
  2243. $(APP)/apps/my_app/ebin/use_red.beam \
  2244. $(APP)/apps/my_app/src/use_red.erl \
  2245. $(APP)/apps/my_app/src/use_blue.erl \
  2246. $(APP)/apps/my_app/ebin/use_blue.beam | sort > $(APP)/EXPECT
  2247. $t $(SLEEP)
  2248. $t touch $(APP)/apps/my_lib/include/red.hrl
  2249. $t $(SLEEP)
  2250. $t $(MAKE) -C $(APP) $v
  2251. $t find $(APP)/apps/my_app -type f -newer $(APP)/apps/my_lib/include/red.hrl | sort | diff $(APP)/EXPECT -
  2252. $t rm $(APP)/EXPECT
  2253. $i "Check that the application was compiled correctly"
  2254. $t $(ERL) -pa $(APP)/apps/my_app/ebin/ $(APP)/apps/my_lib/ebin/ -eval " \
  2255. {ok, _Apps } = application:ensure_all_started(my_app), \
  2256. {ok, Mods = [use_blue, use_red]} \
  2257. = application:get_key(my_app, modules), \
  2258. [{module, M} = code:load_file(M) || M <- Mods], \
  2259. halt()"
  2260. $i "Clean the application"
  2261. $t $(MAKE) -C $(APP) clean $v
  2262. $i "Check that source files still exist"
  2263. $t test -f $(APP)/Makefile
  2264. $t test -f $(APP)/erlang.mk
  2265. $t test -f $(APP)/apps/my_lib/Makefile
  2266. $t test -f $(APP)/apps/my_lib/include/blue.hrl
  2267. $t test -f $(APP)/apps/my_lib/include/red.hrl
  2268. $t test -f $(APP)/apps/my_app/Makefile
  2269. $t test -f $(APP)/apps/my_app/src/use_blue.erl
  2270. $t test -f $(APP)/apps/my_app/src/use_red.erl
  2271. ifdef LEGACY
  2272. $t test -f $(APP)/apps/my_lib/src/my_lib.app.src
  2273. $t test -f $(APP)/apps/my_app/src/my_app.app.src
  2274. endif
  2275. $i "Check that all build artifacts are removed"
  2276. $t test ! -e $(APP)/apps/my_lib/my_app.d
  2277. $t test ! -e $(APP)/apps/my_lib/ebin/
  2278. $t test ! -e $(APP)/apps/my_app/my_app.d
  2279. $t test ! -e $(APP)/apps/my_app/ebin/
  2280. $i "Build the application again"
  2281. $t $(MAKE) -C $(APP) $v
  2282. $i "Check that all compiled files exist"
  2283. $t test -f $(APP)/apps/my_app/my_app.d
  2284. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  2285. $t test -f $(APP)/apps/my_app/ebin/use_blue.beam
  2286. $t test -f $(APP)/apps/my_app/ebin/use_red.beam
  2287. $i "Check that the application was compiled correctly"
  2288. $t $(ERL) -pa $(APP)/apps/my_app/ebin/ $(APP)/apps/my_lib/ebin/ -eval " \
  2289. {ok, _Apps } = application:ensure_all_started(my_app), \
  2290. {ok, Mods = [use_blue, use_red]} \
  2291. = application:get_key(my_app, modules), \
  2292. [{module, M} = code:load_file(M) || M <- Mods], \
  2293. halt()"
  2294. core-app-test-build-outofdate-files-only: init
  2295. $i "Bootstrap a new OTP library named $(APP)"
  2296. $t mkdir $(APP)/
  2297. $t cp ../erlang.mk $(APP)/
  2298. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  2299. $i "Generate .erl test files"
  2300. $t mkdir $(APP)/test/
  2301. $t printf "%s\n" "-module(use_blue)." > $(APP)/test/use_blue.erl
  2302. $t printf "%s\n" "-module(use_red)." > $(APP)/test/use_red.erl
  2303. $i "Build the application testsuite"
  2304. $t $(MAKE) -C $(APP) test-build $v
  2305. $i "Check that all compiled files exist"
  2306. $t test -f $(APP)/test/use_blue.beam
  2307. $t test -f $(APP)/test/use_red.beam
  2308. $t $(SLEEP)
  2309. $t touch $(APP)/build-1
  2310. $i "Re-un the make command; check that nothing is rebuilt"
  2311. $t $(MAKE) -C $(APP) test-build $v
  2312. $t test $(APP)/test/use_blue.beam -ot $(APP)/build-1
  2313. $t test $(APP)/test/use_red.beam -ot $(APP)/build-1
  2314. $i "Touch one .erl file; check that only required files are rebuilt"
  2315. $t $(SLEEP)
  2316. $t touch $(APP)/test/use_blue.erl
  2317. $t $(MAKE) -C $(APP) test-build $v
  2318. $t test $(APP)/test/use_blue.beam -nt $(APP)/build-1
  2319. $t test $(APP)/test/use_red.beam -ot $(APP)/build-1
  2320. $t touch $(APP)/build-2
  2321. $i "Touch one Makefile; check that all files are rebuilt"
  2322. $t $(SLEEP)
  2323. $t touch $(APP)/Makefile
  2324. $t $(MAKE) -C $(APP) test-build $v
  2325. $t test $(APP)/test/use_blue.beam -nt $(APP)/build-2
  2326. $t test $(APP)/test/use_red.beam -nt $(APP)/build-2
  2327. $i "Add a syntax error to the test; check that the build fails"
  2328. $t $(SLEEP)
  2329. $t echo "garbage" >> $(APP)/test/use_blue.erl
  2330. $t ! $(MAKE) -C $(APP) test-build $v
  2331. $t ! test -f $(APP)/test/use_blue.beam