vulkano icon indicating copy to clipboard operation
vulkano copied to clipboard

Improve examples scripts

Open marc0246 opened this issue 1 year ago • 15 comments

This adds a PowerShell version of the run_all.sh script for those that want to test on Windows, as well as headless versions of both scripts which will come in handy for CI but can also be used by us. I also made the existing run_all.sh script more portable.

marc0246 avatar Nov 05 '23 14:11 marc0246

I get an error when I try to run the script:

rua@rua-desktop ~/code/vulkano/examples $ ./run_all.sh ./run_all.sh: 2: set: Illegal option -o pipefail

Rua avatar Nov 08 '23 13:11 Rua

Interesting, may I know the output you get when running sh --version please?

marc0246 avatar Nov 08 '23 13:11 marc0246

rua@rua-desktop ~ $ sh --version sh: 0: Illegal option --

Eh? XD

Rua avatar Nov 08 '23 13:11 Rua

Er, the original bourne shell didn't have that option. Oof. I suspect you have actual bourne shell installed. I can't seem to be able to install it, only bash, on my system. If you really have it installed that's actually chef's kiss.

marc0246 avatar Nov 08 '23 13:11 marc0246

I assume it's done for compatibility reasons, and I guess it also stops people from using sh when they're not actually using commands compatible with sh. I have both sh and bash, and the latter is 5.1.16.

Rua avatar Nov 08 '23 13:11 Rua

Yeah, that's why I'm happy you have it. It's not possible to install for me so mistakes are bound to happen. Bash is Linux-specific so I wanted to make the script more compatible by being inclusive to the BSD systems (and I guess MacOS?)

marc0246 avatar Nov 08 '23 13:11 marc0246

That's why I also removed all the RiiR programs. Personally when I tried to run the script I had 1/4 of those programs installed, and the one I did have installed (ripgrep) was a dependency at the time. Kind of silly if you ask me, since the whole point of shell scripts is that they run without additional setup.

marc0246 avatar Nov 08 '23 13:11 marc0246

It seems -o pipefail is bash-only. Pity, but it worked without it before so.

marc0246 avatar Nov 08 '23 13:11 marc0246

Now it works, but the gl-interop example crashes (as it has been for a while), and the script terminates instead of continuing. Is there a way to make it continue?

Rua avatar Nov 08 '23 13:11 Rua

Wait, is continuing on failure the expected behavior?

marc0246 avatar Nov 08 '23 13:11 marc0246

I actually hadn't noticed that, that the sh script would continue even after one of the commands returned non-zero. That makes the way the PowerShell scripts run inconsistent. But in any case, the gl-interop example crashes because of SIGSEGV which terminates everything I think. Not sure why exactly.

marc0246 avatar Nov 08 '23 14:11 marc0246

I put this at the start of the async-update example:

unsafe { (1 as *mut u8).write_volatile(69) };

And indeed this makes xargs terminate, unlike a panic for instance.

marc0246 avatar Nov 08 '23 14:11 marc0246

Wait, is continuing on failure the expected behavior?

It's what the script did before, at least. And there should be a way to skip over a problematic example so that you can continue with the rest, it shouldn't block you from everything else.

Rua avatar Nov 08 '23 14:11 Rua

As I say that's still the behavior, except for SIGSEGV, which makes xargs terminate for some reason. Pretty weird.

marc0246 avatar Nov 08 '23 14:11 marc0246

I'll use a loop instead of xargs, and make the PowerShell version behave the same, sometime later. This PR is not that high-priority anyway.

marc0246 avatar Nov 08 '23 14:11 marc0246