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

Improve examples scripts #2397

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

marc0246
Copy link
Contributor

@marc0246 marc0246 commented Nov 5, 2023

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.

@Rua
Copy link
Contributor

Rua commented Nov 8, 2023

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

@marc0246
Copy link
Contributor Author

marc0246 commented Nov 8, 2023

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

@Rua
Copy link
Contributor

Rua commented Nov 8, 2023

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

Eh? XD

@marc0246
Copy link
Contributor Author

marc0246 commented Nov 8, 2023

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.

@Rua
Copy link
Contributor

Rua commented Nov 8, 2023

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.

@marc0246
Copy link
Contributor Author

marc0246 commented Nov 8, 2023

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
Copy link
Contributor Author

marc0246 commented Nov 8, 2023

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
Copy link
Contributor Author

marc0246 commented Nov 8, 2023

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

@Rua
Copy link
Contributor

Rua commented Nov 8, 2023

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?

@marc0246
Copy link
Contributor Author

marc0246 commented Nov 8, 2023

Wait, is continuing on failure the expected behavior?

@marc0246
Copy link
Contributor Author

marc0246 commented Nov 8, 2023

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
Copy link
Contributor Author

marc0246 commented Nov 8, 2023

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.

@Rua
Copy link
Contributor

Rua commented Nov 8, 2023

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.

@marc0246
Copy link
Contributor Author

marc0246 commented Nov 8, 2023

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

@marc0246
Copy link
Contributor Author

marc0246 commented Nov 8, 2023

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 marc0246 marked this pull request as draft November 8, 2023 14:28
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.

2 participants