forked from davmac314/dinit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
DINIT_EXEC=${DINIT_EXEC:-../../dinit} | ||
DINITCTL_EXEC=${DINITCTL_EXE:-../../dinitctl} | ||
|
||
cd "$(dirname "$0")" | ||
|
||
# Tests around before/after link functionality. | ||
|
||
mkdir -p output | ||
rm -rf output/* | ||
|
||
"$DINIT_EXEC" -q -d sd1 -u -p socket & | ||
|
||
# Give some time for startup | ||
sleep 0.2 | ||
|
||
# start parent; should start service2 and then service1 (due to before= in service2). | ||
"$DINITCTL_EXEC" --quiet -p socket start parent | ||
|
||
if [ "$(cat output/script-output)" != "$(printf "two\none\n")" ]; then | ||
"$DINITCTL_EXEC" --quiet -p socket shutdown | ||
return 1 | ||
fi | ||
|
||
rm output/script-output | ||
|
||
# unloading and reloading service1 should not lose the before= relationship | ||
"$DINITCTL_EXEC" --quiet -p socket stop parent | ||
"$DINITCTL_EXEC" --quiet -p socket unload parent | ||
"$DINITCTL_EXEC" --quiet -p socket unload service1 | ||
|
||
"$DINITCTL_EXEC" --quiet -p socket reload service1 | ||
"$DINITCTL_EXEC" --quiet -p socket start parent | ||
|
||
if [ "$(cat output/script-output)" != "$(printf "two\none\n")" ]; then | ||
"$DINITCTL_EXEC" --quiet -p socket shutdown | ||
return 1 | ||
fi | ||
|
||
rm output/script-output | ||
|
||
"$DINITCTL_EXEC" --quiet -p socket shutdown | ||
# Success. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
sleep "$2" | ||
echo "$1" >> output/script-output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
type = internal | ||
before = service1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type = internal | ||
depends-on = service1 | ||
depends-on = service2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type = scripted | ||
command = scripts/service.sh one 0.5 | ||
#before = service2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
type = scripted | ||
command = scripts/service.sh two 0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
type = internal | ||
after = service1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type = internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters