Skip to content

Improve error handling in k-util.sh#2936

Merged
rv-jenkins merged 12 commits intodevelopfrom
fix-k-util-execute
Oct 4, 2022
Merged

Improve error handling in k-util.sh#2936
rv-jenkins merged 12 commits intodevelopfrom
fix-k-util-execute

Conversation

@Baltoli
Copy link
Copy Markdown
Contributor

@Baltoli Baltoli commented Sep 30, 2022

This PR reorganises the execute function in k-util.sh:

  • The amount of noise produced in verbose mode is reduced by only executing the actual command inside -x; all conditional tests are performed outside.
  • The return code of the command is stored, and the existing error reporting function is used to report any failures to the user (even outside of verbose mode).

Tested locally to make sure the output is good. For example, by patching kore-expand-macros to just return 35:

+ kparse --definition ./test-kompiled --module TEST .krun-2022-09-30-12-37-54-1ys0guZ5YC/tmp.PGM.pretty.10LcVUXY1O
+ ret=0
+ llvm-krun -c PGM tmp.in.PGM.5P6NhEbdgW KItem korefile --directory /home/bruce/code/scratch/test-kompiled -v -save-temps --dry-run -nm -o tmp.in.npwbCwNMfZ
+ ret=0
+ kore-expand-macros ./test-kompiled .krun-2022-09-30-12-37-54-1ys0guZ5YC/tmp.in.npwbCwNMfZ
+ ret=35
[Error] krun: kore-expand-macros ./test-kompiled 
.krun-2022-09-30-12-37-54-1ys0guZ5YC/tmp.in.npwbCwNMfZ

Fixes #2817

@Baltoli Baltoli requested a review from ehildenb September 30, 2022 11:32
@rv-jenkins rv-jenkins changed the base branch from master to develop September 30, 2022 11:33
@Baltoli Baltoli requested a review from a team as a code owner September 30, 2022 12:06
Comment thread k-distribution/src/main/scripts/lib/k-util.sh Outdated
Comment thread k-distribution/src/main/scripts/lib/k-util.sh
@rv-jenkins rv-jenkins merged commit 690b6d6 into develop Oct 4, 2022
@rv-jenkins rv-jenkins deleted the fix-k-util-execute branch October 4, 2022 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants