]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Test] Fix results filename and ASAN for multiple processes
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 17 Oct 2025 20:52:22 +0000 (21:52 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 17 Oct 2025 20:52:22 +0000 (21:52 +0100)
- Rename scan_results.json to results.json for workflow
- Add log_suffix=.%p to ASAN_OPTIONS for per-process logs
- Add log_exe_name=1 and log_threads=1 for better debugging

test/integration/docker-compose.yml
test/integration/scripts/integration-test.sh

index 63a4a064e98674fe6391796351f37c530df7aa65..f82272825e0f7412f961cf31eafcb055cf034612 100644 (file)
@@ -40,9 +40,9 @@ services:
     environment:
       - RSPAMD_REDIS_ADDR=redis
       - RSPAMD_REDIS_PORT=6379
-      # AddressSanitizer configuration
-      - ASAN_OPTIONS=detect_leaks=1:halt_on_error=0:abort_on_error=0:print_stats=1:log_path=/data/asan.log
-      - LSAN_OPTIONS=suppressions=/etc/rspamd/lsan.supp:print_suppressions=0
+      # AddressSanitizer configuration for multiple processes
+      - ASAN_OPTIONS=detect_leaks=1:halt_on_error=0:abort_on_error=0:print_stats=1:log_path=/data/asan.log:log_suffix=.%p:log_exe_name=1
+      - LSAN_OPTIONS=suppressions=/etc/rspamd/lsan.supp:print_suppressions=0:log_threads=1
     healthcheck:
       test: [ "CMD-SHELL", "pidof rspamd > /dev/null || exit 1" ]
       interval: 10s
index 91a644c0ab1fdc2dd51ae6ddc65152254f22381a..c9c01606c567dfb2a692f7a4233ac8c729854abc 100755 (executable)
@@ -157,7 +157,7 @@ echo "Scanning $TOTAL_EMAILS emails (parallelism: $PARALLEL)..."
 # Scan the same files we used for training (from shuffled list)
 # Use xargs with -a to read from file and avoid argument list too long
 xargs -a "$DATA_DIR/shuffled_files.txt" rspamc -h "$RSPAMD_HOST:$CONTROLLER_PORT" \
-    -P "$PASSWORD" -n "$PARALLEL" -j > "$DATA_DIR/scan_results.json" 2>&1
+    -P "$PASSWORD" -n "$PARALLEL" -j > "$DATA_DIR/results.json" 2>&1
 
 echo "✓ Scanning complete"
 echo ""
@@ -171,16 +171,16 @@ echo ""
 # Count detections using grep and jq (or grep if jq not available)
 if command -v jq &> /dev/null; then
     # Use jq for JSON parsing
-    TOTAL=$(jq 'length' "$DATA_DIR/scan_results.json")
-    FUZZY_COUNT=$(jq '[.[] | select(.symbols | keys[] | startswith("FUZZY_"))] | length' "$DATA_DIR/scan_results.json")
-    BAYES_SPAM_COUNT=$(jq '[.[] | select(.symbols.BAYES_SPAM)] | length' "$DATA_DIR/scan_results.json")
-    BAYES_HAM_COUNT=$(jq '[.[] | select(.symbols.BAYES_HAM)] | length' "$DATA_DIR/scan_results.json")
+    TOTAL=$(jq 'length' "$DATA_DIR/results.json")
+    FUZZY_COUNT=$(jq '[.[] | select(.symbols | keys[] | startswith("FUZZY_"))] | length' "$DATA_DIR/results.json")
+    BAYES_SPAM_COUNT=$(jq '[.[] | select(.symbols.BAYES_SPAM)] | length' "$DATA_DIR/results.json")
+    BAYES_HAM_COUNT=$(jq '[.[] | select(.symbols.BAYES_HAM)] | length' "$DATA_DIR/results.json")
 else
     # Fallback to grep
-    TOTAL=$(grep -c '"symbols"' "$DATA_DIR/scan_results.json" || echo 0)
-    FUZZY_COUNT=$(grep -c '"FUZZY_' "$DATA_DIR/scan_results.json" || echo 0)
-    BAYES_SPAM_COUNT=$(grep -c '"BAYES_SPAM"' "$DATA_DIR/scan_results.json" || echo 0)
-    BAYES_HAM_COUNT=$(grep -c '"BAYES_HAM"' "$DATA_DIR/scan_results.json" || echo 0)
+    TOTAL=$(grep -c '"symbols"' "$DATA_DIR/results.json" || echo 0)
+    FUZZY_COUNT=$(grep -c '"FUZZY_' "$DATA_DIR/results.json" || echo 0)
+    BAYES_SPAM_COUNT=$(grep -c '"BAYES_SPAM"' "$DATA_DIR/results.json" || echo 0)
+    BAYES_HAM_COUNT=$(grep -c '"BAYES_HAM"' "$DATA_DIR/results.json" || echo 0)
 fi
 
 if [ "$TOTAL" -eq 0 ]; then
@@ -244,7 +244,7 @@ echo "TEST COMPLETE"
 echo "============================================================"
 echo ""
 echo "Results saved to:"
-echo "  - $DATA_DIR/scan_results.json"
+echo "  - $DATA_DIR/results.json"
 echo "  - $DATA_DIR/fuzzy_train.log"
 echo "  - $DATA_DIR/bayes_spam.log"
 echo "  - $DATA_DIR/bayes_ham.log"