From 393e78defc857ea44d116f102baeda3081c2dfa4 Mon Sep 17 00:00:00 2001 From: mahmamdouh Date: Sun, 28 Dec 2025 03:28:14 +0100 Subject: [PATCH] update DB table --- test_execution.sh | 5 ++++- testarena-app.service | 1 + testarena-worker.service | 1 + testarena_app/worker.py | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/test_execution.sh b/test_execution.sh index 9fc7a97..a3710bc 100644 --- a/test_execution.sh +++ b/test_execution.sh @@ -37,14 +37,17 @@ EOF # 1. CD into the repo path # 2. Execute command and capture output -# 3. PIPESTATUS[1] captures the exit code of the CMD, not the 'cd' or 'tee' +# 3. PIPESTATUS[0] captures the exit code of the eval "$CMD" +echo "--- Execution Start ---" | tee -a >(sed 's/$/
/' >> "$LOG_FILE") cd "$REPO_PATH" && eval "$CMD" 2>&1 | tee -a >(sed 's/$/
/' >> "$LOG_FILE") EXIT_CODE=${PIPESTATUS[0]} +echo "--- Execution End (Exit Code: $EXIT_CODE) ---" | tee -a >(sed 's/$/
/' >> "$LOG_FILE") # Close HTML tags echo "" >> "$LOG_FILE" # Determine PASS/FAIL +# We consider it a FAIL if the exit code is non-zero if [ $EXIT_CODE -eq 0 ]; then RESULT="PASS" else diff --git a/testarena-app.service b/testarena-app.service index 007f2c4..cc8498c 100644 --- a/testarena-app.service +++ b/testarena-app.service @@ -8,6 +8,7 @@ Group=asf WorkingDirectory=/home/asf/testarena_backend Environment="PATH=/home/asf/testarena_backend/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" Environment="IDF_PATH=/home/asf/esp/esp-idf" +Environment="XDG_RUNTIME_DIR=/tmp" Environment="DATABASE_URL=sqlite:////home/asf/testarena/testarena.db" ExecStart=/home/asf/testarena_backend/venv/bin/uvicorn testarena_app.main:app --host 0.0.0.0 --port 8000 Restart=always diff --git a/testarena-worker.service b/testarena-worker.service index 9a86eaa..642ab87 100644 --- a/testarena-worker.service +++ b/testarena-worker.service @@ -8,6 +8,7 @@ Group=asf WorkingDirectory=/home/asf/testarena_backend Environment="PATH=/home/asf/testarena_backend/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" Environment="IDF_PATH=/home/asf/esp/esp-idf" +Environment="XDG_RUNTIME_DIR=/tmp" Environment="DATABASE_URL=sqlite:////home/asf/testarena/testarena.db" ExecStart=/home/asf/testarena_backend/venv/bin/python3 -m testarena_app.worker Restart=always diff --git a/testarena_app/worker.py b/testarena_app/worker.py index 50ca991..db71f5c 100644 --- a/testarena_app/worker.py +++ b/testarena_app/worker.py @@ -31,6 +31,9 @@ def update_json_status(queue_id, task_id, status, result=None): import datetime import time +import os + +os.environ["XDG_RUNTIME_DIR"] = "/tmp" def run_command_with_logging(cmd, log_file, cwd=None, env=None, timeout=1800, stop_string=None): """Runs a command, logs output, and optionally stops when a string is found."""