Welcome to mirror list, hosted at ThFree Co, Russian Federation.

run.sh « rpc « others « test - github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9be5775872d9d96d51ace71a3e2f886aa00d8f38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash

set -ex

if [ -e /etc/os-release ]; then
	. /etc/os-release
	if [ "$ID" == "centos" ] && [[ "$VERSION_ID" == "7"* ]];then
		echo "Skipping tests on CentOS 7 because they do not work in CI"
		exit 0
	fi
fi

CRIU=./criu

export PROTODIR=`readlink -f "${PWD}/../../protobuf"`

echo $PROTODIR

function title_print {
	echo -e "\n**************************************************"
	echo -e "\t\t"$1
	echo -e "**************************************************\n"

}

function stop_server {
	title_print "Shutdown service server"
	kill -SIGTERM $(cat build/pidfile)
	unlink build/pidfile
}

function test_c {
	mkdir -p build/imgs_c

	title_print "Run test-c"
	setsid ./test-c build/criu_service.socket build/imgs_c < /dev/null &>> build/output_c

	title_print "Restore test-c"
	${CRIU} restore -v4 -o restore-c.log -D build/imgs_c
}

function test_py {
	mkdir -p build/imgs_py

	title_print "Run test-py"
	setsid ./test.py build/criu_service.socket build/imgs_py < /dev/null &>> build/output_py

	title_print "Restore test-py"
	${CRIU} restore -v4 -o restore-py.log -D build/imgs_py
}

function test_restore_loop {
	mkdir -p build/imgs_loop

	title_print "Run loop process"
	P=$(../loop)
	echo "pid ${P}"

	title_print "Dump loop process"
	# So theoretically '-j' (--shell-job) should not be necessary, but on alpine
	# this test fails without it.
	${CRIU} dump -j -v4 -o dump-loop.log -D build/imgs_loop -t ${P}

	title_print "Run restore-loop"
	./restore-loop.py build/criu_service.socket build/imgs_loop
	kill -SIGTERM ${P}
}

function test_ps {
	mkdir -p build/imgs_ps

	title_print "Run ps_test"
	setsid ./ps_test.py build/criu_service.socket build/imgs_ps < /dev/null &>> build/output_ps
}

function test_errno {
	mkdir -p build/imgs_errno

	title_print "Run cr_errno test"
	setsid ./errno.py build/criu_service.socket build/imgs_errno < /dev/null &>> build/output_errno
}

trap 'echo "FAIL"; stop_server' EXIT

test_c
test_py
test_restore_loop
test_ps
test_errno

stop_server

trap 'echo "Success"' EXIT