From patchwork Tue May 10 01:37:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rashmica Gupta X-Patchwork-Id: 620405 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3r3hkz3cjdz9t73 for ; Tue, 10 May 2016 11:39:55 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=mMVPxJIG; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3r3hkz2Y73zDqPm for ; Tue, 10 May 2016 11:39:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=mMVPxJIG; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pa0-x242.google.com (mail-pa0-x242.google.com [IPv6:2607:f8b0:400e:c03::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3r3hjR4kcxzDq68 for ; Tue, 10 May 2016 11:38:35 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=mMVPxJIG; dkim-atps=neutral Received: by mail-pa0-x242.google.com with SMTP id yl2so16767877pac.1 for ; Mon, 09 May 2016 18:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=dAZPbKDYqrZR7WGiG+iFIc0ckXP+23UB3Wai/ARLODg=; b=mMVPxJIGbOy3qQxbFqGkovrGb17tkNTdL2vTOFPlOTSf6OFVBCxJgKC08r6K4Yhl72 UaMy+UPUcAwwBRAQ7BjXLU2bfiL92HS1HXI17sEZbXp53PpruMQrncM4u1vHtiBosw8J m6xE9a4YVICqp9jnHzRpwmzhwnco9iAgRqyHJ8mJNegjiRvh7tKKF/yASrWuxO2/7DOx iBxf/PZO7jNClAKQ2oid5SZz7MM0AthHCnDTMsB430wPrnf416iogUfMKLsRMaIcU1XV yEPlerNFEo+US1dOForEYR24fjLxOyCp7IWlY8SK+c8346mej0DH7sopB8NO/SYd8WRE 9T6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=dAZPbKDYqrZR7WGiG+iFIc0ckXP+23UB3Wai/ARLODg=; b=MlJM+67Mo+zH/gVD1qCLUtf6qH2uyYYAStBtKRihIZYs1AkdEQ5ANvkOyogWIbjbT5 LFriDC3WM26JCtwyieGUj9WhDQPw85gurDb1mNkCdMz1ejn9k6dsHCTTgvA/Gcpp/msM ytQZBoMNCbAudMI8+zwvY7fGMpT6t4ThFd/s25hiZFB/NkeAUeoYXTGprxqc5pgWOeUO qhJDtAajhzAMKO6d4cGF5v7DQZeCYZY4m5BSOi042i9JQfhcUMZh4VkTki+srOhj6fJO /GhlEDTPI+rjM3gd6v4qIKeYBH4ek0nYm2VwfjfrS6+oEzhMfnVJEWLeG9tKpYRucmMf LN0w== X-Gm-Message-State: AOPr4FVRh/k9FqO4kcM5LIV49lN2URrIifIYbWACzTg4SCUDc3+4coh0fzhdK2cpFpTCvw== X-Received: by 10.66.164.68 with SMTP id yo4mr28272485pab.157.1462844313366; Mon, 09 May 2016 18:38:33 -0700 (PDT) Received: from circle.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id vg9sm43471733pab.35.2016.05.09.18.38.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 May 2016 18:38:32 -0700 (PDT) From: Rashmica Gupta To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH V2] lib/test-hexdump: Changed to work on BE Date: Tue, 10 May 2016 11:37:54 +1000 Message-Id: <1462844274-27887-1-git-send-email-rashmicy@gmail.com> X-Mailer: git-send-email 2.5.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 --- V2: Checking __BYTE_ORDER__. 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..9de91a1b98bf 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 = { +#if __BYTE_ORDER__ == __ORDER_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 __BYTE_ORDER__ == __ORDER_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;