@@ -73,11 +73,22 @@ test_start(Opts) ->
7373 AVMElements = test :get_avm_elements (AVMPath ),
7474
7575 3 = length (AVMElements ),
76- [MyAppBeam , StartBeam , MyAppApplicationBin ] = AVMElements ,
77-
76+ [BeamA , BeamB , MyAppApplicationBin ] = AVMElements ,
77+
78+ % Both BeamA and BeamB contain start/0 and are currently moved first
79+ % by atomvm_packbeam_provider. Which one is sorted before the other is not
80+ % defined.
81+ {MyAppBeam , StartBeam } =
82+ case {BeamA , BeamB } of
83+ {[{module , myapp } | _ ], [{module , start } | _ ]} -> {BeamA , BeamB };
84+ {[{module , start } | _ ], [{module , myapp } | _ ]} -> {BeamB , BeamA }
85+ end ,
86+
87+ {module , myapp } = hd (MyAppBeam ),
7888 true = packbeam_api :is_beam (MyAppBeam ),
7989 true = packbeam_api :is_entrypoint (MyAppBeam ),
8090
91+ {module , start } = hd (StartBeam ),
8192 true = packbeam_api :is_beam (StartBeam ),
8293 true = packbeam_api :is_entrypoint (StartBeam ),
8394
@@ -86,14 +97,30 @@ test_start(Opts) ->
8697
8798 % %
8899 % % Now specify `-s start` to get the start module first
100+ % % In this case, packbeam will only make one beam an entrypoint
89101 % %
90102
91103 Cmd2 = create_packbeam_cmd (AppDir , [" -f" , {" -s" , " start" }], []),
92104 _Output2 = test :execute_cmd (Cmd2 , Opts ),
93105 AVMElements2 = test :get_avm_elements (AVMPath ),
94106
95107 3 = length (AVMElements2 ),
96- [StartBeam , MyAppBeam , MyAppApplicationBin ] = AVMElements2 ,
108+ [StartBeam1 , MyAppBeam1 , MyAppApplicationBin1 ] = AVMElements2 ,
109+
110+ {module , start } = hd (StartBeam1 ),
111+ true = packbeam_api :is_beam (StartBeam1 ),
112+ true = packbeam_api :is_entrypoint (StartBeam1 ),
113+ StartBeam1 = StartBeam ,
114+
115+ {module , myapp } = hd (MyAppBeam1 ),
116+ true = packbeam_api :is_beam (MyAppBeam1 ),
117+ % Whether the second beam is an entrypoint is not verified by
118+ % packbeam tests and becomes true with 0.8.0
119+ % false = packbeam_api:is_entrypoint(MyAppBeam1),
120+
121+ false = packbeam_api :is_beam (MyAppApplicationBin1 ),
122+ false = packbeam_api :is_entrypoint (MyAppApplicationBin1 ),
123+ MyAppApplicationBin1 = MyAppApplicationBin ,
97124
98125 test :tick ().
99126
@@ -158,14 +185,27 @@ test_rebar_overrides(Opts) ->
158185 AVMElements = test :get_avm_elements (AVMPath ),
159186
160187 3 = length (AVMElements ),
161- [StartBeam , MyAppBeam , MyAppApplicationBin ] = AVMElements ,
162-
163- true = packbeam_api :is_beam (MyAppBeam ),
164- true = packbeam_api :is_entrypoint (MyAppBeam ),
165-
188+ [BeamA , BeamB , MyAppApplicationBin ] = AVMElements ,
189+
190+ % Both BeamA and BeamB contain start/0 and are currently moved first
191+ % by atomvm_packbeam_provider. Which one is sorted before the other is not
192+ % defined.
193+ {MyAppBeam , StartBeam } =
194+ case {BeamA , BeamB } of
195+ {[{module , myapp } | _ ], [{module , start } | _ ]} -> {BeamA , BeamB };
196+ {[{module , start } | _ ], [{module , myapp } | _ ]} -> {BeamB , BeamA }
197+ end ,
198+
199+ {module , start } = hd (StartBeam ),
166200 true = packbeam_api :is_beam (StartBeam ),
167201 true = packbeam_api :is_entrypoint (StartBeam ),
168202
203+ {module , myapp } = hd (MyAppBeam ),
204+ true = packbeam_api :is_beam (MyAppBeam ),
205+ % Whether the second beam is not an entrypoint is not verified by
206+ % packbeam tests and becomes true with 0.8.0
207+ % false = packbeam_api:is_entrypoint(MyAppBeam),
208+
169209 false = packbeam_api :is_beam (MyAppApplicationBin ),
170210 false = packbeam_api :is_entrypoint (MyAppApplicationBin ),
171211
@@ -178,7 +218,18 @@ test_rebar_overrides(Opts) ->
178218 AVMElements2 = test :get_avm_elements (AVMPath ),
179219
180220 3 = length (AVMElements2 ),
181- [MyAppBeam , StartBeam , MyAppApplicationBin ] = AVMElements2 ,
221+ [MyAppBeam1 , StartBeam1 , MyAppApplicationBin1 ] = AVMElements2 ,
222+
223+ true = packbeam_api :is_beam (MyAppBeam1 ),
224+ true = packbeam_api :is_entrypoint (MyAppBeam1 ),
225+
226+ true = packbeam_api :is_beam (StartBeam1 ),
227+ % Whether the second beam is not an entrypoint is not verified by
228+ % packbeam tests and becomes true with 0.8.0
229+ % false = packbeam_api:is_entrypoint(StartBeam1),
230+
231+ false = packbeam_api :is_beam (MyAppApplicationBin1 ),
232+ false = packbeam_api :is_entrypoint (MyAppApplicationBin1 ),
182233
183234 test :tick ().
184235
0 commit comments