1: %%
    2: %% %CopyrightBegin%
    3: %% 
    4: %% Copyright Ericsson AB 2006-2011. All Rights Reserved.
    5: %% 
    6: %% The contents of this file are subject to the Erlang Public License,
    7: %% Version 1.1, (the "License"); you may not use this file except in
    8: %% compliance with the License. You should have received a copy of the
    9: %% Erlang Public License along with this software. If not, it can be
   10: %% retrieved online at http://www.erlang.org/.
   11: %% 
   12: %% Software distributed under the License is distributed on an "AS IS"
   13: %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
   14: %% the License for the specific language governing rights and limitations
   15: %% under the License.
   16: %% 
   17: %% %CopyrightEnd%
   18: %%
   19: 
   20: %%%-------------------------------------------------------------------
   21: %%% File    : a_SUITE.erl
   22: %%% Author  : Rickard Green <rickard.s.green@ericsson.com>
   23: %%% Description : Misc tests that should be run first
   24: %%%
   25: %%% Created : 21 Aug 2006 by Rickard Green <rickard.s.green@ericsson.com>
   26: %%%-------------------------------------------------------------------
   27: -module(a_SUITE).
   28: 
   29: -include_lib("test_server/include/test_server.hrl").
   30: 
   31: -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, 
   32: 	 init_per_group/2,end_per_group/2, long_timers/1, pollset_size/1]).
   33: 
   34: suite() -> [{ct_hooks,[ts_install_cth]}].
   35: 
   36: all() -> 
   37:     [long_timers, pollset_size].
   38: 
   39: groups() -> 
   40:     [].
   41: 
   42: init_per_suite(Config) ->
   43:     Config.
   44: 
   45: end_per_suite(_Config) ->
   46:     ok.
   47: 
   48: init_per_group(_GroupName, Config) ->
   49:     Config.
   50: 
   51: end_per_group(_GroupName, Config) ->
   52:     Config.
   53: 
   54: 
   55: long_timers(doc) ->
   56:     [];
   57: long_timers(suite) ->
   58:     [];
   59: long_timers(Config) when is_list(Config) ->
   60:     Dir = ?config(data_dir, Config),
   61:     ?line long_timers_test:start(Dir),
   62:     ?line {comment,
   63: 	   "Testcase started! This test will run in parallel with the "
   64: 	   "erts testsuite and ends in the z_SUITE:long_timers testcase."}.
   65: 
   66: pollset_size(doc) ->
   67:     [];
   68: pollset_size(suite) ->
   69:     [];
   70: pollset_size(Config) when is_list(Config) ->
   71:     %% Ensure inet_gethost_native port program started, in order to
   72:     %% allow other suites to use it...
   73:     inet_gethost_native:gethostbyname("localhost"),
   74:     ?line Parent = self(),
   75:     ?line Go = make_ref(),
   76:     ?line spawn(fun () ->
   77: 			Name = pollset_size_testcase_initial_state_holder,
   78: 			true = register(Name, self()),
   79: 			ChkIo = get_check_io_info(),
   80: 			io:format("Initial: ~p~n", [ChkIo]),
   81: 			Parent ! Go,
   82: 			receive
   83: 			    {get_initial_check_io_result, Pid} ->
   84: 				Pid ! {initial_check_io_result, ChkIo}
   85: 			end
   86: 		end),
   87:     ?line receive Go -> ok end,
   88:     ?line {comment,
   89: 	   "Testcase started! This test will run in parallel with the "
   90: 	   "erts testsuite and ends in the z_SUITE:pollset_size testcase."}.
   91: 
   92: %%
   93: %% Internal functions...
   94: %%
   95: 
   96: display_check_io(ChkIo) ->
   97:     catch erlang:display('--- CHECK IO INFO ---'),
   98:     catch erlang:display(ChkIo),
   99:     catch erts_debug:set_internal_state(available_internal_state, true),
  100:     NoOfErrorFds = (catch erts_debug:get_internal_state(check_io_debug)),
  101:     catch erlang:display({'NoOfErrorFds', NoOfErrorFds}),
  102:     catch erts_debug:set_internal_state(available_internal_state, false),
  103:     catch erlang:display('--- CHECK IO INFO ---'),
  104:     ok.
  105: 
  106: get_check_io_info() ->
  107:     ChkIo = erlang:system_info(check_io),
  108:     case lists:keysearch(pending_updates, 1, ChkIo) of
  109: 	{value, {pending_updates, 0}} ->
  110: 	    display_check_io(ChkIo),
  111: 	    ChkIo;
  112: 	false ->
  113: 	    ChkIo;
  114: 	_ ->
  115: 	    receive after 10 -> ok end,
  116: 	    get_check_io_info()
  117:     end.
  118: 
  119: