Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add when/unless #72

Merged
merged 5 commits into from
Mar 21, 2024
Merged

add when/unless #72

merged 5 commits into from
Mar 21, 2024

Conversation

joufellasfl
Copy link
Contributor

See commit messages.

When enabled, print 'sh -x' style tracing info.
Add and compact color codes, and add support for tmux/screen term types.
This commit adds two new condition statements, when and unless. They can
be used to skip tests when a condition is either met or unmet.

Usage: <when|unless> "condition_expr"

A few examples:

 production_image() { grep -q "Production" /etc/os-release; }
 on_eval_board() { grep -q "EVK" /sys/firmware/devicetree/base/model; }

 when "production_image" \
   as "root login is disabled on prod image" \
     cukinia_cmd ...

 when "production_image" \
   unless "on_eval_board" \
     as "console driver is not loaded" \
       cukinia_test ...

When any condition is unmet, the test will be reported as SKIP:

 [SKIP] root login is disabled on prod image [unmet condition]
Copy link
Member

@deribaucourt deribaucourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joufellasfl joufellasfl merged commit 67d1871 into master Mar 21, 2024
@joufellasfl joufellasfl deleted the wip/when-unless branch March 21, 2024 14:36
@joufellasfl
Copy link
Contributor Author

Thanks @deribaucourt :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants