Skip to content

Commit 9ef8d0c

Browse files
committed
ci: Test if bash -x (from run-tmt.sh) causes TMT verbosity
The run-tmt.sh script uses `set -exuo pipefail`, which includes `-x` for bash debug tracing. This test will check if bash's -x flag somehow triggers TMT to be more verbose. Assisted-by: Claude Code (Sonnet 4.5)
1 parent 27d30ae commit 9ef8d0c

File tree

1 file changed

+38
-24
lines changed

1 file changed

+38
-24
lines changed

.github/workflows/debug-tmt.yml

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,38 +48,52 @@ jobs:
4848
echo "=== Python logging configuration ==="
4949
python3 -c "import logging; print(f'Root logger level: {logging.getLogger().level}')"
5050
51-
- name: Test TMT verbosity with different settings
51+
- name: Test TMT with bash -x (mimicking run-tmt.sh)
5252
run: |
53-
echo "=== Test 1: tmt with default settings ==="
54-
tmt --help 2>&1 | head -20
53+
echo "=== Test 1: Run tmt WITHOUT bash -x ==="
54+
bash -c 'tmt --help 2>&1 | head -5'
5555
5656
echo ""
57-
echo "=== Test 2: Check if CI environment triggers debug mode ==="
58-
python3 << 'EOF'
59-
import os
60-
print(f"CI={os.environ.get('CI', '<not set>')}")
61-
print(f"GITHUB_ACTIONS={os.environ.get('GITHUB_ACTIONS', '<not set>')}")
62-
print(f"RUNNER_DEBUG={os.environ.get('RUNNER_DEBUG', '<not set>')}")
63-
print(f"ENABLE_RUNNER_TRACING={os.environ.get('ENABLE_RUNNER_TRACING', '<not set>')}")
64-
print(f"ACTIONS_STEP_DEBUG={os.environ.get('ACTIONS_STEP_DEBUG', '<not set>')}")
65-
EOF
57+
echo "=== Test 2: Run tmt WITH bash -x (like run-tmt.sh) ==="
58+
bash -x -c 'tmt --help 2>&1 | head -5'
59+
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
65+
mkdir -p .fmf
66+
echo 'version: 1' > .fmf/version
67+
68+
echo "--- Running WITHOUT bash -x ---"
69+
bash -c 'tmt run discover --how fmf 2>&1 | head -30'
6670
6771
echo ""
68-
echo "=== Test 3: Check tmt logger initialization ==="
72+
echo "--- Running WITH bash -x (like run-tmt.sh does) ---"
73+
bash -x -c 'tmt run discover --how fmf 2>&1 | head -30'
74+
75+
echo ""
76+
echo "=== Test 4: Check actual tmt log level in code ==="
6977
python3 << 'EOF'
70-
import logging
7178
import sys
7279
sys.path.insert(0, '/home/runner/.local/lib/python3.13/site-packages')
7380
74-
# Check tmt logger before initialization
75-
tmt_logger = logging.getLogger('tmt')
76-
print(f"TMT logger level before import: {tmt_logger.level}")
77-
print(f"TMT logger handlers: {tmt_logger.handlers}")
78-
print(f"TMT logger effective level: {tmt_logger.getEffectiveLevel()}")
79-
80-
# Now import tmt and check again
81+
# Check if tmt has any code that checks for bash trace mode
82+
import tmt.cli
8183
import tmt.log
82-
print(f"\nTMT logger level after import: {tmt_logger.level}")
83-
print(f"TMT logger handlers: {tmt_logger.handlers}")
84-
print(f"TMT logger effective level: {tmt_logger.getEffectiveLevel()}")
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()}")
8599
EOF

0 commit comments

Comments
 (0)