Back to Landing Page
CCX Testsuite · C#

ServerComparer Empty Path Guard

June 20264 min read
// ccx_testsuite#14  —  49,086 affected test rows
// Before: File.Open("", FileMode.Open) throws ArgumentException
// that Tester.cs catch block swallows silently.

// After:
if (string.IsNullOrEmpty(data.ProducedFile) ||
    !File.Exists(data.ProducedFile))
    return;  // prevent silent failure, no TestResultFile row written

Background

The CCX Testsuite's ServerComparer was silently swallowing exceptions during test result comparison.

Root Cause

When CCExtractor produces no output for a test, ServerComparer called File.Open("", FileMode.Open) — an empty string path. This throws ArgumentException which was being caught and swallowed, causing the test to silently pass instead of recording a failure. Found across 10 production log files, with 25 occurrences in a single test run.

The Fix

Added an early-return guard before the File.Open call: if the output path is null or empty, return immediately with a failure result rather than attempting to open a non-existent file.

Evidence

Identified 49,086 affected test result rows in the production database. The swallowed exception pattern confirmed across all 10 log files reviewed.

Result

PR ccx_testsuite#14. Prevents silent test pass on absent output — a correctness fix for the test infrastructure itself.