The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tapper::MCP::State

SYNOPSIS

 use Tapper::MCP::State;
 my $state_handler = Tapper::MCP::State->new($testrun_id);
 my $state = $state_handler->get_current_state();
 $self->compare_given_state($state);

NAME

Tapper::MCP::State - Keep state information for one specific test run

FUNCTIONS

is_msg_valid

Check whether received message is valid in current state.

@param hash ref - message

@return valid - 1 @return invalid - 0

compare_given_state

Compare the current state to a given state name. Return -1 if the given state is earlier then the current, 1 if the current state is earlier then the given one and 0 if both are equal.

@param string - state name

@return current state is earlier - 1 @return given state is earlier - -1 @return states are equal - 0

get_current_timeout_span

Returns the time in seconds until the next timeout hits. When multiple timeouts are currently running (during test with multiple PRCs) the lowest of these timeouts is choosen. This value can be used for sleeping in reads.

@return int - timeout span in seconds

state_init

Initialize the state or reload it from database.

@param hash ref - initial state data (ignored in revive mode) @param bool - are we in revive mode?

@return success - 0 @return error - error string

update_installer_timeout

Update the timeout during installation.

@return success - (0, timeout span for next state change) @return error - (1, undef)

update_prc_timeout

Check and update timeouts for one PRC.

@param int - PRC number

@return success - new timeout @return error - undef

update_test_timeout

Update timeouts during test phase.

@return success - (1, new timeout) @return error - (0, undef)

update_keep_alive_timeout

Check whether keep-alive timeout has ended and if so, act accordingly.

@return success - (0, timeout span for next state change) @return error - (1, undef)

update_timeouts

Update the timeouts in $self->state_details structure.

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_takeoff

The reboot call was successfully executed, now update the state for waiting for the first message.

@param hash ref - message

@return success - (0, timeout span for next state change)

msg_start_install

Handle message start-install

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_end_install

Handle message end-install

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_error_install

Handle message error-install

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_warn_install

Handle message error-install

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_error_guest

Handle message error-guest

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_start_guest

Handle message start-guest

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_start_testing

Handle message start-testing

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_end_testing

Handle message end-testing

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_end_testprogram

Handle message end-testprogram

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_error_testprogram

Handle message error-testprogram

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_reboot

Handle message reboot

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

msg_quit

Handle message quit

@param hash ref - message

@return (1, undef)

msg_keep_alive

Handle message keep-alive. This function does not return anything because the caller ignores the return value anyway.

@param hash ref - message

next_state

Update state machine based on message.

@param Result class - message

@return success - 1 @return error - undef

Update the state based on a message received from caller. The function returns a timeout span value that is the lowest of all currently active timeouts. The given message can be empty. In this case only timeouts are checked and updated if needed.

@param hash ref - message

@return success - (0, timeout span for next state change) @return error - (1, undef)

testrun_finished

Tells caller whether the testrun is already finished or not.

@return TR finished - 1 @return TR not finished - 0

AUTHOR

AMD OSRC Tapper Team <tapper@amd64.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2012 by Advanced Micro Devices, Inc..

This is free software, licensed under:

  The (two-clause) FreeBSD License