[CRIU] [PATCH 5/6] test: libcriu: switch to using swrk instead of service

Ruslan Kuprieiev rkuprieiev at cloudlinux.com
Mon Oct 12 02:50:05 PDT 2015


As our tests serve as an example for people on how to preferably
use criu, we need to also switch to swrk.

Signed-off-by: Ruslan Kuprieiev <rkuprieiev at cloudlinux.com>
---
 test/libcriu/run.sh        | 10 +++-------
 test/libcriu/test_errno.c  |  2 +-
 test/libcriu/test_iters.c  |  2 +-
 test/libcriu/test_notify.c |  2 +-
 test/libcriu/test_self.c   |  2 +-
 test/libcriu/test_sub.c    |  2 +-
 6 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/test/libcriu/run.sh b/test/libcriu/run.sh
index d97c518..51ed141 100755
--- a/test/libcriu/run.sh
+++ b/test/libcriu/run.sh
@@ -8,10 +8,7 @@ rm -rf wdir
 rm -f ./libcriu.so.1
 
 echo "== Prepare"
-mkdir -p wdir/s/
-mkdir wdir/i/
-echo "== Start service"
-${CRIU} service -v4 -o service.log --address cs.sk -d --pidfile pidfile -W wdir/s/ || { echo "FAIL service start"; exit 1; }
+mkdir -p wdir/i/
 
 echo "== Run tests"
 ln -s ../../lib/libcriu.so libcriu.so.1
@@ -28,7 +25,7 @@ function run_test {
 	else
 		echo "== Test $1"
 		mkdir wdir/i/$1/
-		if ! setsid ./$1 wdir/s/cs.sk wdir/i/$1/ < /dev/null &>> wdir/i/$1/test.log; then
+		if ! setsid ./$1 ${CRIU} wdir/i/$1/ < /dev/null &>> wdir/i/$1/test.log; then
 			echo "$1: FAIL"
 			RESULT=1
 		fi
@@ -41,8 +38,7 @@ run_test test_notify
 run_test test_iters
 run_test test_errno
 
-echo "== Stopping service"
-kill -TERM $(cat wdir/s/pidfile)
+echo "== Tests done"
 unlink libcriu.so.1
 [ $RESULT -eq 0 ] && echo "Success" || echo "FAIL"
 exit $RESULT
diff --git a/test/libcriu/test_errno.c b/test/libcriu/test_errno.c
index 185c3f0..e091443 100644
--- a/test/libcriu/test_errno.c
+++ b/test/libcriu/test_errno.c
@@ -30,7 +30,7 @@ static int init(char *argv[])
 static void get_base_req(void)
 {
 	criu_init_opts();
-	criu_set_service_address(service);
+	criu_set_service_binary(service);
 	criu_set_images_dir_fd(dir_fd);
 	criu_set_log_level(4);
 }
diff --git a/test/libcriu/test_iters.c b/test/libcriu/test_iters.c
index a29f415..660da92 100644
--- a/test/libcriu/test_iters.c
+++ b/test/libcriu/test_iters.c
@@ -103,7 +103,7 @@ int main(int argc, char **argv)
 
 	printf("--- Dump loop ---\n");
 	criu_init_opts();
-	criu_set_service_address(argv[1]);
+	criu_set_service_binary(argv[1]);
 	criu_set_pid(pid);
 	criu_set_log_file("dump.log");
 	criu_set_log_level(4);
diff --git a/test/libcriu/test_notify.c b/test/libcriu/test_notify.c
index 3839362..54fb255 100644
--- a/test/libcriu/test_notify.c
+++ b/test/libcriu/test_notify.c
@@ -68,7 +68,7 @@ int main(int argc, char **argv)
 
 	printf("--- Dump loop ---\n");
 	criu_init_opts();
-	criu_set_service_address(argv[1]);
+	criu_set_service_binary(argv[1]);
 	criu_set_pid(pid);
 	criu_set_log_file("dump.log");
 	criu_set_log_level(4);
diff --git a/test/libcriu/test_self.c b/test/libcriu/test_self.c
index 592ec5f..c9d2a2e 100644
--- a/test/libcriu/test_self.c
+++ b/test/libcriu/test_self.c
@@ -22,7 +22,7 @@ int main(int argc, char *argv[])
 	}
 
 	criu_init_opts();
-	criu_set_service_address(argv[1]);
+	criu_set_service_binary(argv[1]);
 	criu_set_images_dir_fd(fd);
 	criu_set_log_level(4);
 
diff --git a/test/libcriu/test_sub.c b/test/libcriu/test_sub.c
index f67dc00..b435f67 100644
--- a/test/libcriu/test_sub.c
+++ b/test/libcriu/test_sub.c
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
 
 	printf("--- Dump loop ---\n");
 	criu_init_opts();
-	criu_set_service_address(argv[1]);
+	criu_set_service_binary(argv[1]);
 	criu_set_pid(pid);
 	criu_set_log_file("dump.log");
 	criu_set_log_level(4);
-- 
2.4.3



More information about the CRIU mailing list