From f803a23257767002ee1848e8e969be04adddad72 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Wed, 14 Oct 2020 13:49:56 +0200 Subject: [PATCH] Give an error when the amount of processes is zero, could be that there is a defunct process with the same name, also kill possible processes with the optional name * tests/locality_manager/in_process/check_lm.sh: * tests/locality_manager/in_process/run_test.pl: * tests/locality_manager/process_name/check_process_name.sh: * tests/locality_manager/process_name/run_test.pl: * tests/locality_manager/process_name/run_test_snl.pl: --- tests/locality_manager/in_process/check_lm.sh | 12 ++++++------ tests/locality_manager/in_process/run_test.pl | 1 + .../process_name/check_process_name.sh | 2 +- tests/locality_manager/process_name/run_test.pl | 1 + tests/locality_manager/process_name/run_test_snl.pl | 1 + 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/locality_manager/in_process/check_lm.sh b/tests/locality_manager/in_process/check_lm.sh index 3d6f36b..9c0b08a 100755 --- a/tests/locality_manager/in_process/check_lm.sh +++ b/tests/locality_manager/in_process/check_lm.sh @@ -1,16 +1,16 @@ #!/bin/sh cmd_output1=$(ps ax | grep "dancex11_deployment_manager.*dancex11_locality_dm_handler") -cmd_output=$(echo "$cmd_output1" | grep -c "dancex11_deployment_manager.*-n.*LocalityInstance") +cmd_output=$(echo "$cmd_output1" | grep -c "dancex11_deployment_manager.*-n.*LocalityInstance") if [ "$cmd_output" == "0" ] ; then echo "Success! The NM have been contacted and no LM have been spawned."; - + rc=0 - + cmd_output=$(ps auxc | grep NM_with_inproce | wc -l) - - if [ "$cmd_output" -ne "1" ] ; then + + if [ "$cmd_output" -eq "0" ] ; then echo "ERROR: Process name does not appear to have changed." echo "Process listing:" ps auxc @@ -18,7 +18,7 @@ if [ "$cmd_output" == "0" ] ; then else echo "Success! NM Process name appears to have been changed appropriately."; fi - + exit $rc else echo "ERROR: Unexpected number of LM processes detected:" diff --git a/tests/locality_manager/in_process/run_test.pl b/tests/locality_manager/in_process/run_test.pl index a1af1c2..faaba63 100755 --- a/tests/locality_manager/in_process/run_test.pl +++ b/tests/locality_manager/in_process/run_test.pl @@ -105,6 +105,7 @@ sub kill_open_processes { } # in case shutdown did not perform as expected $tg_daemon->KillAll ('dancex11_deployment_manager'); + $tg_daemon->KillAll ('NM_with_inprocess_LM'); } sub run_node_daemon { diff --git a/tests/locality_manager/process_name/check_process_name.sh b/tests/locality_manager/process_name/check_process_name.sh index 5d43bec..fe78028 100755 --- a/tests/locality_manager/process_name/check_process_name.sh +++ b/tests/locality_manager/process_name/check_process_name.sh @@ -2,7 +2,7 @@ cmd_output=$(ps auxc | grep newlocality_tes | wc -l) -if [ "$cmd_output" -ne "1" ] ; then +if [ "$cmd_output" -eq "0" ] ; then echo "ERROR: Process name does not appear to have changed." echo "Process listing:" ps auxc diff --git a/tests/locality_manager/process_name/run_test.pl b/tests/locality_manager/process_name/run_test.pl index ccb9da9..b22a1b3 100755 --- a/tests/locality_manager/process_name/run_test.pl +++ b/tests/locality_manager/process_name/run_test.pl @@ -105,6 +105,7 @@ sub kill_open_processes { } # in case shutdown did not perform as expected $tg_daemon->KillAll ('dancex11_deployment_manager'); + $tg_daemon->KillAll ('newlocality_test'); } sub run_node_daemon { diff --git a/tests/locality_manager/process_name/run_test_snl.pl b/tests/locality_manager/process_name/run_test_snl.pl index 5d5d1c3..806509a 100755 --- a/tests/locality_manager/process_name/run_test_snl.pl +++ b/tests/locality_manager/process_name/run_test_snl.pl @@ -77,6 +77,7 @@ sub kill_open_processes { # in case shutdown did not perform as expected for ($i = 0; $i < $nr_daemon; ++$i) { $tg_daemons[$i]->KillAll ('dancex11_deployment_manager'); + $tg_daemons[$i]->KillAll ('newlocality_test'); } }