#!/bin/bash
###############################################################################
##
## Copyright (c) INRIA, 2007
##
## This program is free software;  you can redistribute it and#or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program;  if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
###############################################################################
#
# Description:  Test program for Kerrighed checkpoint/restart of single
#               process.
#
# Author:       Matthieu Fertré, matthieu.fertre@irisa.fr
#

source `dirname $0`/lib_cr.sh

description="Checkpoint restarted process (+migr): Run, Migr, C, K, R, C"

# Checkpoint restarted process (+migr): Run, Migr, C, K, R, C
cr19()
{
    TCID="$FUNCNAME"               # Identifier of this testcase.
    TST_COUNT=$[$TST_COUNT+1]      # Test case number.

    skip_test_if_only_one_node
    if [ $? -eq 0 ]; then
	return 0
    fi

    runcommand +CHECKPOINTABLE,CAN_MIGRATE || return $?

    migrate_process $PID $TESTCMD || return $?

    checkpoint_process $PID $TESTCMD || return $?

    kill_group $PID $TESTCMD || return $?

    restart_process $PID 1 $TESTCMD || return $?

    checkpoint_process $PID $TESTCMD || return $?

    kill_group $PID $TESTCMD || return $?

    print_success $?
    return $?
}

CR_setup $@ || exit $?

cr19 || exit $?
