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):
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):

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
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
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...
@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?
@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
@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'
```
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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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
shallin 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
shallpgwith the following content:By using
shallin the shebang line, the script will be executed with multiple shells in sequence, by default - if installed - withsh,dash,bash,zsh,ksh, or as specified via option-lor theSHELLSenvironment variable; the exit code reflects the number of shells that reported failure (see the repo for more):@mklement0 This is very interesting. If you want to submit a PR that uses
shallinnvmfor multi-shell tests that would be awesome :-)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:
@ljharb Not sure when I can take a stab at this; let me know if you get around to it first.
@tlevine Do you want me to send a PR with proposed changes to the read-me?
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:
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...
@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?@ljharb, note that
test/install_scriptwould need to useshallin its shebang line for this to work at all.shallisn't designed for parallel execution, and I've never tried it.You can use GNU
parallel, for instance, if you wanted to try it; whilexargs -Pworks in principle, it has no output grouping (keeping output from the various processes grouped together). Conversely, while GNUparalleldoes 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 ofurchinwould meanurchin -s <shell> -f test/install_scriptHere's a sample GNU
parallelcommandsshallinvocation:urchin:gotcha, i don't have
parallelavailable 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.