Skip to content

Commit

Permalink
hacky scripts to test behavior for unix and windows
Browse files Browse the repository at this point in the history
  • Loading branch information
afujiwara-roblox committed Oct 5, 2023
1 parent fca3553 commit 954c39e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,21 @@ jobs:
PATH=$PATH:~/.foreman/bin
./scripts/end-to-end-tests.sh
kill-process-test-unix:
- name: kill-process-test-unix
shell: bash
run: |
cargo install --path .
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
11 changes: 7 additions & 4 deletions scripts/kill-process-test-unix.sh
Original file line number Diff line number Diff line change
@@ -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\": {
Expand All @@ -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"
Expand Down

0 comments on commit 954c39e

Please sign in to comment.