Suggestion: add link to multi-shell test CLI 'shall' to the read-me #15

Open
opened 2015-07-05 11:06:13 -04:00 by mklement0 · 9 comments
mklement0 commented 2015-07-05 11:06:13 -04:00 (Migrated from github.com)

I've written a multi-shell testing CLI that I think complements Urchin nicely: shall.
(@ljharb, this may be of interest to you too.)

In short: by writing test scripts with shall in the shebang line, they are automatically executed with multiple (specifiable) shells - see below for more.

If you agree that it makes sense, I suggest adding a link to the Shall repo from Urchin's read-me.
I'm happy to suggest changes in a PR.

Example:

Say you have an executable script named shallpg with the following content:

#!/usr/bin/env shall

echo "Hello from $(ps -o comm= $$)."

By using shall in the shebang line, the script will be executed with multiple shells in sequence, by default - if installed - with sh, dash, bash, zsh, ksh, or as specified via option -l or the SHELLS environment variable; the exit code reflects the number of shells that reported failure (see the repo for more):

image

I've written a multi-shell testing CLI that I think complements Urchin nicely: **[shall](/mklement0/shall)**. (@ljharb, this may be of interest to you too.) In short: by writing test scripts with `shall` in the shebang line, they are automatically executed with multiple (specifiable) shells - see below for more. If you agree that it makes sense, I suggest adding a link to the Shall repo from Urchin's read-me. I'm happy to suggest changes in a PR. ## Example: Say you have an executable script named `shallpg` with the following content: ``` shell #!/usr/bin/env shall echo "Hello from $(ps -o comm= $$)." ``` By using `shall` in the shebang line, the script will be executed with _multiple_ shells in sequence, by default - if installed - with `sh`, `dash`, `bash`, `zsh`, `ksh`, or as specified via option `-l` or the `SHELLS` environment variable; the exit code reflects the number of shells that reported failure (see the [repo](/mklement0/shall) for more): ![image](https://cloud.githubusercontent.com/assets/588825/8512140/0db1211c-2304-11e5-9ac2-f6fa4e047140.png)
ljharb commented 2015-07-05 12:52:30 -04:00 (Migrated from github.com)

@mklement0 This is very interesting. If you want to submit a PR that uses shall in nvm for multi-shell tests that would be awesome :-)

@mklement0 This is very interesting. If you want to submit a PR that uses `shall` in `nvm` for multi-shell tests that would be awesome :-)
tlevine commented 2015-07-05 13:35:14 -04:00 (Migrated from github.com)

Oh cool this was my idea with "#!/usr/bin/env urchin -x",
but I never got it working.

On 05 Jul 09:52, Jordan Harband wrote:

@mklement0 This is very interesting. If you want to submit a PR that uses shall in nvm for multi-shell tests that would be awesome :-)


Reply to this email directly or view it on GitHub:
https://github.com/tlevine/urchin/issues/15#issuecomment-118638037

Oh cool this was my idea with "#!/usr/bin/env urchin -x", but I never got it working. On 05 Jul 09:52, Jordan Harband wrote: > @mklement0 This is very interesting. If you want to submit a PR that uses `shall` in `nvm` for multi-shell tests that would be awesome :-) > > --- > > Reply to this email directly or view it on GitHub: > https://github.com/tlevine/urchin/issues/15#issuecomment-118638037
mklement0 commented 2015-07-08 14:35:37 -04:00 (Migrated from github.com)

@ljharb Not sure when I can take a stab at this; let me know if you get around to it first.

@ljharb Not sure when I can take a stab at this; let me know if you get around to it first.
mklement0 commented 2015-07-08 14:36:06 -04:00 (Migrated from github.com)

@tlevine Do you want me to send a PR with proposed changes to the read-me?

@tlevine Do you want me to send a PR with proposed changes to the read-me?
tlevine commented 2015-07-08 21:05:46 -04:00 (Migrated from github.com)

Yes please, and I'll merge pretty much anything you write.
I already added two lines, but you'll write something better.

