ARM: kprobes: Add Thumb instruction simulation test cases

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index e22c3f2..1cef0fa 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -1117,6 +1117,15 @@
  * Top level test functions
  */
 
+static int run_test_cases(void (*tests)(void))
+{
+	pr_info("    Run test cases\n");
+	tests();
+
+	return 0;
+}
+
+
 static int __init run_all_tests(void)
 {
 	int ret = 0;
@@ -1147,8 +1156,24 @@
 	if (ret)
 		goto out;
 
+	pr_info("16-bit Thumb instruction simulation\n");
+	ret = run_test_cases(kprobe_thumb16_test_cases);
+	if (ret)
+		goto out;
+
+	pr_info("32-bit Thumb instruction simulation\n");
+	ret = run_test_cases(kprobe_thumb32_test_cases);
+	if (ret)
+		goto out;
 #endif
 
+	pr_info("Total instruction simulation tests=%d, pass=%d fail=%d\n",
+		test_try_count, test_pass_count, test_fail_count);
+	if (test_fail_count) {
+		ret = -EINVAL;
+		goto out;
+	}
+
 out:
 	if (ret == 0)
 		pr_info("Finished kprobe tests OK\n");