|
| 1 | +#!/bin/bash |
| 2 | +set -exuo pipefail |
| 3 | + |
| 4 | +cd /var/tmp |
| 5 | +mkdir -p tmt-repro |
| 6 | +cd tmt-repro |
| 7 | + |
| 8 | +# Create a minimal FMF tree |
| 9 | +mkdir -p .fmf |
| 10 | +echo "1" > .fmf/version |
| 11 | + |
| 12 | +# Create minimal plan |
| 13 | +mkdir -p tmt |
| 14 | +cat > tmt/test.fmf <<'FMFEOF' |
| 15 | +summary: Minimal test |
| 16 | +test: echo "hello world" |
| 17 | +FMFEOF |
| 18 | + |
| 19 | +echo "=== Test 1: TMT run discover only (no provision) ===" |
| 20 | +tmt run discover --how fmf 2>&1 | head -50 || true |
| 21 | + |
| 22 | +echo "" |
| 23 | +echo "=== Test 1b: TMT run with provision (local) - Check for DEBUG lines ===" |
| 24 | +tmt_output=$(tmt run -v provision --how local 2>&1 || true) |
| 25 | +echo "$tmt_output" | head -100 |
| 26 | + |
| 27 | +echo "" |
| 28 | +echo "=== Analysis: Count DEBUG lines (should be 0 with patch) ===" |
| 29 | +debug_count=$(echo "$tmt_output" | grep -c "^DEBUG:tmt\." || true) |
| 30 | +echo "DEBUG:tmt.* lines found: $debug_count" |
| 31 | +if [ "$debug_count" -eq 0 ]; then |
| 32 | + echo "✓ SUCCESS: No unwanted DEBUG lines in output!" |
| 33 | +else |
| 34 | + echo "✗ FAILURE: Found $debug_count DEBUG lines (patch may not be working)" |
| 35 | + echo "Sample DEBUG lines:" |
| 36 | + echo "$tmt_output" | grep "^DEBUG:tmt\." | head -10 |
| 37 | +fi |
| 38 | + |
| 39 | +echo "" |
| 40 | +echo "=== Test 2: Check if TMT detects it's in CI and enables debug ===" |
| 41 | +python3 <<'EOF' |
| 42 | +import sys, os |
| 43 | +sys.path.insert(0, '/home/runner/.local/lib/python3.13/site-packages') |
| 44 | +
|
| 45 | +# Import TMT and check if it has CI detection logic |
| 46 | +import tmt.log |
| 47 | +import tmt.cli |
| 48 | +import inspect |
| 49 | +
|
| 50 | +# Get the Logger class source |
| 51 | +logger_cls_source = inspect.getsource(tmt.log.Logger) |
| 52 | +print("Searching tmt.log.Logger for CI detection or auto-debug logic:") |
| 53 | +for line_no, line in enumerate(logger_cls_source.split('\n'), 1): |
| 54 | + if any(keyword in line.lower() for keyword in ['ci', 'github', 'actions', 'debug', 'level']): |
| 55 | + print(f" Line {line_no}: {line.rstrip()}") |
| 56 | +
|
| 57 | +print("\n\n=== Check TMT_DEBUG environment variable ===") |
| 58 | +print(f"TMT_DEBUG={os.environ.get('TMT_DEBUG', '<not set>')}") |
| 59 | +
|
| 60 | +print("\n=== Let's manually check what default log level TMT uses ===") |
| 61 | +# Try to instantiate TMT's logger and see what level it uses |
| 62 | +import logging |
| 63 | +
|
| 64 | +# Before importing tmt.cli, check current logger levels |
| 65 | +print(f"Root logger level: {logging.getLogger().level}") |
| 66 | +print(f"Root logger effective level: {logging.getLogger().getEffectiveLevel()}") |
| 67 | +
|
| 68 | +# Import and check tmt logger |
| 69 | +tmt_logger = logging.getLogger('tmt') |
| 70 | +print(f"TMT logger level: {tmt_logger.level}") |
| 71 | +print(f"TMT logger effective level: {tmt_logger.getEffectiveLevel()}") |
| 72 | +print(f"TMT logger handlers: {tmt_logger.handlers}") |
| 73 | +
|
| 74 | +# Check if handlers have different levels |
| 75 | +for handler in tmt_logger.handlers: |
| 76 | + print(f" Handler {handler}: level={handler.level}") |
| 77 | +EOF |
0 commit comments