On 08 Jul 11:36, Michael Klement wrote:

@tlevine Do you want me to send a PR with proposed changes to the read-me?


Reply to this email directly or view it on GitHub:
https://github.com/tlevine/urchin/issues/15#issuecomment-119691919

Yes please, and I'll merge pretty much anything you write. I already added two lines, but you'll write something better. On 08 Jul 11:36, Michael Klement wrote: > @tlevine Do you want me to send a PR with proposed changes to the read-me? > > --- > > Reply to this email directly or view it on GitHub: > https://github.com/tlevine/urchin/issues/15#issuecomment-119691919
mklement0 commented 2015-07-09 00:06:14 -04:00 (Migrated from github.com)

Thanks for the vote of confidence, @tlevine - and thanks for what you've already added; hadn't noticed it. That's definitely a good start; let's see if inspiration strikes me...

Thanks for the vote of confidence, @tlevine - and thanks for what you've already added; hadn't noticed it. That's definitely a good start; let's see if inspiration strikes me...
ljharb commented 2020-12-27 20:45:41 -05:00 (Migrated from github.com)

@mklement0 i still haven't gotten around to this :-) SHELLS=bash,sh,zsh,dash,ksh shall urchin -f test/install_script, for example, seems like it's working, but it's not running them in parallel, which makes it quite slow. Any chance there's a solution for that?

@mklement0 i still haven't gotten around to this :-) `SHELLS=bash,sh,zsh,dash,ksh shall urchin -f test/install_script`, for example, seems like it's working, but it's not running them in parallel, which makes it quite slow. Any chance there's a solution for that?
mklement0 commented 2020-12-27 22:16:34 -05:00 (Migrated from github.com)

@ljharb, note that test/install_script would need to use shall in its shebang line for this to work at all.

shall isn't designed for parallel execution, and I've never tried it.

You can use GNU parallel, for instance, if you wanted to try it; while xargs -P works in principle, it has no output grouping (keeping output from the various processes grouped together). Conversely, while GNU parallel does perform this grouping, it strips coloring from the output.

Unless you care about shall's output formatting, there's no good reason to run it in parallel with one shell each, because you can otherwise invoke the shells directly, which in the case of urchin would mean
urchin -s <shell> -f test/install_script

Here's a sample GNU parallel commands

  • Simple shall invocation:
parallel -P 5 -n 1 SHELLS={} shall -c '"echo hi"' <<<$'sh\nbash\nksh\nzsh\ndash'
  • Direct use of urchin:
parallel -P 5 -n 1 urchin -s {} -f test/install_script <<<$'sh\nbash\nksh\nzsh\ndash'
@ljharb, note that `test/install_script` would need to use `shall` in its shebang line for this to work at all. `shall` isn't designed for parallel execution, and I've never tried it. You can use GNU `parallel`, for instance, if you wanted to try it; while `xargs -P` works in principle, it has no output grouping (keeping output from the various processes grouped together). Conversely, while GNU `parallel` does perform this grouping, it strips coloring from the output. Unless you care about `shall`'s output formatting, there's no good reason to run it in parallel with one shell each, because you can otherwise invoke the shells directly, which in the case of `urchin` would mean `urchin -s <shell> -f test/install_script` Here's a sample GNU `parallel` commands * Simple `shall` invocation: ``` parallel -P 5 -n 1 SHELLS={} shall -c '"echo hi"' <<<$'sh\nbash\nksh\nzsh\ndash' ``` * Direct use of `urchin`: ``` parallel -P 5 -n 1 urchin -s {} -f test/install_script <<<$'sh\nbash\nksh\nzsh\ndash' ```
ljharb commented 2020-12-27 22:26:37 -05:00 (Migrated from github.com)

gotcha, i don't have parallel available on every machine i need to test nvm on, so if shall doesn't have it directly, i might be best staying with just urchin for now.

gotcha, i don't have `parallel` available on every machine i need to test nvm on, so if shall doesn't have it directly, i might be best staying with just urchin for now.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tlevine/urchin#15
No description provided.