* [PATCH] lib/test-hexdump: Changed to work on BE
@ 2016-04-12 5:33 Rashmica Gupta
2016-04-12 9:39 ` kbuild test robot
0 siblings, 1 reply; 3+ messages in thread
From: Rashmica Gupta @ 2016-04-12 5:33 UTC (permalink / raw)
To: linuxppc-dev, mpe
test-hexdump.c doesn't work on BE because the test data is in LE format.
So add in data for BE.
Signed-off-by: Rashmica Gupta <rashmicy@gmail.com>
---
lib/test_hexdump.c | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/lib/test_hexdump.c b/lib/test_hexdump.c
index 3f415d8101f3..cfd86d59e0d0 100644
--- a/lib/test_hexdump.c
+++ b/lib/test_hexdump.c
@@ -18,29 +18,48 @@ static const unsigned char data_b[] = {
static const unsigned char data_a[] = ".2.{....p..$}.4...1.....L...C...";
-static const char * const test_data_1_le[] __initconst = {
+static const char * const test_data_1[] __initconst = {
"be", "32", "db", "7b", "0a", "18", "93", "b2",
"70", "ba", "c4", "24", "7d", "83", "34", "9b",
"a6", "9c", "31", "ad", "9c", "0f", "ac", "e9",
"4c", "d1", "19", "99", "43", "b1", "af", "0c",
};
-static const char * const test_data_2_le[] __initconst = {
+#ifdef __LITTLE_ENDIAN
+static const char * const test_data_2[] __initconst = {
"32be", "7bdb", "180a", "b293",
"ba70", "24c4", "837d", "9b34",
"9ca6", "ad31", "0f9c", "e9ac",
"d14c", "9919", "b143", "0caf",
};
-static const char * const test_data_4_le[] __initconst = {
+static const char * const test_data_4[] __initconst = {
"7bdb32be", "b293180a", "24c4ba70", "9b34837d",
"ad319ca6", "e9ac0f9c", "9919d14c", "0cafb143",
};
-static const char * const test_data_8_le[] __initconst = {
+static const char * const test_data_8[] __initconst = {
"b293180a7bdb32be", "9b34837d24c4ba70",
"e9ac0f9cad319ca6", "0cafb1439919d14c",
};
+#elif __BIG_ENDIAN
+static const char * const test_data_2[] __initconst = {
+ "be32", "db7b", "0a18", "93b2",
+ "70ba", "c424", "7d83", "349b",
+ "a69c", "31ad", "9c0f", "ace9",
+ "4cd1", "1999", "43b1", "af0c",
+};
+
+static const char * const test_data_4[] __initconst = {
+ "be32db7b", "0a1893b2", "70bac424", "7d83349b",
+ "a69c31ad", "9c0face9", "4cd11999", "43b1af0c",
+};
+
+static const char * const test_data_8[] __initconst = {
+ "be32db7b0a1893b2", "70bac4247d83349b",
+ "a69c31ad9c0face9", "4cd1199943b1af0c",
+};
+#endif
#define FILL_CHAR '#'
@@ -67,13 +86,13 @@ static void __init test_hexdump_prepare_test(size_t len, int rowsize,
gs = 1;
if (gs == 8)
- result = test_data_8_le;
+ result = test_data_8;
else if (gs == 4)
- result = test_data_4_le;
+ result = test_data_4;
else if (gs == 2)
- result = test_data_2_le;
+ result = test_data_2;
else
- result = test_data_1_le;
+ result = test_data_1;
/* hex dump */
p = test;
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/test-hexdump: Changed to work on BE
2016-04-12 5:33 [PATCH] lib/test-hexdump: Changed to work on BE Rashmica Gupta
@ 2016-04-12 9:39 ` kbuild test robot
2016-04-12 13:19 ` Michael Ellerman
0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2016-04-12 9:39 UTC (permalink / raw)
To: Rashmica Gupta; +Cc: kbuild-all, linuxppc-dev, mpe
[-- Attachment #1: Type: text/plain, Size: 3745 bytes --]
Hi Rashmica,
[auto build test WARNING on v4.6-rc3]
[also build test WARNING on next-20160412]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Rashmica-Gupta/lib-test-hexdump-Changed-to-work-on-BE/20160412-133656
config: mn10300-allmodconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mn10300
All warnings (new ones prefixed by >>):
>> lib/test_hexdump.c:45:7: warning: "__BIG_ENDIAN" is not defined [-Wundef]
#elif __BIG_ENDIAN
^
lib/test_hexdump.c: In function 'test_hexdump':
lib/test_hexdump.c:143:3: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'unsigned int' [-Wformat=]
pr_err("Len: %zu row: %d group: %d\n", len, rowsize, groupsize);
^
lib/test_hexdump.c: In function 'test_hexdump_overflow':
lib/test_hexdump.c:201:3: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'unsigned int' [-Wformat=]
pr_err("Len: %zu buflen: %zu strlen: %zu\n",
^
lib/test_hexdump.c:201:3: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat=]
lib/test_hexdump.c:201:3: warning: format '%zu' expects argument of type 'size_t', but argument 4 has type '__kernel_size_t' [-Wformat=]
--
>> /kbuild/src/defs/lib/test_hexdump.c:45:7: warning: "__BIG_ENDIAN" is not defined [-Wundef]
#elif __BIG_ENDIAN
^
/kbuild/src/defs/lib/test_hexdump.c: In function 'test_hexdump':
/kbuild/src/defs/lib/test_hexdump.c:143:3: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'unsigned int' [-Wformat=]
pr_err("Len: %zu row: %d group: %d\n", len, rowsize, groupsize);
^
/kbuild/src/defs/lib/test_hexdump.c: In function 'test_hexdump_overflow':
/kbuild/src/defs/lib/test_hexdump.c:201:3: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'unsigned int' [-Wformat=]
pr_err("Len: %zu buflen: %zu strlen: %zu\n",
^
/kbuild/src/defs/lib/test_hexdump.c:201:3: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'unsigned int' [-Wformat=]
/kbuild/src/defs/lib/test_hexdump.c:201:3: warning: format '%zu' expects argument of type 'size_t', but argument 4 has type '__kernel_size_t' [-Wformat=]
vim +/__BIG_ENDIAN +45 lib/test_hexdump.c
29 static const char * const test_data_2[] __initconst = {
30 "32be", "7bdb", "180a", "b293",
31 "ba70", "24c4", "837d", "9b34",
32 "9ca6", "ad31", "0f9c", "e9ac",
33 "d14c", "9919", "b143", "0caf",
34 };
35
36 static const char * const test_data_4[] __initconst = {
37 "7bdb32be", "b293180a", "24c4ba70", "9b34837d",
38 "ad319ca6", "e9ac0f9c", "9919d14c", "0cafb143",
39 };
40
41 static const char * const test_data_8[] __initconst = {
42 "b293180a7bdb32be", "9b34837d24c4ba70",
43 "e9ac0f9cad319ca6", "0cafb1439919d14c",
44 };
> 45 #elif __BIG_ENDIAN
46 static const char * const test_data_2[] __initconst = {
47 "be32", "db7b", "0a18", "93b2",
48 "70ba", "c424", "7d83", "349b",
49 "a69c", "31ad", "9c0f", "ace9",
50 "4cd1", "1999", "43b1", "af0c",
51 };
52
53 static const char * const test_data_4[] __initconst = {
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 38147 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/test-hexdump: Changed to work on BE
2016-04-12 9:39 ` kbuild test robot
@ 2016-04-12 13:19 ` Michael Ellerman
0 siblings, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2016-04-12 13:19 UTC (permalink / raw)
To: kbuild test robot, Rashmica Gupta; +Cc: kbuild-all, linuxppc-dev
On Tue, 2016-04-12 at 17:39 +0800, kbuild test robot wrote:
> Hi Rashmica,
>
> [auto build test WARNING on v4.6-rc3]
> [also build test WARNING on next-20160412]
> [if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
>
> url: https://github.com/0day-ci/linux/commits/Rashmica-Gupta/lib-test-hexdump-Changed-to-work-on-BE/20160412-133656
> config: mn10300-allmodconfig (attached as .config)
> reproduce:
> wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=mn10300
>
> All warnings (new ones prefixed by >>):
> > > /kbuild/src/defs/lib/test_hexdump.c:45:7: warning: "__BIG_ENDIAN" is not defined [-Wundef]
> #elif __BIG_ENDIAN
I think you want:
#elif __BYTE_ORDER == __BIG_ENDIAN
?
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-12 13:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-12 5:33 [PATCH] lib/test-hexdump: Changed to work on BE Rashmica Gupta
2016-04-12 9:39 ` kbuild test robot
2016-04-12 13:19 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.