[CRIU] [PATCH] test/rpc: fix test execution

Andrey Vagin avagin at openvz.org
Wed Nov 6 08:22:37 PST 2013


* fix compilation from the test/rpc directory

$ make
make: *** No rule to make target `/rpc.proto', needed by `rpc.pb-c.c'. Stop.

* use absolute path for pidfile

$ bash run.sh
**************************************************
		Shutdown service server
**************************************************

cat: pidfile: No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ...
or kill -l [sigspec]

Cc: Ruslan Kuprieiev <kupruser at gmail.com>
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/rpc/Makefile  | 12 ++++++------
 test/rpc/rpc.proto |  1 +
 test/rpc/run.sh    |  6 +++---
 test/rpc/test.c    |  1 +
 4 files changed, 11 insertions(+), 9 deletions(-)
 create mode 120000 test/rpc/rpc.proto

diff --git a/test/rpc/Makefile b/test/rpc/Makefile
index 61d1b3c..28bf530 100644
--- a/test/rpc/Makefile
+++ b/test/rpc/Makefile
@@ -3,14 +3,14 @@ all: test-c rpc_pb2.py
 test-c: rpc.pb-c.o test.o
 	gcc $^ -o $@ -lprotobuf-c
 
-test.o: ../test.c
+test.o: test.c
 	gcc -c $< -I ./
 
-rpc_pb2.py: ${PROTODIR}/rpc.proto
-	protoc --proto_path=${PROTODIR} --python_out=. ${PROTODIR}/rpc.proto
+rpc_pb2.py: rpc.proto
+	protoc --proto_path=. --python_out=. rpc.proto
 
-rpc.pb-c.c: ${PROTODIR}/rpc.proto
-	protoc-c --proto_path=${PROTODIR} --c_out=. ${PROTODIR}/rpc.proto
+rpc.pb-c.c: rpc.proto
+	protoc-c --proto_path=. --c_out=. rpc.proto
 
 clean:
-	rm -rf build
+	rm -rf build rpc.pb-c.o test.o test-c rpc.pb-c.c rpc.pb-c.h rpc_pb2.py
diff --git a/test/rpc/rpc.proto b/test/rpc/rpc.proto
new file mode 120000
index 0000000..bc0b0df
--- /dev/null
+++ b/test/rpc/rpc.proto
@@ -0,0 +1 @@
+../../protobuf/rpc.proto
\ No newline at end of file
diff --git a/test/rpc/run.sh b/test/rpc/run.sh
index f13b040..7cc8c52 100755
--- a/test/rpc/run.sh
+++ b/test/rpc/run.sh
@@ -34,13 +34,13 @@ title_print "Build programs"
 make clean
 mkdir build
 cd build
-make -f ../Makefile || { echo "FAIL"; exit 1; }
+make -C ../ || { echo "FAIL"; exit 1; }
 
 title_print "Start service server"
-${CRIU} service -v4 -o service.log --address criu_service.socket -d --pidfile pidfile || { echo "FAIL"; exit 1; }
+${CRIU} service -v4 -o service.log --address criu_service.socket -d --pidfile `pwd`/pidfile || { echo "FAIL"; exit 1; }
 
 title_print "Run test-c"
-./test-c || _exit $?
+../test-c || _exit $?
 
 title_print "Run test-py"
 ../test.py || _exit $?
diff --git a/test/rpc/test.c b/test/rpc/test.c
index 4481204..3f356fa 100644
--- a/test/rpc/test.c
+++ b/test/rpc/test.c
@@ -1,4 +1,5 @@
 #include "rpc.pb-c.h"
+#include <stdlib.h>
 #include <stdbool.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-- 
1.8.3.1



More information about the CRIU mailing list