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:
Jim Harris 2017-05-25 15:26:18 -07:00
parent d5b6b1880e
commit 675dc02b81
2 changed files with 11 additions and 3 deletions

View File

@ -231,15 +231,15 @@ function start_stub() {
$rootdir/test/app/stub/stub $1 & $rootdir/test/app/stub/stub $1 &
stubpid=$! stubpid=$!
echo Waiting for stub to ready for secondary processes... echo Waiting for stub to ready for secondary processes...
while ! [ -e /var/run/.spdk0_config ]; do while ! [ -e /var/run/spdk_stub0 ]; do
sleep 0.1s sleep 1s
done done
echo done. echo done.
} }
function kill_stub() { function kill_stub() {
kill $stubpid kill $stubpid
rm -rf /var/run/.spdk0_config rm -rf /var/run/spdk_stub0
} }
function run_test() { function run_test() {

View File

@ -36,6 +36,8 @@
#include "spdk/env.h" #include "spdk/env.h"
#include "spdk/nvme.h" #include "spdk/nvme.h"
static char g_path[256];
static void static void
usage(char *executable_name) usage(char *executable_name)
{ {
@ -105,6 +107,12 @@ main(int argc, char **argv)
exit(1); 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) { while (1) {
sleep(1); sleep(1);
} }