grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v20 15/33] asn1_test: exclude a testcase when long and int are th


From: Gary Lin
Subject: [PATCH v20 15/33] asn1_test: exclude a testcase when long and int are the same
Date: Mon, 21 Oct 2024 16:06:53 +0800

There is a testcase to test the values larger than 'int' but smaller
than 'long'. However, for some architectures, 'long' and 'int' are the
same, and the compiler may issue a warning like this:

grub-core/tests/asn1/tests/Test_overflow.c:48:50: error: left shift of negative 
value [-Werror=shift-negative-value]
       unsigned long num = ((long) GRUB_UINT_MAX) << 2;
                                                  ^~

To avoid the unnecessary error, the testcase is opted out when
GRUB_LONG_MAX is not larger than GRUB_INT_MAX.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Gary Lin <glin@suse.com>
---
 ...e-a-testcase-when-long-and-int-are-t.patch | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 
grub-core/lib/libtasn1-patches/0013-asn1_test-exclude-a-testcase-when-long-and-int-are-t.patch

diff --git 
a/grub-core/lib/libtasn1-patches/0013-asn1_test-exclude-a-testcase-when-long-and-int-are-t.patch
 
b/grub-core/lib/libtasn1-patches/0013-asn1_test-exclude-a-testcase-when-long-and-int-are-t.patch
new file mode 100644
index 000000000..e3fde7639
--- /dev/null
+++ 
b/grub-core/lib/libtasn1-patches/0013-asn1_test-exclude-a-testcase-when-long-and-int-are-t.patch
@@ -0,0 +1,47 @@
+From 737bef13796f6dbeb4178d42bdb1f3e496971d52 Mon Sep 17 00:00:00 2001
+From: Gary Lin <glin@suse.com>
+Date: Mon, 7 Oct 2024 11:33:19 +0800
+Subject: [PATCH 13/13] asn1_test: exclude a testcase when long and int are the
+ same
+
+There is a testcase to test the values larger than 'int' but smaller
+than 'long'. However, for some architectures, 'long' and 'int' are the
+same, and the compiler may issue a warning like this:
+
+grub-core/tests/asn1/tests/Test_overflow.c:48:50: error: left shift of 
negative value [-Werror=shift-negative-value]
+       unsigned long num = ((long) GRUB_UINT_MAX) << 2;
+                                                  ^~
+
+To avoid the unnecessary error, the testcase is opted out when
+GRUB_LONG_MAX is not larger than GRUB_INT_MAX.
+
+Signed-off-by: Daniel Axtens <dja@axtens.net>
+Signed-off-by: Gary Lin <glin@suse.com>
+---
+ grub-core/tests/asn1/tests/Test_overflow.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/grub-core/tests/asn1/tests/Test_overflow.c 
b/grub-core/tests/asn1/tests/Test_overflow.c
+index 65843abf6..fdeff5634 100644
+--- a/grub-core/tests/asn1/tests/Test_overflow.c
++++ b/grub-core/tests/asn1/tests/Test_overflow.c
+@@ -43,7 +43,7 @@ test_overflow (void)
+ 
+   /* Test that values larger than int but smaller than long are
+      rejected.  This limitation was introduced with libtasn1 2.12. */
+-  if (GRUB_LONG_MAX > GRUB_INT_MAX)
++#if (GRUB_LONG_MAX > GRUB_INT_MAX)
+     {
+       unsigned long num = ((long) GRUB_UINT_MAX) << 2;
+       unsigned char der[20];
+@@ -61,6 +61,7 @@ test_overflow (void)
+         return 1;
+       }
+     }
++#endif
+ 
+   /* Test that values larger than would fit in the input string are
+      rejected.  This problem was fixed in libtasn1 2.12. */
+-- 
+2.43.0
+
-- 
2.43.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]