aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/cryptodev/sdk_patches/0065-return-error-code-of-the-test-if-there-is-one.patch
blob: 277523745dd5a5d763a1d24aa2ddf3753aa0f993 (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
From 58da37b93d2532e489514b810c63d735a165ff09 Mon Sep 17 00:00:00 2001
From: Cristian Stoica <cristian.stoica@nxp.com>
Date: Wed, 26 Oct 2016 10:47:58 +0300
Subject: [PATCH 065/104] return error code of the test if there is one

Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
---
 tests/async_speed.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/async_speed.c b/tests/async_speed.c
index f2b9772..d843c02 100644
--- a/tests/async_speed.c
+++ b/tests/async_speed.c
@@ -239,6 +239,7 @@ int run_test(int id, struct test_params tp)
 {
 	int fd;
 	int fdc;
+	int err;
 
 	fd = open("/dev/crypto", O_RDWR, 0);
 	if (fd < 0) {
@@ -253,10 +254,12 @@ int run_test(int id, struct test_params tp)
 	if (!tp.mflag) {
 		fprintf(stderr, "Testing %s:\n", ciphers[id].name);
 	}
-	ciphers[id].func(fdc, tp);
+	err = ciphers[id].func(fdc, tp);
 
 	close(fdc);
 	close(fd);
+
+	return err;
 }
 
 void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess)
@@ -384,6 +387,7 @@ int run_sha256(int fdc, struct test_params tp)
 
 int main(int argc, char **argv)
 {
+	int err = 0;
 	int i;
 	int c;
 	bool alg_flag;
@@ -436,14 +440,17 @@ int main(int argc, char **argv)
 
 		if (alg_flag) {
 			if (strcmp(alg_name, ciphers[i].name) == 0) {
-				run_test(i, tp);
+				err = run_test(i, tp);
 			}
 		} else {
-			run_test(i, tp);
+			err = run_test(i, tp);
+			if (err != 0) {
+				break;
+			}
 		}
 	}
 
-	return 0;
+	return err;
 }
 
 #else
-- 
2.10.2