[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v23 11/33] asn1_test: return either 0 or 1 to reflect the results
From: |
Gary Lin |
Subject: |
[PATCH v23 11/33] asn1_test: return either 0 or 1 to reflect the results |
Date: |
Fri, 15 Nov 2024 15:34:39 +0800 |
Some testcases use exit() to end the test. Since all the asn1 testcases
are invoked as functions, this commit replaces exit() with return to
reflect the test results, so that the main test function can check the
results.
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
...-either-0-or-1-to-reflect-the-result.patch | 78 +++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644
grub-core/lib/libtasn1-patches/0009-asn1_test-return-either-0-or-1-to-reflect-the-result.patch
diff --git
a/grub-core/lib/libtasn1-patches/0009-asn1_test-return-either-0-or-1-to-reflect-the-result.patch
b/grub-core/lib/libtasn1-patches/0009-asn1_test-return-either-0-or-1-to-reflect-the-result.patch
new file mode 100644
index 000000000..b76942d84
--- /dev/null
+++
b/grub-core/lib/libtasn1-patches/0009-asn1_test-return-either-0-or-1-to-reflect-the-result.patch
@@ -0,0 +1,78 @@
+From 103ec39de5277e2683099017959415e107b885a5 Mon Sep 17 00:00:00 2001
+From: Gary Lin <glin@suse.com>
+Date: Fri, 16 Aug 2024 15:32:39 +0800
+Subject: [PATCH 09/13] asn1_test: return either 0 or 1 to reflect the results
+
+Some testcases use exit() to end the test. Since all the asn1 testcases
+are invoked as functions, this commit replaces exit() with return to
+reflect the test results, so that the main test function can check the
+results.
+
+Signed-off-by: Daniel Axtens <dja@axtens.net>
+Signed-off-by: Gary Lin <glin@suse.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/tests/asn1/tests/CVE-2018-1000654.c | 6 +++---
+ grub-core/tests/asn1/tests/reproducers.c | 6 +++---
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/grub-core/tests/asn1/tests/CVE-2018-1000654.c
b/grub-core/tests/asn1/tests/CVE-2018-1000654.c
+index a935ab541..2085b3cd3 100644
+--- a/grub-core/tests/asn1/tests/CVE-2018-1000654.c
++++ b/grub-core/tests/asn1/tests/CVE-2018-1000654.c
+@@ -45,7 +45,7 @@ test_CVE_2018_1000654 (void)
+ {
+ asn1_perror (result);
+ printf ("ErrorDescription = %s\n\n", errorDescription);
+- exit (1);
++ return 1;
+ }
+
+ asn1_delete_structure (&definitions);
+@@ -59,12 +59,12 @@ test_CVE_2018_1000654 (void)
+ {
+ asn1_perror (result);
+ printf ("ErrorDescription = %s\n\n", errorDescription);
+- exit (1);
++ return 1;
+ }
+
+ asn1_delete_structure (&definitions);
+
+ if (verbose)
+ printf ("Success\n");
+- exit (0);
++ return 0;
+ }
+diff --git a/grub-core/tests/asn1/tests/reproducers.c
b/grub-core/tests/asn1/tests/reproducers.c
+index e843b74b9..54a243d51 100644
+--- a/grub-core/tests/asn1/tests/reproducers.c
++++ b/grub-core/tests/asn1/tests/reproducers.c
+@@ -63,7 +63,7 @@ test_reproducers (void)
+ {
+ asn1_perror (result);
+ printf ("ErrorDescription = %s\n\n", errorDescription);
+- exit (EXIT_FAILURE);
++ return 1;
+ }
+
+ asn1_delete_structure (&definitions);
+@@ -74,7 +74,7 @@ test_reproducers (void)
+ {
+ asn1_perror (result);
+ printf ("ErrorDescription = %s\n\n", errorDescription);
+- exit (EXIT_FAILURE);
++ return 1;
+ }
+
+ asn1_delete_structure (&definitions);
+@@ -82,5 +82,5 @@ test_reproducers (void)
+ if (verbose)
+ printf ("Success\n");
+
+- exit (EXIT_SUCCESS);
++ return 0;
+ }
+--
+2.43.0
+
--
2.43.0
- [PATCH v23 01/33] posix_wrap: tweaks in preparation for libtasn1, (continued)
- [PATCH v23 01/33] posix_wrap: tweaks in preparation for libtasn1, Gary Lin, 2024/11/15
- [PATCH v23 02/33] libtasn1: import libtasn1-4.19.0, Gary Lin, 2024/11/15
- [PATCH v23 04/33] libtasn1: replace strcat() with strcpy() in _asn1_str_cat(), Gary Lin, 2024/11/15
- [PATCH v23 06/33] libtasn1: adjust the header paths in libtasn1.h, Gary Lin, 2024/11/15
- [PATCH v23 03/33] libtasn1: disable code not needed in grub, Gary Lin, 2024/11/15
- [PATCH v23 05/33] libtasn1: replace strcat() with _asn1_str_cat(), Gary Lin, 2024/11/15
- [PATCH v23 07/33] libtasn1: Use grub_divmod64() for division, Gary Lin, 2024/11/15
- [PATCH v23 08/33] libtasn1: fix the potential buffer overrun, Gary Lin, 2024/11/15
- [PATCH v23 09/33] asn1_test: include asn1_test.h only, Gary Lin, 2024/11/15
- [PATCH v23 10/33] asn1_test: rename the main functions to the test names, Gary Lin, 2024/11/15
- [PATCH v23 11/33] asn1_test: return either 0 or 1 to reflect the results,
Gary Lin <=
- [PATCH v23 12/33] asn1_test: remove 'verbose' and the unnecessary printf(), Gary Lin, 2024/11/15
- [PATCH v23 13/33] asn1_test: print the error messages with grub_printf(), Gary Lin, 2024/11/15
- [PATCH v23 14/33] asn1_test: use the grub-specific functions and types, Gary Lin, 2024/11/15
- [PATCH v23 15/33] asn1_test: enable the testcase only when GRUB_LONG_MAX is larger than GRUB_INT_MAX, Gary Lin, 2024/11/15
- [PATCH v23 16/33] libtasn1: compile into asn1 module, Gary Lin, 2024/11/15
- [PATCH v23 17/33] asn1_test: test module for libtasn1, Gary Lin, 2024/11/15
- [PATCH v23 18/33] libtasn1: Add the documentation, Gary Lin, 2024/11/15
- [PATCH v23 19/33] key_protector: Add key protectors framework, Gary Lin, 2024/11/15
- [PATCH v23 20/33] tss2: Add TPM2 buffer handling functions, Gary Lin, 2024/11/15
- [PATCH v23 21/33] tss2: Add TPM2 types and Marshal/Unmarshal functions, Gary Lin, 2024/11/15