[CRIU] [PATCH 2/2] zdtm: added a test validating ARM NEON checkpoint/restore

Alexander Kartashov alekskartashov at parallels.com
Sat Jun 1 09:37:13 EDT 2013


This patch adds the test static/arm-neon00 modelled
after the test static/fpu00: it initializes ARM NEON
registers before a checkpoint, carries out a simple
computation on ARM NEON after a restore and compares
the result against the result of the same computation
carried out before a checkpoint.

Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
 test/zdtm/live/static/Makefile     |    1 +
 test/zdtm/live/static/arm-neon00.c |   67 ++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 test/zdtm/live/static/arm-neon00.c

diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index a2e5cd4..0432030 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -14,6 +14,7 @@ TST_NOFILE	=				\
 		zombie00			\
 		fpu00				\
 		fpu01				\
+		arm-neon00			\
 		futex				\
 		futex-rl			\
 		mmx00				\
diff --git a/test/zdtm/live/static/arm-neon00.c b/test/zdtm/live/static/arm-neon00.c
new file mode 100644
index 0000000..96da16c
--- /dev/null
+++ b/test/zdtm/live/static/arm-neon00.c
@@ -0,0 +1,67 @@
+#include <stdlib.h>
+#include <time.h>
+
+#include "zdtmtst.h"
+
+const char *test_doc	= "Initialize VFP registers before a migration,\n"
+						  "check the VFP state is the same after a restore.";
+const char *test_author	= "Alexander Karatshov <alekskartashov at parallels.com>";
+
+
+#ifdef __arm__
+
+int main(int argc, char ** argv)
+{
+	srand(time(0));
+
+	int a = rand() % 100;
+	int b = rand() % 100;
+	int c = rand() % 100;
+	int y1 = a + b*c;
+	int y2;
+
+	test_init(argc, argv);
+
+	asm (
+		".fpu neon				\n"
+		"vmov.32	d0[0], %0	\n"
+		"vmov.32	d1[0], %1	\n"
+		"vmov.32	d2[0], %2	\n"
+		".fpu softvfp			\n"
+		: : "r"(a), "r"(b), "r"(c)
+	);
+
+	test_msg("Preparing to wait...\n");
+
+	test_daemon();
+	test_waitsig();
+
+	test_msg("Restored.\n");
+
+	asm (
+		".fpu neon				\n"
+		"vmul.I32	d3, d1, d2	\n"
+		"vadd.I32	d4, d0, d3	\n"
+		"vmov.32	%0, d4[0]	\n"
+		".fpu softvfp			\n"
+		: "=r"(y2)
+	);
+
+	if (y1 != y2)
+		fail("VFP restoration failed: result = %d, expected = %d (a = %d, b = %d, c = %d)\n", y2, y1, a, b, c);
+	else
+		pass();
+
+	return 0;
+}
+
+#else
+
+int main(int argc, char *argv[])
+{
+	test_init(argc, argv);
+	skip("This test is supposed to run on an ARM machine!");
+	return 0;
+}
+
+#endif
-- 
1.7.10.4



More information about the CRIU mailing list