Loading NAS_ETSI.code-workspace +3 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,9 @@ }, { "path": "../UERANSIM" }, { "path": "../titan-test-system-framework-Release3-onwards" } ], "settings": { Loading scripts/run_all.bash +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ then fi fi rm ../logs/$ATS/*.log rm -f ../logs/$ATS/*.log for i in $(seq 1 1 $COUNTER) do Loading scripts/run_mtc.bash +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ echo "> emtc: Terminate MTC." mctr ${CFG_FILES} chown -R `whoami` ${TITAN_LOG_DIR} LOG_FILES=`find ${TITAN_LOG_DIR} -name '*.log'` LOG_FILES=`find ${TITAN_LOG_DIR} -name $ATS'*.log'` if [ "${TITAN_LOG_DIR}" != "" ] then ttcn3_logmerge -o ${TITAN_LOG_DIR}/merged.log ${LOG_FILES} Loading scripts/run_tc_by_tc.bash +66 −4 Original line number Diff line number Diff line Loading @@ -143,10 +143,65 @@ TS=$(date +%Y%m%d_%H%M%S) RESULTS_DIR="../logs/$ATS/by_tc_$TS" mkdir -p "$RESULTS_DIR" SUMMARY_FILE="$RESULTS_DIR/summary.csv" echo "testcase;verdict;exit_code" > "$SUMMARY_FILE" echo "testcase;verdict;exit_code;mctr_leftover;logformat_leftover" > "$SUMMARY_FILE" # mctr (the TITAN Main Controller) and ttcn3_logformat are what run_mtc.bash # launches for each run_all.bash call (mctr in the background for the whole # run, ttcn3_logformat as a one-shot step once mctr is done). If either is # still alive after run_all.bash returns (hang, crash, or the run getting # interrupted), it can block the next test case: a stuck mctr keeps holding # the MAIN_CONTROLLER TCPPort from $CFG, and a stuck ttcn3_logformat keeps # the log files it's reading/writing busy. The pattern matches on the ATS's # own etc/ or logs/ path so an unrelated session for a different ATS is left # alone. terminate_matching_process() { local label="$1" pattern="$2" local pids pids=$(pgrep -f "$pattern" 2>/dev/null) [ -z "$pids" ] && return 0 echo "WARNING: $label is still running (pid(s): $pids) after run_all.bash returned; terminating it." >&2 kill $pids 2>/dev/null for _ in $(seq 1 10) do pids=$(pgrep -f "$pattern" 2>/dev/null) [ -z "$pids" ] && break sleep 0.5 done pids=$(pgrep -f "$pattern" 2>/dev/null) if [ -n "$pids" ] then echo "$label still alive after SIGTERM, sending SIGKILL (pid(s): $pids)." >&2 kill -9 $pids 2>/dev/null sleep 0.5 pids=$(pgrep -f "$pattern" 2>/dev/null) fi if [ -n "$pids" ] then echo "ERROR: could not stop $label (pid(s): $pids)." >&2 return 1 fi echo "$label stopped." return 0 } ensure_mctr_stopped() { terminate_matching_process "mctr" "mctr .*/etc/$ATS/" } # Only meaningful once mctr itself is confirmed gone: ttcn3_logformat runs # after mctr in run_mtc.bash, so checking it first could catch it mid-run. ensure_ttcn3_logformat_stopped() { terminate_matching_process "ttcn3_logformat" "ttcn3_logformat .*/logs/$ATS/" } cp "$CFG" "$CFG_BACKUP" cleanup() { ensure_mctr_stopped ensure_ttcn3_logformat_stopped if [ -f "$CFG_BACKUP" ] then cp "$CFG_BACKUP" "$CFG" Loading Loading @@ -178,6 +233,7 @@ total=${#TCS[@]} idx=0 for tc in "${TCS[@]}" do rm -f ../logs/$ATS/*.log 2>/dev/null idx=$((idx + 1)) safe_tc=$(printf '%s' "$tc" | tr -c 'A-Za-z0-9_.-' '_') tc_log_dir="$RESULTS_DIR/$safe_tc" Loading @@ -189,7 +245,13 @@ do ( ATS="$ATS" ./run_all.bash "$COUNTER" ) rc=$? sleep 1 mctr_leftover="no" ensure_mctr_stopped || mctr_leftover="yes" logformat_leftover="no" ensure_ttcn3_logformat_stopped || logformat_leftover="yes" sleep 2 if [ -d "../logs/$ATS" ] then Loading @@ -203,8 +265,8 @@ do [ -n "$v" ] && verdict="$v" fi printf '%-75s %-10s (exit=%s)\n' "$tc" "$verdict" "$rc" echo "$tc;$verdict;$rc" >> "$SUMMARY_FILE" printf '%-75s %-10s (exit=%s, mctr_leftover=%s, logformat_leftover=%s)\n' "$tc" "$verdict" "$rc" "$mctr_leftover" "$logformat_leftover" echo "$tc;$verdict;$rc;$mctr_leftover;$logformat_leftover" >> "$SUMMARY_FILE" # Restore the pristine cfg between iterations so $CFG only ever holds a # single-test-case [EXECUTE] section for the duration of that one Loading titan-test-system-framework @ 1c29d89d Original line number Diff line number Diff line Subproject commit 0cf0296b8f933840fcc3680d98fb83b1da881bec Subproject commit 1c29d89de72fb9a78db8dd3daabe0ab0f261a699 Loading
NAS_ETSI.code-workspace +3 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,9 @@ }, { "path": "../UERANSIM" }, { "path": "../titan-test-system-framework-Release3-onwards" } ], "settings": { Loading
scripts/run_all.bash +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ then fi fi rm ../logs/$ATS/*.log rm -f ../logs/$ATS/*.log for i in $(seq 1 1 $COUNTER) do Loading
scripts/run_mtc.bash +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ echo "> emtc: Terminate MTC." mctr ${CFG_FILES} chown -R `whoami` ${TITAN_LOG_DIR} LOG_FILES=`find ${TITAN_LOG_DIR} -name '*.log'` LOG_FILES=`find ${TITAN_LOG_DIR} -name $ATS'*.log'` if [ "${TITAN_LOG_DIR}" != "" ] then ttcn3_logmerge -o ${TITAN_LOG_DIR}/merged.log ${LOG_FILES} Loading
scripts/run_tc_by_tc.bash +66 −4 Original line number Diff line number Diff line Loading @@ -143,10 +143,65 @@ TS=$(date +%Y%m%d_%H%M%S) RESULTS_DIR="../logs/$ATS/by_tc_$TS" mkdir -p "$RESULTS_DIR" SUMMARY_FILE="$RESULTS_DIR/summary.csv" echo "testcase;verdict;exit_code" > "$SUMMARY_FILE" echo "testcase;verdict;exit_code;mctr_leftover;logformat_leftover" > "$SUMMARY_FILE" # mctr (the TITAN Main Controller) and ttcn3_logformat are what run_mtc.bash # launches for each run_all.bash call (mctr in the background for the whole # run, ttcn3_logformat as a one-shot step once mctr is done). If either is # still alive after run_all.bash returns (hang, crash, or the run getting # interrupted), it can block the next test case: a stuck mctr keeps holding # the MAIN_CONTROLLER TCPPort from $CFG, and a stuck ttcn3_logformat keeps # the log files it's reading/writing busy. The pattern matches on the ATS's # own etc/ or logs/ path so an unrelated session for a different ATS is left # alone. terminate_matching_process() { local label="$1" pattern="$2" local pids pids=$(pgrep -f "$pattern" 2>/dev/null) [ -z "$pids" ] && return 0 echo "WARNING: $label is still running (pid(s): $pids) after run_all.bash returned; terminating it." >&2 kill $pids 2>/dev/null for _ in $(seq 1 10) do pids=$(pgrep -f "$pattern" 2>/dev/null) [ -z "$pids" ] && break sleep 0.5 done pids=$(pgrep -f "$pattern" 2>/dev/null) if [ -n "$pids" ] then echo "$label still alive after SIGTERM, sending SIGKILL (pid(s): $pids)." >&2 kill -9 $pids 2>/dev/null sleep 0.5 pids=$(pgrep -f "$pattern" 2>/dev/null) fi if [ -n "$pids" ] then echo "ERROR: could not stop $label (pid(s): $pids)." >&2 return 1 fi echo "$label stopped." return 0 } ensure_mctr_stopped() { terminate_matching_process "mctr" "mctr .*/etc/$ATS/" } # Only meaningful once mctr itself is confirmed gone: ttcn3_logformat runs # after mctr in run_mtc.bash, so checking it first could catch it mid-run. ensure_ttcn3_logformat_stopped() { terminate_matching_process "ttcn3_logformat" "ttcn3_logformat .*/logs/$ATS/" } cp "$CFG" "$CFG_BACKUP" cleanup() { ensure_mctr_stopped ensure_ttcn3_logformat_stopped if [ -f "$CFG_BACKUP" ] then cp "$CFG_BACKUP" "$CFG" Loading Loading @@ -178,6 +233,7 @@ total=${#TCS[@]} idx=0 for tc in "${TCS[@]}" do rm -f ../logs/$ATS/*.log 2>/dev/null idx=$((idx + 1)) safe_tc=$(printf '%s' "$tc" | tr -c 'A-Za-z0-9_.-' '_') tc_log_dir="$RESULTS_DIR/$safe_tc" Loading @@ -189,7 +245,13 @@ do ( ATS="$ATS" ./run_all.bash "$COUNTER" ) rc=$? sleep 1 mctr_leftover="no" ensure_mctr_stopped || mctr_leftover="yes" logformat_leftover="no" ensure_ttcn3_logformat_stopped || logformat_leftover="yes" sleep 2 if [ -d "../logs/$ATS" ] then Loading @@ -203,8 +265,8 @@ do [ -n "$v" ] && verdict="$v" fi printf '%-75s %-10s (exit=%s)\n' "$tc" "$verdict" "$rc" echo "$tc;$verdict;$rc" >> "$SUMMARY_FILE" printf '%-75s %-10s (exit=%s, mctr_leftover=%s, logformat_leftover=%s)\n' "$tc" "$verdict" "$rc" "$mctr_leftover" "$logformat_leftover" echo "$tc;$verdict;$rc;$mctr_leftover;$logformat_leftover" >> "$SUMMARY_FILE" # Restore the pristine cfg between iterations so $CFG only ever holds a # single-test-case [EXECUTE] section for the duration of that one Loading
titan-test-system-framework @ 1c29d89d Original line number Diff line number Diff line Subproject commit 0cf0296b8f933840fcc3680d98fb83b1da881bec Subproject commit 1c29d89de72fb9a78db8dd3daabe0ab0f261a699