From c93e37671a680874fcb647013ad6c69c05d4e702 Mon Sep 17 00:00:00 2001 From: marc0246 <40955683+marc0246@users.noreply.github.com> Date: Sun, 5 Nov 2023 13:35:00 +0100 Subject: [PATCH 1/5] Add other scripts --- examples/run_all.ps1 | 3 +++ examples/run_all_headless.ps1 | 13 +++++++++++++ examples/run_all_headless.sh | 5 +++++ 3 files changed, 21 insertions(+) create mode 100644 examples/run_all.ps1 create mode 100644 examples/run_all_headless.ps1 create mode 100755 examples/run_all_headless.sh diff --git a/examples/run_all.ps1 b/examples/run_all.ps1 new file mode 100644 index 0000000000..9cbd8b2bb9 --- /dev/null +++ b/examples/run_all.ps1 @@ -0,0 +1,3 @@ +cargo build --bins +@(Get-ChildItem -Directory -Name) | %{cargo run --bin $_} +rm pipeline-caching\pipeline_cache.bin diff --git a/examples/run_all_headless.ps1 b/examples/run_all_headless.ps1 new file mode 100644 index 0000000000..5b28584794 --- /dev/null +++ b/examples/run_all_headless.ps1 @@ -0,0 +1,13 @@ +foreach ($example in Get-ChildItem -Directory -Name) { + $proc = Start-Process "cargo" "run --bin $example" -NoNewWindow -PassThru + + $timeouted = $null + + $proc | Wait-Process -Timeout 15 -ErrorAction SilentlyContinue -ErrorVariable timeouted + + if ($timeouted) { + $proc | Stop-Process + } elseif ($proc.ExitCode -ne 0) { + Exit $proc.ExitCode + } +} diff --git a/examples/run_all_headless.sh b/examples/run_all_headless.sh new file mode 100755 index 0000000000..44f9b6407e --- /dev/null +++ b/examples/run_all_headless.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -euo pipefail + +exa -F . | rg '/$' | sd '/' '' | rargs timeout --preserve-status 15s cargo run --bin {} +rm -f pipeline-caching/pipeline_cache.bin From 7ce597eeb62d94a6ed1bfb6ffde2baf626262a47 Mon Sep 17 00:00:00 2001 From: marc0246 <40955683+marc0246@users.noreply.github.com> Date: Sun, 5 Nov 2023 13:35:57 +0100 Subject: [PATCH 2/5] Improve existing sh script's failsafes --- examples/run_all.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/run_all.sh b/examples/run_all.sh index c03e4d18b7..48722d03a7 100755 --- a/examples/run_all.sh +++ b/examples/run_all.sh @@ -1,5 +1,5 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash +set -euo pipefail # This script builds and runs all the examples # It is NOT headless From 9cd08df449a56bad14c63c533c93a09e25675090 Mon Sep 17 00:00:00 2001 From: marc0246 <40955683+marc0246@users.noreply.github.com> Date: Sun, 5 Nov 2023 14:08:47 +0100 Subject: [PATCH 3/5] Remove all the Rust fluff from the sh scripts --- examples/run_all.sh | 2 +- examples/run_all_headless.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/run_all.sh b/examples/run_all.sh index 48722d03a7..1da32fb7a7 100755 --- a/examples/run_all.sh +++ b/examples/run_all.sh @@ -7,5 +7,5 @@ set -euo pipefail # Human monitoring is also required to check for errors in stdout cargo build --bins -exa -F . | rg '/$' | sd '/' '' | rargs cargo run --bin {} +ls -F | grep '/$' | sed 's|/||' | xargs -E '' -I {} cargo run --bin {} rm -f pipeline-caching/pipeline_cache.bin diff --git a/examples/run_all_headless.sh b/examples/run_all_headless.sh index 44f9b6407e..ffd83f1b41 100755 --- a/examples/run_all_headless.sh +++ b/examples/run_all_headless.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -euo pipefail -exa -F . | rg '/$' | sd '/' '' | rargs timeout --preserve-status 15s cargo run --bin {} +ls -F | grep '/$' | sed 's|/$||' | xargs -E '' -I {} timeout --preserve-status 15s cargo run --bin {} rm -f pipeline-caching/pipeline_cache.bin From 82b6d4dabde18ea3a86e0b4b7bf9487af7a685ed Mon Sep 17 00:00:00 2001 From: marc0246 <40955683+marc0246@users.noreply.github.com> Date: Sun, 5 Nov 2023 14:09:44 +0100 Subject: [PATCH 4/5] Make the sh scripts even more portable --- examples/run_all.sh | 2 +- examples/run_all_headless.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/run_all.sh b/examples/run_all.sh index 1da32fb7a7..ad7da88234 100755 --- a/examples/run_all.sh +++ b/examples/run_all.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -euo pipefail # This script builds and runs all the examples diff --git a/examples/run_all_headless.sh b/examples/run_all_headless.sh index ffd83f1b41..0bfb4bc1ac 100755 --- a/examples/run_all_headless.sh +++ b/examples/run_all_headless.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -euo pipefail ls -F | grep '/$' | sed 's|/$||' | xargs -E '' -I {} timeout --preserve-status 15s cargo run --bin {} From b56d5be30688c8441be95acecdf12f24191b5858 Mon Sep 17 00:00:00 2001 From: marc0246 <40955683+marc0246@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:35:22 +0100 Subject: [PATCH 5/5] Remove `-o pipefail` --- examples/run_all.sh | 2 +- examples/run_all_headless.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/run_all.sh b/examples/run_all.sh index ad7da88234..4ab9947b6c 100755 --- a/examples/run_all.sh +++ b/examples/run_all.sh @@ -1,5 +1,5 @@ #!/usr/bin/env sh -set -euo pipefail +set -eu # This script builds and runs all the examples # It is NOT headless diff --git a/examples/run_all_headless.sh b/examples/run_all_headless.sh index 0bfb4bc1ac..27b809abdf 100755 --- a/examples/run_all_headless.sh +++ b/examples/run_all_headless.sh @@ -1,5 +1,5 @@ #!/usr/bin/env sh -set -euo pipefail +set -eu ls -F | grep '/$' | sed 's|/$||' | xargs -E '' -I {} timeout --preserve-status 15s cargo run --bin {} rm -f pipeline-caching/pipeline_cache.bin