From 59ff693dd6967c0c76ab33dae564022420f4770b Mon Sep 17 00:00:00 2001 From: George Milescu Date: Fri, 6 Aug 2010 19:27:43 +0200 Subject: [PATCH] checked all sourced filed prior to them being sourced Signed-off-by: George Milescu --- ConfigFiles/globalconfig | 20 +++++++++++-------- .../clients/hrk/start_hrk_leecher.sh | 9 +++++++-- .../clients/hrk/start_hrk_seeder.sh | 9 +++++++-- .../clients/tribler/start_tribler_doe.sh | 9 +++++++-- .../clients/tribler/start_tribler_leecher.sh | 9 +++++++-- .../clients/tribler/start_tribler_proxy.sh | 9 +++++++-- .../clients/tribler/start_tribler_seeder.sh | 10 ++++++++-- ControlScripts/detect_complete_client.sh | 16 ++++++++++++--- ControlScripts/parse_client_log.sh | 7 ++++++- ControlScripts/post-run.sh | 9 +++++++-- ControlScripts/post-run_ct.sh | 9 +++++++-- ControlScripts/post-run_nop.sh | 10 ++++++++-- ControlScripts/pre-run.ch | 8 -------- ControlScripts/pre-run.sh | 15 ++++++++++++++ ControlScripts/pre-run_ct.ch | 10 ---------- ControlScripts/pre-run_ct.sh | 15 ++++++++++++++ ControlScripts/pre-run_nop.sh | 10 +++++++--- ControlScripts/run_scenario.sh | 6 +++--- ControlScripts/schedule_client.sh | 16 ++++++++++++--- ControlScripts/start_tracker.sh | 3 --- ControlScripts/stop_client.sh | 16 ++++++++++++--- Utils/grep_search.sh | 2 +- Utils/show_version.sh | 2 +- .../tribler => Utils}/start_tribler_gui.sh | 5 +---- 24 files changed, 165 insertions(+), 69 deletions(-) delete mode 100755 ControlScripts/pre-run.ch create mode 100755 ControlScripts/pre-run.sh delete mode 100755 ControlScripts/pre-run_ct.ch create mode 100755 ControlScripts/pre-run_ct.sh rename {ControlScripts/clients/tribler => Utils}/start_tribler_gui.sh (83%) diff --git a/ConfigFiles/globalconfig b/ConfigFiles/globalconfig index 4973816..0ebded5 100644 --- a/ConfigFiles/globalconfig +++ b/ConfigFiles/globalconfig @@ -7,19 +7,23 @@ TESTING_INFRASTRUCTURE_ABS_PATH="/home/george/P2P-Next/P2P-Testing-Infrastructure" -# P2P_NEXT_REL_PATH is relative to ControlScripts folder +# P2P_NEXT_REL_PATH is relative to Utils folder - used by sync_* scripts P2P_NEXT_REL_PATH="../../" # The / at the end is important for rsync to work properly P2P_NEXT_ABS_PATH="/home/george/P2P-Next/" -# TEST_INFRASTRUCTURE_REL_PATH is relative to ControlScripts folder +# TEST_INFRASTRUCTURE_REL_PATH is relative to ControlScripts folder - used by run_scenario.sh TEST_INFRASTRUCTURE_REL_PATH="../../P2P-Testing-Infrastructure" # No / at the end is important for rsync to work properly TEST_INFRASTRUCTURE_ABS_PATH="/home/george/P2P-Next/P2P-Testing-Infrastructure" -# TRIBLER_REL_PATH is relative to ControlScripts folder -TRIBLER_REL_PATH="../../TriblerBranches/proxyservice-m32" -TRIBLER_ABS_PATH="/home/george/P2P-Next/TriblerBranches/proxyservice-m32" +# TRIBLER_REL_PATH is relative to ControlScripts/clients/ folder +TRIBLER_REL_PATH="../../../../TriblerBranches/proxyservice-5.3" +TRIBLER_ABS_PATH="/home/george/P2P-Next/TriblerBranches/proxyservice-5.3" + +# TRIBLER_UTIL_REL_PATH is relative to Util folder +TRIBLER_UTIL_REL_PATH="../../TriblerBranches/proxyservice-5.3" +TRIBLER_UTIL_ABS_PATH="/home/george/P2P-Next/TriblerBranches/proxyservice-5.3" # HRK_PATH HRK_ABS_PATH="/home/p2p/p2p-clients/hrktorrent/hrktorrent" @@ -30,13 +34,13 @@ HRK_LOG_ABS_PATH="/home/p2p/p2p-clients/hrktorrent-logging/hrktorrent" # WORKING_FOLDER_REL_PATH is relative to TRIBLER_ABS_PATH folder WORKING_FOLDER_REL_PATH="../../P2P-Testing-Infrastructure/ClientWorkingFolders" -# BITTORNADO_REL_PATH is relative to ControlScripts folder +# BITTORNADO_REL_PATH is relative to ControlScripts folder - used by start_tracker.sh BITTORNADO_REL_PATH="../../BTclients/BitTornado/BitTornado-CVS" -# CONFIG_FILES_REL_PATH is relative to ControlScripts folder +# CONFIG_FILES_REL_PATH is relative to ControlScripts folder - used by run_scenario.sh CONFIG_FILES_REL_PATH="../ConfigFiles" -# CONFIG_FILES_REL_PATH is relative to ControlScripts folder +# CONFIG_FILES_REL_PATH is relative to ControlScripts folder - used by run_campaign.sh RESULTS_FOLDER_REL_PATH="../Results" # DEBUG function diff --git a/ControlScripts/clients/hrk/start_hrk_leecher.sh b/ControlScripts/clients/hrk/start_hrk_leecher.sh index a891afb..b3c16b5 100755 --- a/ControlScripts/clients/hrk/start_hrk_leecher.sh +++ b/ControlScripts/clients/hrk/start_hrk_leecher.sh @@ -17,8 +17,13 @@ else source ../../../ConfigFiles/globalconfig fi -# Read scenarion configuration file (TORRENT_FILE) -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file (TORRENT_FILE) +# Check if the node-specific configuration file exists +if [ ! -e ../../../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../../../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../../../ClientWorkingFolders/TmpLogs/node_config +fi cd $WORKING_FOLDER_REL_PATH/Regular/ diff --git a/ControlScripts/clients/hrk/start_hrk_seeder.sh b/ControlScripts/clients/hrk/start_hrk_seeder.sh index f36e0a2..ab31826 100755 --- a/ControlScripts/clients/hrk/start_hrk_seeder.sh +++ b/ControlScripts/clients/hrk/start_hrk_seeder.sh @@ -17,8 +17,13 @@ else source ../../../ConfigFiles/globalconfig fi -# Read scenarion configuration file (TORRENT_FILE) -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file (TORRENT_FILE) +# Check if the node-specific configuration file exists +if [ ! -e ../../../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../../../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../../../ClientWorkingFolders/TmpLogs/node_config +fi cd $WORKING_FOLDER_REL_PATH/TorrentsAndData/ diff --git a/ControlScripts/clients/tribler/start_tribler_doe.sh b/ControlScripts/clients/tribler/start_tribler_doe.sh index 51ab1d5..ffa569f 100755 --- a/ControlScripts/clients/tribler/start_tribler_doe.sh +++ b/ControlScripts/clients/tribler/start_tribler_doe.sh @@ -16,8 +16,13 @@ else source ../../../ConfigFiles/globalconfig fi -# Read scenarion configuration file (TORRENT_FILE) -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file (TORRENT_FILE) +# Check if the node-specific configuration file exists +if [ ! -e ../../../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../../../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../../../ClientWorkingFolders/TmpLogs/node_config +fi export PYTHONPATH=$PYTHONPATH:. diff --git a/ControlScripts/clients/tribler/start_tribler_leecher.sh b/ControlScripts/clients/tribler/start_tribler_leecher.sh index c0cee87..5b686e8 100755 --- a/ControlScripts/clients/tribler/start_tribler_leecher.sh +++ b/ControlScripts/clients/tribler/start_tribler_leecher.sh @@ -16,8 +16,13 @@ else source ../../../ConfigFiles/globalconfig fi -# Read scenarion configuration file (TORRENT_FILE) -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file (TORRENT_FILE) +# Check if the node-specific configuration file exists +if [ ! -e ../../../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../../../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../../../ClientWorkingFolders/TmpLogs/node_config +fi export PYTHONPATH=$PYTHONPATH:. diff --git a/ControlScripts/clients/tribler/start_tribler_proxy.sh b/ControlScripts/clients/tribler/start_tribler_proxy.sh index 301510e..660ff38 100755 --- a/ControlScripts/clients/tribler/start_tribler_proxy.sh +++ b/ControlScripts/clients/tribler/start_tribler_proxy.sh @@ -24,8 +24,13 @@ else source ../../../ConfigFiles/globalconfig fi -# Read scenarion configuration file -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file +# Check if the node-specific configuration file exists +if [ ! -e ../../../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../../../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../../../ClientWorkingFolders/TmpLogs/node_config +fi # Read arguments PROXY_NO=$1 diff --git a/ControlScripts/clients/tribler/start_tribler_seeder.sh b/ControlScripts/clients/tribler/start_tribler_seeder.sh index b8e5f3f..fd0bd3b 100755 --- a/ControlScripts/clients/tribler/start_tribler_seeder.sh +++ b/ControlScripts/clients/tribler/start_tribler_seeder.sh @@ -15,8 +15,14 @@ else source ../../../ConfigFiles/globalconfig fi -# Read scenarion configuration file (TORRENT_FILE) -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file (TORRENT_FILE) +# Check if the node-specific configuration file exists +if [ ! -e ../../../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../../../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../../../ClientWorkingFolders/TmpLogs/node_config +fi + export PYTHONPATH=$PYTHONPATH:. diff --git a/ControlScripts/detect_complete_client.sh b/ControlScripts/detect_complete_client.sh index 294200b..4d7c960 100755 --- a/ControlScripts/detect_complete_client.sh +++ b/ControlScripts/detect_complete_client.sh @@ -24,11 +24,21 @@ else source ../ConfigFiles/globalconfig fi -# Read scenarion configuration file (CLIENT_TYPE) -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file (CLIENT_TYPE) +# Check if the node-specific configuration file exists +if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../ClientWorkingFolders/TmpLogs/node_config +fi # Read client mappings configuration file -source ../ConfigFiles/client_script_mappings +# Check if the client mappings configuration file exists +if [ ! -e ../ConfigFiles/client_script_mappings ]; then + echo "Warning: The client mappings config file ../ConfigFiles/client_script_mappings does not exist." +else + source ../ConfigFiles/client_script_mappings +fi log_file=$1 diff --git a/ControlScripts/parse_client_log.sh b/ControlScripts/parse_client_log.sh index 228b2ce..437acf5 100755 --- a/ControlScripts/parse_client_log.sh +++ b/ControlScripts/parse_client_log.sh @@ -25,7 +25,12 @@ else fi # Read client mappings configuration file -source ../ConfigFiles/client_script_mappings +# Check if the client mappings configuration file exists +if [ ! -e ../ConfigFiles/client_script_mappings ]; then + echo "Warning: The client mappings config file ../ConfigFiles/client_script_mappings does not exist." +else + source ../ConfigFiles/client_script_mappings +fi client_type=$1 log_folder=$2 diff --git a/ControlScripts/post-run.sh b/ControlScripts/post-run.sh index 6b02bb5..1c39f64 100755 --- a/ControlScripts/post-run.sh +++ b/ControlScripts/post-run.sh @@ -4,7 +4,12 @@ # # post-run script for local bandwidth limitation scenarios -# source configuration file -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file +# Check if the node-specific configuration file exists +if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../ClientWorkingFolders/TmpLogs/node_config +fi ./bw_limit.sh del ${IFACE} diff --git a/ControlScripts/post-run_ct.sh b/ControlScripts/post-run_ct.sh index 5a4ea20..b4926b3 100755 --- a/ControlScripts/post-run_ct.sh +++ b/ControlScripts/post-run_ct.sh @@ -4,7 +4,12 @@ # # post-run script for container bandwidth limitation scenarios -# source configuration file -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file +# Check if the node-specific configuration file exists +if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../ClientWorkingFolders/TmpLogs/node_config +fi ./bw_limit_ct.sh del ${IFACE} diff --git a/ControlScripts/post-run_nop.sh b/ControlScripts/post-run_nop.sh index 73b99f2..965b775 100755 --- a/ControlScripts/post-run_nop.sh +++ b/ControlScripts/post-run_nop.sh @@ -4,5 +4,11 @@ # # pre-run script for client-based limitation scenarios -# source configuration file -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file +# Check if the node-specific configuration file exists +if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../ClientWorkingFolders/TmpLogs/node_config +fi + diff --git a/ControlScripts/pre-run.ch b/ControlScripts/pre-run.ch deleted file mode 100755 index 657a952..0000000 --- a/ControlScripts/pre-run.ch +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# 2010, Razvan Deaconescu -# -# pre-run script for local bandwidth limitation scenarios - -# source configuration file -source ../ClientWorkingFolders/TmpLogs/scenario_config diff --git a/ControlScripts/pre-run.sh b/ControlScripts/pre-run.sh new file mode 100755 index 0000000..8ab88e1 --- /dev/null +++ b/ControlScripts/pre-run.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# 2010, Razvan Deaconescu +# +# pre-run script for local bandwidth limitation scenarios + +# Read the node-specific configuration file +# Check if the node-specific configuration file exists +if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../ClientWorkingFolders/TmpLogs/node_config +fi + +./bw_limit_ct.sh set ${IFACE} ${DL_BW} ${DL_BURST} ${UL_BW} ${UL_BURST} diff --git a/ControlScripts/pre-run_ct.ch b/ControlScripts/pre-run_ct.ch deleted file mode 100755 index a0165b8..0000000 --- a/ControlScripts/pre-run_ct.ch +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# 2010, Razvan Deaconescu -# -# pre-run script for container bandwidth limitation scenarios - -# source configuration file -source ../ClientWorkingFolders/TmpLogs/scenario_config - -./bw_limit_ct.sh set ${IFACE} ${DL_BW} ${DL_BURST} ${UL_BW} ${UL_BURST} diff --git a/ControlScripts/pre-run_ct.sh b/ControlScripts/pre-run_ct.sh new file mode 100755 index 0000000..f294763 --- /dev/null +++ b/ControlScripts/pre-run_ct.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# 2010, Razvan Deaconescu +# +# pre-run script for container bandwidth limitation scenarios + +# Read the node-specific configuration file +# Check if the node-specific configuration file exists +if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../ClientWorkingFolders/TmpLogs/node_config +fi + +./bw_limit_ct.sh set ${IFACE} ${DL_BW} ${DL_BURST} ${UL_BW} ${UL_BURST} diff --git a/ControlScripts/pre-run_nop.sh b/ControlScripts/pre-run_nop.sh index 779bd0a..965b775 100755 --- a/ControlScripts/pre-run_nop.sh +++ b/ControlScripts/pre-run_nop.sh @@ -4,7 +4,11 @@ # # pre-run script for client-based limitation scenarios -# source configuration file -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file +# Check if the node-specific configuration file exists +if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../ClientWorkingFolders/TmpLogs/node_config +fi -./bw_limit_ct.sh set ${IFACE} ${DL_BW} ${DL_BURST} ${UL_BW} ${UL_BURST} diff --git a/ControlScripts/run_scenario.sh b/ControlScripts/run_scenario.sh index 6bbb014..f6c2f62 100755 --- a/ControlScripts/run_scenario.sh +++ b/ControlScripts/run_scenario.sh @@ -108,7 +108,7 @@ scenario_setup() { # Create node config file if ! ssh -n -p ${PORT} ${USER}@${SERVER} " -cat > $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/scenario_config << END +cat > $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/node_config << END IFACE=\"${REMOTE_IF}\" DL_BW=\"${DL_BW}\" DL_BURST=\"${DL_BURST}\" @@ -196,8 +196,8 @@ scenario_clean() { fi # Remove node config file - if ! ssh -n -p ${PORT} ${USER}@${SERVER} "rm $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/scenario_config" &>> ${ERR_LOG}; then - echo "Error: cannot remove scenario_config file" + if ! ssh -n -p ${PORT} ${USER}@${SERVER} "rm $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/node_config" &>> ${ERR_LOG}; then + echo "Error: cannot remove node_config file" fi # Retrieve log files diff --git a/ControlScripts/schedule_client.sh b/ControlScripts/schedule_client.sh index 59ac82a..e445ccf 100755 --- a/ControlScripts/schedule_client.sh +++ b/ControlScripts/schedule_client.sh @@ -18,11 +18,21 @@ else source ../ConfigFiles/globalconfig fi -# Read scenarion configuration file -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration file +# Check if the node-specific configuration file exists +if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../ClientWorkingFolders/TmpLogs/node_config +fi # Read client mappings configuration file -source ../ConfigFiles/client_script_mappings +# Check if the client mappings configuration file exists +if [ ! -e ../ConfigFiles/client_script_mappings ]; then + echo "Warning: The client mappings config file ../ConfigFiles/client_script_mappings does not exist." +else + source ../ConfigFiles/client_script_mappings +fi client_pid=0 diff --git a/ControlScripts/start_tracker.sh b/ControlScripts/start_tracker.sh index 2f2173a..c1f2450 100755 --- a/ControlScripts/start_tracker.sh +++ b/ControlScripts/start_tracker.sh @@ -15,9 +15,6 @@ else source ../ConfigFiles/globalconfig fi -# Read scenarion configuration file -source ../ClientWorkingFolders/TmpLogs/scenario_config - export PYTHONPATH=$PYTHONPATH:. cd $BITTORNADO_REL_PATH diff --git a/ControlScripts/stop_client.sh b/ControlScripts/stop_client.sh index eab657e..27ab8ff 100755 --- a/ControlScripts/stop_client.sh +++ b/ControlScripts/stop_client.sh @@ -18,11 +18,21 @@ else source ../ConfigFiles/globalconfig fi -# Read scenarion configuration file (CLIENT_TYPE) -source ../ClientWorkingFolders/TmpLogs/scenario_config +# Read the node-specific configuration (CLIENT_TYPE) +# Check if the node-specific configuration file exists +if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then + echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist." +else + source ../ClientWorkingFolders/TmpLogs/node_config +fi # Read client mappings configuration file -source ../ConfigFiles/client_script_mappings +# Check if the client mappings configuration file exists +if [ ! -e ../ConfigFiles/client_script_mappings ]; then + echo "Warning: The client mappings config file ../ConfigFiles/client_script_mappings does not exist." +else + source ../ConfigFiles/client_script_mappings +fi stop_client ${CLIENT_TYPE} diff --git a/Utils/grep_search.sh b/Utils/grep_search.sh index 333bc71..04755e7 100755 --- a/Utils/grep_search.sh +++ b/Utils/grep_search.sh @@ -19,7 +19,7 @@ else source ../ConfigFiles/globalconfig fi -cd $TRIBLER_REL_PATH +cd $TRIBLER_UTIL_REL_PATH # -n: print line number # -I: ignore binary files diff --git a/Utils/show_version.sh b/Utils/show_version.sh index 2769d05..dd3e962 100755 --- a/Utils/show_version.sh +++ b/Utils/show_version.sh @@ -17,6 +17,6 @@ fi export PYTHONPATH=$PYTHONPATH:. -cd $TRIBLER_REL_PATH +cd $TRIBLER_UTIL_REL_PATH python Tribler/Tools/cmdlinedl.py -v diff --git a/ControlScripts/clients/tribler/start_tribler_gui.sh b/Utils/start_tribler_gui.sh similarity index 83% rename from ControlScripts/clients/tribler/start_tribler_gui.sh rename to Utils/start_tribler_gui.sh index eb06688..74e879b 100755 --- a/ControlScripts/clients/tribler/start_tribler_gui.sh +++ b/Utils/start_tribler_gui.sh @@ -15,11 +15,8 @@ else source ../../../ConfigFiles/globalconfig fi -# Read scenarion configuration file -source ../ClientWorkingFolders/TmpLogs/scenario_config - export PYTHONPATH=$PYTHONPATH:. -cd $TRIBLER_REL_PATH +cd $TRIBLER_UTIL_REL_PATH python2.6 Tribler/Main/tribler.py -- 2.20.1