#!/bin/bash # Check status of 24-PTC stress test SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PID_FILE="${SCRIPT_DIR}/stress.pid" STATUS_FILE="${SCRIPT_DIR}/stress_status.json" LOG_DIR="${SCRIPT_DIR}/stress_logs" echo "==========================================================" echo " 24-PTC Hardware Stress Test Status " echo "==========================================================" RUNNING="NO" if [ -f "${PID_FILE}" ]; then PID=$(cat "${PID_FILE}") if ps -p "${PID}" > /dev/null 2>&1; then RUNNING="YES (PID: ${PID})" fi fi echo "Process Status : ${RUNNING}" if [ -f "${STATUS_FILE}" ]; then python3 -c " import json, sys try: with open('${STATUS_FILE}', 'r') as f: d = json.load(f) print(f\"Test Status : {d.get('status')}\") print(f\"Target Duration: {d.get('target_hours')} hours\") print(f\"Elapsed Time : {d.get('elapsed_seconds')}s ({d.get('elapsed_seconds',0)/3600:.2f}h)\") print(f\"Remaining Time : {d.get('remaining_seconds')}s ({d.get('remaining_seconds',0)/3600:.2f}h)\") print(f\"Progress : {d.get('progress_percent')}%\") print(f\"Total Cycles : {d.get('total_cycles')}\") print(f\"SET_ACK Stats : Success={d.get('set_ack_success')}, Miss={d.get('set_ack_miss')}\") print(f\"GET Query Stats: Success={d.get('get_success')}, Miss={d.get('get_miss')}\") print(f\"PTC Duty Check : Target={d.get('target_ptc_duty')}%, All 24ch Match={d.get('last_ptc_all_match')}\") temps = d.get('temperatures', {}) print(f\"BMC Temp Range : Min={temps.get('bmc_min')}C, Max={temps.get('bmc_max')}C (Valid channels: {temps.get('bmc_valid_channels')}/24)\") print(f\"CT Temp Range : Min={temps.get('ct_min')}C, Max={temps.get('ct_max')}C (Valid channels: {temps.get('ct_valid_channels')}/27)\") except Exception as e: print(f'Error parsing status file: {e}') " else echo "Status JSON not found yet (${STATUS_FILE})." fi echo "----------------------------------------------------------" echo "Latest 10 log entries:" if [ -f "${LOG_DIR}/stress_24ptc_latest.log" ]; then tail -n 10 "${LOG_DIR}/stress_24ptc_latest.log" else echo "No log file found yet." fi echo "=========================================================="