| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2019 Ericsson Telecom AB // |
| // // |
| // All rights reserved. This program and the accompanying materials // |
| // are made available under the terms of the Eclipse Public License v2.0 // |
| // which accompanies this distribution, and is available at // |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // Module: EPTF_Base_restartPart2_Test_Testcases |
| // |
| // Purpose: |
| // This module contains testcase for testing the restart functionality of EPTF Base. |
| // |
| // Module Parameters: |
| // - |
| // Module depends on: |
| // <EPTF_CLL_Base_Definitions> |
| // <EPTF_CLL_Base_Functions> |
| // |
| // Current Owner: |
| // Zoltan Zsichla (ezolzsi) |
| // |
| // Last Review Date: |
| // - |
| // |
| // Detailed Comments: |
| // tc_EPTF_Base_Test_restartPart1() can be found in EPTF_Base_restartPart1_Test project. |
| // tc_EPTF_Base_Test_restartPart2() can be found in EPTF_Base_restartPart2_Test project. |
| // |
| /////////////////////////////////////////////////////////// |
| module EPTF_Base_restartPart2_Test_Testcases { |
| |
| //========================================================================= |
| // Import Part |
| //========================================================================= |
| import from EPTF_CLL_Base_Definitions all; |
| import from EPTF_CLL_Base_Functions all; |
| //========================================================================= |
| //Component Types |
| //========================================================================= |
| type component Base_restartPart2_Test_CT extends EPTF_Base_CT {} |
| //========================================================================= |
| // Testcases |
| //========================================================================= |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_EPTF_Base_Test_restartPart2 |
| // |
| // Purpose: |
| // Checks the result of the restart which is triggered by tc_EPTF_Base_Test_restartPart1 |
| // |
| // Requirement: |
| // It must run after tc_EPTF_Base_Test_restartPart1 in EPTF_Base_restartPart1_Test project. |
| // |
| // Detailed Comments: |
| // It checks what does the output file of its pair test case tc_EPTF_Base_Test_restartPart1 (it can be found in EPTF_Base_restartPart1_Test project) contain. |
| // File content should be "restart done" string, if the restart was successful. Finally it removes this file. |
| // |
| // Expected Result: |
| // pass verdict |
| /////////////////////////////////////////////////////////// |
| testcase tc_EPTF_Base_Test_restartPart2() runs on Base_restartPart2_Test_CT { |
| f_EPTF_Base_init_CT("restartPart2"); |
| |
| var charstring vl_stdOut := ""; |
| var charstring vl_stdErr := ""; |
| var charstring vl_filename := "/tmp/EPTF_Base_Test_restart.log"; |
| var charstring vl_command := "cat "&vl_filename; |
| |
| timer t_wait := 3.0; |
| t_wait.start; t_wait.timeout; // wait for the "restarted" process to finish which was started by tc_EPTF_Base_Test_restartPart1 |
| if(f_EPTF_Base_executeShell(vl_command, vl_stdOut, vl_stdErr) != 0){ |
| setverdict(inconc, "Command: "&vl_command&" is not executed, because of: ",vl_stdErr); |
| f_EPTF_Base_stop(none); |
| } |
| var charstring vl_restartResult := vl_stdOut; |
| vl_command := "rm -f "&vl_filename; |
| if(f_EPTF_Base_executeShell(vl_command, vl_stdOut, vl_stdErr) != 0){ |
| setverdict(inconc, "Command: "&vl_command&" is not executed, because of: ",vl_stdErr); |
| f_EPTF_Base_stop(none); |
| } |
| if(vl_restartResult != "restart done\n"){ |
| setverdict(fail,"Restart was unsuccessful"); |
| f_EPTF_Base_stop(none); |
| } |
| setverdict(pass, "Restart was successful"); |
| f_EPTF_Base_stop(none); |
| } |
| |
| //========================================================================= |
| // Control |
| //========================================================================= |
| control { |
| execute(tc_EPTF_Base_Test_restartPart2()); |
| } // end of control |
| } // end of module |