@@ -48,52 +48,66 @@ jobs:
4848 echo "=== Python logging configuration ==="
4949 python3 -c "import logging; print(f'Root logger level: {logging.getLogger().level}')"
5050
51- - name : Test TMT with bash -x (mimicking run-tmt.sh)
51+ - name : Reproduce actual CI TMT run and check verbosity levels
5252 run : |
53- echo "=== Test 1: Run tmt WITHOUT bash -x ==="
54- bash -c 'tmt --help 2>&1 | head -5'
53+ set -exuo pipefail
5554
56- echo ""
57- echo "=== Test 2: Run tmt WITH bash -x (like run- tmt.sh) ==="
58- bash -x -c ' tmt --help 2>&1 | head -5'
55+ cd /var/tmp
56+ mkdir -p tmt-repro
57+ cd tmt-repro
5958
60- echo ""
61- echo "=== Test 3: Check if bash -x affects tmt verbosity in actual test run ==="
62- cd /tmp
63- mkdir -p tmt-test
64- cd tmt-test
59+ # Create a minimal FMF tree
6560 mkdir -p .fmf
66- echo 'version: 1' > .fmf/version
61+ cat > .fmf/version <<'FMFEOF'
62+ 1
63+ FMFEOF
6764
68- echo "--- Running WITHOUT bash -x ---"
69- bash -c 'tmt run discover --how fmf 2>&1 | head -30'
65+ # Create minimal plan
66+ mkdir -p tmt
67+ cat > tmt/test.fmf <<'FMFEOF'
68+ summary : Minimal test
69+ test : echo "hello world"
70+ FMFEOF
7071
71- echo ""
72- echo "--- Running WITH bash -x (like run-tmt.sh does) ---"
73- bash -x -c 'tmt run discover --how fmf 2>&1 | head -30'
72+ echo "=== Test 1 : Default tmt run (with set -x from this script) ==="
73+ tmt run discover --how fmf 2>&1 | head -50 || true
7474
7575 echo ""
76- echo "=== Test 4 : Check actual tmt log level in code ==="
76+ echo "=== Test 2 : Check if TMT detects it's in CI and enables debug ==="
7777 python3 << 'EOF'
78- import sys
79- sys.path.insert(0, '/home/runner/.local/lib/python3.13/site-packages')
80-
81- # Check if tmt has any code that checks for bash trace mode
82- import tmt.cli
83- import tmt.log
84- import inspect
85-
86- # Look for environment variable checks
87- cli_source = inspect.getsource(tmt.cli)
88- log_source = inspect.getsource(tmt.log)
89-
90- print("Checking for environment variable usage in tmt.cli:")
91- for line_no, line in enumerate(cli_source.split('\n'), 1):
92- if 'environ' in line.lower() or 'getenv' in line.lower():
93- print(f" Line {line_no}: {line.strip()}")
94-
95- print("\nChecking for environment variable usage in tmt.log:")
96- for line_no, line in enumerate(log_source.split('\n'), 1):
97- if 'environ' in line.lower() or 'getenv' in line.lower():
98- print(f" Line {line_no}: {line.strip()}")
99- EOF
78+ import sys, os
79+ sys.path.insert(0, '/home/runner/.local/lib/python3.13/site-packages')
80+
81+ # Import TMT and check if it has CI detection logic
82+ import tmt.log
83+ import tmt.cli
84+ import inspect
85+
86+ # Get the Logger class source
87+ logger_cls_source = inspect.getsource(tmt.log.Logger)
88+ print("Searching tmt.log.Logger for CI detection or auto-debug logic:")
89+ for line_no, line in enumerate(logger_cls_source.split('\n'), 1) :
90+ if any(keyword in line.lower() for keyword in ['ci', 'github', 'actions', 'debug', 'level']) :
91+ print(f" Line {line_no} : {line.rstrip()}")
92+
93+ print("\n\n=== Check TMT_DEBUG environment variable ===")
94+ print(f"TMT_DEBUG={os.environ.get('TMT_DEBUG', '<not set>')}")
95+
96+ print("\n=== Let's manually check what default log level TMT uses ===")
97+ # Try to instantiate TMT's logger and see what level it uses
98+ import logging
99+
100+ # Before importing tmt.cli, check current logger levels
101+ print(f"Root logger level : {logging.getLogger().level}")
102+ print(f"Root logger effective level : {logging.getLogger().getEffectiveLevel()}")
103+
104+ # Import and check tmt logger
105+ tmt_logger = logging.getLogger('tmt')
106+ print(f"TMT logger level : {tmt_logger.level}")
107+ print(f"TMT logger effective level : {tmt_logger.getEffectiveLevel()}")
108+ print(f"TMT logger handlers : {tmt_logger.handlers}")
109+
110+ # Check if handlers have different levels
111+ for handler in tmt_logger.handlers :
112+ print(f" Handler {handler} : level={handler.level}")
113+ EOF
0 commit comments