mirror of
https://github.com/troglobit/finit.git
synced 2026-10-17 10:49:34 +00:00
test: refactor test framework to use a rootfs skeleton
Instead of having to create files, and copying them in place for each test, we move all static test files to a skeleton rootfs. This makes it a lot easier to get an overview of how things and how they work. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
5c2577214d
commit
7f8a96a73e
49 files changed
+96
-70
No files matched your search
@@ -0,0 +1 @@
|
||||
ea7e2353af0067a926d3e021e504290e busybox-x86_64
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
nm=$1
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
getpid()
|
||||
{
|
||||
initctl status "$1" |awk '/PID :/{ print $3; }'
|
||||
}
|
||||
|
||||
pid=$(getpid "$nm")
|
||||
if [ -f oldpid ]; then
|
||||
oldpid=$(cat oldpid)
|
||||
if [ "$oldpid" = "$pid" ]; then
|
||||
echo "Looks bad, wait for it ..."
|
||||
sleep 3
|
||||
pid=$(getpid "$nm")
|
||||
if [ "$oldpid" = "$pid" ]; then
|
||||
echo "Finit did not deregister old PID $oldpid vs $pid"
|
||||
initctl status "$nm"
|
||||
ps
|
||||
echo "Reloading finit ..."
|
||||
initctl reload
|
||||
sleep 1
|
||||
initctl status "$nm"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$pid" -le 1 ]; then
|
||||
sleep 3
|
||||
pid=$(getpid "$nm")
|
||||
if [ "$pid" -le 1 ]; then
|
||||
echo "Got a bad PID: $pid, aborting ..."
|
||||
ps
|
||||
sleep 1
|
||||
initctl status "$nm"
|
||||
ps
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$pid" > oldpid
|
||||
|
||||
#echo "PID $pid, kill -9 ..."
|
||||
kill -9 "$pid"
|
||||
Reference in new issue
Block a user