@@ -187,23 +187,26 @@ init([]) ->
187187% % If none are specified, run everything
188188handle_call ({load_from_giddyup , Backends , CommandLineTests }, _From , State ) ->
189189 AllGiddyupTests = giddyup :get_test_plans (),
190- FilteredNames = case CommandLineTests of
190+ { Included , Excluded } = case CommandLineTests of
191191 [] ->
192- AllGiddyupTests ;
192+ { AllGiddyupTests , []} ;
193193 _ ->
194- [TestPlan || TestPlan <- AllGiddyupTests ,
195- CName <- CommandLineTests ,
196- rt_test_plan :get_module (TestPlan ) =:= CName ]
194+ Inc = [TestPlan || TestPlan <- AllGiddyupTests ,
195+ CName <- CommandLineTests ,
196+ rt_test_plan :get_module (TestPlan ) =:= CName ],
197+ {Inc , lists :filter (fun (Elem ) -> not lists :member (Elem , Inc ) end , AllGiddyupTests )}
197198 end ,
198- FilteredTests = case Backends of
199+ { Included1 , Excluded1 } = case Backends of
199200 undefined ->
200- FilteredNames ;
201+ { Included , Excluded } ;
201202 _ ->
202- [TestPlan || TestPlan <- FilteredNames ,
203- lists :member (rt_test_plan :get (backend , TestPlan ), Backends )]
203+ Inc1 = [TestPlan || TestPlan <- Included ,
204+ lists :member (rt_test_plan :get (backend , TestPlan ), Backends )],
205+ {Inc1 , lists :filter (fun (Elem ) -> not lists :member (Elem , Inc1 ) end , AllGiddyupTests )}
204206 end ,
205- State1 = lists :foldl (fun sort_and_queue /2 , State , FilteredTests ),
206- {reply , ok , State1 };
207+ State1 = lists :foldl (fun sort_and_queue /2 , State , Included1 ),
208+ State2 = lists :foldl (fun exclude_test_plan /2 , State1 , Excluded1 ),
209+ {reply , ok , State2 };
207210% % Add a single test plan to the queue
208211handle_call ({add_test_plan , Module , Platform , Backends , _Version , _Properties }, _From , State ) ->
209212 State1 = lists :foldl (fun (Backend , AccState ) ->
@@ -330,3 +333,13 @@ is_runnable_test_plan(TestPlan) ->
330333 code :ensure_loaded (Mod ),
331334 erlang :function_exported (Mod , Fun , 0 ) orelse
332335 erlang :function_exported (Mod , Fun , 1 ).
336+
337+ % %--------------------------------------------------------------------
338+ % % @private
339+ % % @doc
340+ % % Add a unused test to the list of non_runnable_test_plans
341+ % % @end
342+ % %--------------------------------------------------------------------
343+ exclude_test_plan (TestPlan , State ) ->
344+ QNR = queue :in (TestPlan , State # state .non_runnable_test_plans ),
345+ State # state {non_runnable_test_plans = QNR }.
0 commit comments