Skip to content

Commit 49a8828

Browse files
authored
Merge pull request #98 from nuclearcat/improve-debugging
fix(docs,bisect,checkout): Improve debug output on failures
2 parents 7ebad7c + a75c8c2 commit 49a8828

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

docs/checkout.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ Together with --watch option, you can use --test option to wait for particular t
167167
- `pass` - return code 0 (test passed)
168168
- `fail` - return code 1 (test failed)
169169
- `error` - return code 2 (prior steps failed, such as compilation, test setup, etc, or infrastructure error)
170+
- `critical error` - return code 64 (kci-dev failed to execute command, crashed, etc)
170171

171172
For example:
172173
```sh

kcidev/subcommands/bisect.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ def bisection_loop(state):
168168
]
169169
# job_filter is array, so we need to add each element as a separate argument
170170
for job in state["job_filter"]:
171-
cmd.append("--job_filter")
171+
cmd.append("--job-filter")
172172
cmd.append(job)
173173
for platform in state["platform_filter"]:
174-
cmd.append("--platform_filter")
174+
cmd.append("--platform-filter")
175175
cmd.append(platform)
176176
result = kcidev_exec(cmd)
177177
try:
@@ -187,10 +187,16 @@ def bisection_loop(state):
187187
elif testret == 2:
188188
# TBD: Retry failed test to make sure it is not a flaky test
189189
bisect_result = "skip"
190-
else:
191-
kci_err("Maestro failed to execute the test")
190+
elif testret == 3:
191+
kci_err(f"Maestro failed to execute the test.")
192192
# Internal maestro error, retry procesure
193193
return None
194+
else:
195+
kci_err(
196+
f"Unknown or critical return code from kci-dev: {testret}. Try to run last command manually and inspect the output:"
197+
)
198+
kci_err(f"{' '.join(cmd)}")
199+
sys.exit(1)
194200
cmd = ["git", "bisect", bisect_result]
195201
commitid = git_exec_getcommit(cmd)
196202
if not commitid:

kcidev/subcommands/checkout.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def send_checkout_full(baseurl, token, **kwargs):
3636
response = requests.post(url, headers=headers, data=jdata, timeout=30)
3737
except requests.exceptions.RequestException as e:
3838
kci_err(f"API connection error: {e}")
39-
return
39+
return None
4040

4141
if response.status_code != 200:
4242
maestro_api_error(response)
@@ -267,6 +267,10 @@ def checkout(
267267
platform_filter=platform_filter,
268268
watch=watch,
269269
)
270+
if not resp:
271+
kci_err("Failed to trigger checkout")
272+
sys.exit(64)
273+
270274
if resp and "message" in resp:
271275
click.secho(resp["message"], fg="green")
272276

0 commit comments

Comments
 (0)