[CRIU] [PATCH 4/6] test: Clean old libcriu tests

Pavel Emelyanov xemul at parallels.com
Wed Jun 25 04:24:44 PDT 2014


New ones cover more and can be used in Jenkins.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 test/libcriu/Makefile | 10 ++----
 test/libcriu/loop.sh  |  4 ---
 test/libcriu/run.sh   | 64 -----------------------------------
 test/libcriu/test.c   | 94 ---------------------------------------------------
 4 files changed, 2 insertions(+), 170 deletions(-)
 delete mode 100755 test/libcriu/loop.sh
 delete mode 100755 test/libcriu/run.sh
 delete mode 100644 test/libcriu/test.c

diff --git a/test/libcriu/Makefile b/test/libcriu/Makefile
index a7f0093..462af64 100644
--- a/test/libcriu/Makefile
+++ b/test/libcriu/Makefile
@@ -1,4 +1,4 @@
-all: build/test test_sub test_self
+all: test_sub test_self
 .PHONY: all
 
 run: all
@@ -16,12 +16,6 @@ test_self: test_self.o
 test_self.o: test_self.c
 	gcc -c $^ -I ../../lib -o $@
 
-build/test: build/test.o
-	gcc $^ -L ../../lib -lcriu -o $@
-
-build/test.o: test.c
-	gcc -c $^ -I ../../lib -o $@
-
 clean:
-	rm -rf build test_sub test_sub.o test_self test_sub.o
+	rm -rf test_sub test_sub.o test_self test_sub.o
 .PHONY: clean
diff --git a/test/libcriu/loop.sh b/test/libcriu/loop.sh
deleted file mode 100755
index 0ab34ce..0000000
--- a/test/libcriu/loop.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-while :; do
-	sleep 1
-done
diff --git a/test/libcriu/run.sh b/test/libcriu/run.sh
deleted file mode 100755
index 1437bcf..0000000
--- a/test/libcriu/run.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/bash
-
-source ../env.sh || exit 1
-
-export PROTODIR=`readlink -f "${PWD}/../../protobuf"`
-
-echo $PROTODIR
-
-LOOP_PID=0
-
-function title_print {
-	echo -e "\n**************************************************"
-	echo -e "\t\t"$1
-	echo -e "**************************************************\n"
-
-}
-
-function _exit {
-	if [ $1 -ne 0 ]; then
-		echo "FAIL"
-	fi
-
-	if [ $LOOP_PID -ne 0 ]; then
-		kill -SIGTERM $LOOP_PID
-	fi
-
-	title_print "Shutdown service server"
-	kill -SIGTERM `cat pidfile`
-
-	exit $1
-}
-
-function check_and_term {
-	title_print "Check and term $1"
-	ps -C $1
-	pkill $1
-}
-
-title_print "Build programs"
-make clean
-mkdir build
-cd build
-mkdir imgs_loop
-mkdir imgs_test
-make -C ../ || { echo "FAIL"; exit 1; }
-
-title_print "Start service server"
-${CRIU} service -v4 -o service.log --address criu_service.socket -d --pidfile `pwd`/pidfile || { echo "FAIL"; exit 1; }
-
-title_print "Run loop.sh"
-setsid ../loop.sh < /dev/null &> loop.log &
-LOOP_PID=${!}
-echo "pid ${LOOP_PID}"
-
-title_print "Run test.c"
-ln -s ../../../lib/libcriu.so libcriu.so.1
-LD_LIBRARY_PATH=.
-export LD_LIBRARY_PATH
-./test ${LOOP_PID} || _exit $?
-
-title_print "Restore test.c"
-${CRIU} restore -v4 -o restore-test.log -D imgs_test --shell-job || _exit $?
-
-_exit 0
diff --git a/test/libcriu/test.c b/test/libcriu/test.c
deleted file mode 100644
index b58f96a..0000000
--- a/test/libcriu/test.c
+++ /dev/null
@@ -1,94 +0,0 @@
-#include "criu.h"
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-
-static void what_err_ret_mean(ret)
-{
-	/* NOTE: errno is set by libcriu */
-	switch (ret) {
-	case -EBADE:
-		perror("RPC has returned fail");
-		break;
-	case -ECONNREFUSED:
-		perror("Unable to connect to CRIU");
-		break;
-	case -ECOMM:
-		perror("Unable to send/recv msg to/from CRIU");
-		break;
-	case -EINVAL:
-		perror("CRIU doesn't support this type of request."
-		       "You should probably update CRIU");
-		break;
-	case -EBADMSG:
-		perror("Unexpected response from CRIU."
-		       "You should probably update CRIU");
-		break;
-	default:
-		perror("Unknown error type code."
-		       "You should probably update CRIU");
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	int ret, fd;
-
-	criu_set_service_address("criu_service.socket");
-
-	puts("--- Check ---");
-	ret = criu_check();
-	if (ret < 0) {
-		what_err_ret_mean(ret);
-		return -1;
-	} else
-		puts("Success");
-
-	puts("--- Dump loop ---");
-	criu_init_opts();
-	criu_set_pid(atoi(argv[1]));
-	criu_set_log_file("dump.log");
-	criu_set_log_level(4);
-	fd = open("imgs_loop", O_DIRECTORY);
-	criu_set_images_dir_fd(fd);
-
-	ret = criu_dump();
-	if (ret < 0) {
-		what_err_ret_mean(ret);
-		return -1;
-	} else if (ret == 0)
-		puts("Success");
-
-	puts("--- Restore loop ---");
-	criu_init_opts();
-	criu_set_log_level(4);
-	criu_set_log_file("restore.log");
-	criu_set_images_dir_fd(fd);
-
-	ret = criu_restore();
-	if (ret < 0) {
-		what_err_ret_mean(ret);
-		return -1;
-	} else if (ret > 0) {
-		puts("Success");
-		printf("pid %d\n", ret);
-	}
-
-	puts("--- Dump myself ---");
-	criu_init_opts();
-	criu_set_leave_running(true);
-	criu_set_shell_job(true);
-	criu_set_images_dir_fd(open("imgs_test", O_DIRECTORY));
-
-	ret = criu_dump();
-	if (ret < 0) {
-		what_err_ret_mean(ret);
-		return -1;
-	} else {
-		puts("Success");
-		if (ret == 1)
-			puts("Restored");
-	}
-
-	return 0;
-}
-- 
1.8.4.2




More information about the CRIU mailing list