test/app/stub: create sentinel file when init complete
This is more reliable than checking for the DPDK generated /var/run/*config file, and is not DPDK dependent. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Iadaba1c715e6fe2aafd7375831961b79ae31714a Reviewed-on: https://review.gerrithub.io/362628 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
d5b6b1880e
commit
675dc02b81
@ -231,15 +231,15 @@ function start_stub() {
|
||||
$rootdir/test/app/stub/stub $1 &
|
||||
stubpid=$!
|
||||
echo Waiting for stub to ready for secondary processes...
|
||||
while ! [ -e /var/run/.spdk0_config ]; do
|
||||
sleep 0.1s
|
||||
while ! [ -e /var/run/spdk_stub0 ]; do
|
||||
sleep 1s
|
||||
done
|
||||
echo done.
|
||||
}
|
||||
|
||||
function kill_stub() {
|
||||
kill $stubpid
|
||||
rm -rf /var/run/.spdk0_config
|
||||
rm -rf /var/run/spdk_stub0
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
|
@ -36,6 +36,8 @@
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/nvme.h"
|
||||
|
||||
static char g_path[256];
|
||||
|
||||
static void
|
||||
usage(char *executable_name)
|
||||
{
|
||||
@ -105,6 +107,12 @@ main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
snprintf(g_path, sizeof(g_path), "/var/run/spdk_stub%d", opts.shm_id);
|
||||
if (mknod(g_path, S_IFREG, 0) != 0) {
|
||||
fprintf(stderr, "could not create sentinel file %s\n", g_path);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
sleep(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user