From 954c39ec69050437008fb231b46697828a422634 Mon Sep 17 00:00:00 2001 From: Aiden Fujiwara Date: Thu, 5 Oct 2023 14:39:21 -0700 Subject: [PATCH] hacky scripts to test behavior for unix and windows --- .github/workflows/ci.yml | 11 ++++++++++- scripts/kill-process-test-unix.sh | 11 +++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ebe54b..c56dd8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,6 +71,7 @@ jobs: PATH=$PATH:~/.foreman/bin ./scripts/end-to-end-tests.sh + kill-process-test-unix: - name: kill-process-test-unix shell: bash run: | @@ -78,5 +79,13 @@ jobs: foreman --version PATH=$PATH:~/.foreman/bin ./scripts/kill-process-test-unix.sh - + + kill-process-test-windows: + - name: kill-process-test-windows + shell: pwsh + run: | + cargo install --path . + foreman --version + PATH=$PATH:~/.foreman/bin + ./scripts/kill-process-test-windows.ps1 diff --git a/scripts/kill-process-test-unix.sh b/scripts/kill-process-test-unix.sh index 7bf6c55..12b4bbf 100755 --- a/scripts/kill-process-test-unix.sh +++ b/scripts/kill-process-test-unix.sh @@ -1,11 +1,13 @@ #!/bin/bash write_foreman_toml () { + echo "writing foreman.toml" echo "[tools]" > foreman.toml echo "$2 = { $1 = \"$3\", version = \"=$4\" }" >> foreman.toml } create_rojo_files() { + echo "writing default.project.json" echo "{ \"name\": \"test\", \"tree\": { @@ -20,21 +22,22 @@ setup_rojo() { create_rojo_files } -delay_kill_process_and_check() { +kill_process_and_check_delayed() { echo "waiting 5 seconds before killing rojo" sleep 5 - ps -ef | grep "rojo serve" | grep -v grep ps -ef | grep "rojo serve" | grep -v grep | awk '{print $2}' | xargs kill -INT - ps -ef | grep "rojo serve" | grep -v grep + echo "waiting 5 seconds for rojo to be killed" + sleep 5 check_killed_subprocess } run_rojo_serve_and_kill_process() { setup_rojo - (rojo serve default.project.json) & (delay_kill_process_and_check) + (rojo serve default.project.json) & (kill_process_and_check_delayed) } check_killed_subprocess(){ + echo "checking if process was killed properly" if ps -ef | grep "rojo" | grep -v grep then echo "rojo subprocess was not killed properly"