From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0082.outbound.protection.outlook.com [104.47.38.82]) by dpdk.org (Postfix) with ESMTP id A7F341BC26 for ; Mon, 14 May 2018 10:29:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=D8vEP5L+0sGx+bXxqt2sIb2mbjajmBChED0VkOzLKjQ=; b=msnQGHjDe8uezaINo9G357xJdWaZNFebPDOfP45DkQW1K1CJpS+uzfE0N0ujt0s2C79zDAw/CVzwkBZg0JKtT0a1fzKFmo1861Sgmls+ZSX3mHg9oTfDi+MFgivzhCBR9pP8omxhnkdHk/Ittm3b9w8JAn8fXX521hj9Hynyh8U= Received: from CY4PR0701MB3634.namprd07.prod.outlook.com (52.132.101.164) by CY4PR0701MB3636.namprd07.prod.outlook.com (52.132.102.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Mon, 14 May 2018 08:29:04 +0000 Received: from CY4PR0701MB3634.namprd07.prod.outlook.com ([fe80::b0a9:2be9:bfdf:fc0a]) by CY4PR0701MB3634.namprd07.prod.outlook.com ([fe80::b0a9:2be9:bfdf:fc0a%13]) with mapi id 15.20.0755.018; Mon, 14 May 2018 08:29:04 +0000 From: "Verma, Shally" To: Pablo de Lara , "dev@dpdk.org" CC: "fiona.trahe@intel.com" , "lee.daly@intel.com" , "ahmed.mansour@nxp.com" , "Gupta, Ashish" , "Gupta, Ashish" Thread-Topic: [PATCH v4 1/5] test/compress: add initial unit tests Thread-Index: AQHT45HdPUpv+8TGKUSoBKWkAhEwBKQu7MOQ Date: Mon, 14 May 2018 08:29:03 +0000 Message-ID: References: <20180228140010.27251-1-pablo.de.lara.guarch@intel.com> <20180504102218.30672-1-pablo.de.lara.guarch@intel.com> <20180504102218.30672-2-pablo.de.lara.guarch@intel.com> In-Reply-To: <20180504102218.30672-2-pablo.de.lara.guarch@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; x-originating-ip: [115.113.156.2] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR0701MB3636; 7:iRv7K/u7D5aPuAVd11FX2alIQv2E2S5Um/Nh2/0Du6zW0wLtCfTbt1N0W4wiJt+JmwdFEA58l1nNXGAB+zv5HgsiKBSQlRADhnZrytfBpLJhus1SisaU9Goa/83bdrDXtza8O3tZ3yHMJIXjviypvSs+qsyz7e6Gyu9ZUT8pATkQvrIwb40zZemSIzI6D8E0cjt1swdRG0lspHfLNuIqOrRSOchnVDuHUvIix5Plze99CxVW4yaD4uxNmHViRk/C x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(39850400004)(396003)(39380400002)(346002)(366004)(376002)(54094003)(13464003)(189003)(199004)(72206003)(8676002)(76176011)(6246003)(5890100001)(53946003)(105586002)(9686003)(14454004)(7736002)(107886003)(110136005)(54906003)(26005)(81156014)(55016002)(102836004)(86362001)(8936002)(186003)(478600001)(305945005)(316002)(106356001)(7696005)(59450400001)(2501003)(55236004)(5250100002)(6506007)(81166006)(229853002)(6116002)(3846002)(97736004)(8656006)(53936002)(3280700002)(3660700001)(33656002)(5660300001)(4326008)(66066001)(2900100001)(99286004)(74316002)(476003)(2906002)(446003)(25786009)(486006)(6436002)(68736007)(11346002)(554534003)(579004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR0701MB3636; H:CY4PR0701MB3634.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:CY4PR0701MB3636; x-ms-traffictypediagnostic: CY4PR0701MB3636: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197)(176510541525296)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:CY4PR0701MB3636; BCL:0; PCL:0; RULEID:; SRVR:CY4PR0701MB3636; x-forefront-prvs: 067270ECAF received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 0JdhrUUHAWEuI4uDGlq1Vw8zszE9HyKklIM+2xM8F0LpdXwqbgFufJ6sHbRBu6lUUAleiwDyVGTvVDgTiwEcQtdeUop9DEQW8KlI7NQ5wl000AOAsgX7IGVL+FdoofsG4hmk7c3usbQaSAA/t6byPczKty9VXDCWMoOMJ44SL7WS+FI/Q8tpgnnAOsb2txQO spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: dc8bd877-6cd0-444c-95d3-08d5b974c08d X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc8bd877-6cd0-444c-95d3-08d5b974c08d X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2018 08:29:03.9861 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR0701MB3636 Subject: Re: [dpdk-dev] [PATCH v4 1/5] test/compress: add initial unit tests X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 May 2018 08:29:07 -0000 >-----Original Message----- >From: Pablo de Lara [mailto:pablo.de.lara.guarch@intel.com] >Sent: 04 May 2018 15:52 >To: dev@dpdk.org >Cc: fiona.trahe@intel.com; lee.daly@intel.com; Verma, Shally ; ahmed.mansour@nxp.com; Gupta, >Ashish ; Pablo de Lara ; Gupta, Ashish ; >Verma, Shally >Subject: [PATCH v4 1/5] test/compress: add initial unit tests > >This commit introduces the initial tests for compressdev, >performing basic compression and decompression operations >of sample test buffers, using the Zlib library in one direction >and compressdev in another direction, to make sure that >the library is compatible with Zlib. > >Due to the use of Zlib API, the test is disabled by default, >to avoid adding a new dependency on DPDK. > >Signed-off-by: Pablo de Lara >Signed-off-by: Ashish Gupta >Signed-off-by: Shally Verma >Acked-by: Lee Daly >--- > config/common_base | 5 + > test/test/Makefile | 9 + > test/test/meson.build | 8 + > test/test/test_compressdev.c | 725 +++++++++++++++++++++++ > test/test/test_compressdev_test_buffer.h | 295 +++++++++ > 5 files changed, 1042 insertions(+) > create mode 100644 test/test/test_compressdev.c > create mode 100644 test/test/test_compressdev_test_buffer.h > //snip >+ * Compresses and decompresses buffer with compressdev API and Zlib API >+ */ >+static int >+test_deflate_comp_decomp(const char *test_buffer, >+ struct rte_comp_xform *compress_xform, >+ struct rte_comp_xform *decompress_xform, >+ enum rte_comp_op_type state, >+ enum zlib_direction zlib_dir) >+{ >+ struct comp_testsuite_params *ts_params =3D &testsuite_params; >+ int ret_status =3D -1; >+ int ret; >+ struct rte_mbuf *comp_buf =3D NULL; >+ struct rte_mbuf *uncomp_buf =3D NULL; >+ struct rte_comp_op *op =3D NULL; >+ struct rte_comp_op *op_processed =3D NULL; >+ void *priv_xform =3D NULL; >+ uint16_t num_deqd; >+ unsigned int deqd_retries =3D 0; >+ char *data_ptr; >+ >+ /* Prepare the source mbuf with the data */ >+ uncomp_buf =3D rte_pktmbuf_alloc(ts_params->mbuf_pool); >+ if (uncomp_buf =3D=3D NULL) { >+ RTE_LOG(ERR, USER1, >+ "Source mbuf could not be allocated " >+ "from the mempool\n"); >+ goto exit; >+ } >+ >+ data_ptr =3D rte_pktmbuf_append(uncomp_buf, strlen(test_buffer) + 1); >+ snprintf(data_ptr, strlen(test_buffer) + 1, "%s", test_buffer); >+ >+ /* Prepare the destination mbuf */ >+ comp_buf =3D rte_pktmbuf_alloc(ts_params->mbuf_pool); >+ if (comp_buf =3D=3D NULL) { >+ RTE_LOG(ERR, USER1, >+ "Destination mbuf could not be allocated " >+ "from the mempool\n"); >+ goto exit; >+ } >+ >+ rte_pktmbuf_append(comp_buf, >+ strlen(test_buffer) * COMPRESS_BUF_SIZE_RATIO); >+ >+ /* Build the compression operations */ >+ op =3D rte_comp_op_alloc(ts_params->op_pool); >+ if (op =3D=3D NULL) { >+ RTE_LOG(ERR, USER1, >+ "Compress operation could not be allocated " >+ "from the mempool\n"); >+ goto exit; >+ } >+ >+ op->m_src =3D uncomp_buf; >+ op->m_dst =3D comp_buf; >+ op->src.offset =3D 0; >+ op->src.length =3D rte_pktmbuf_pkt_len(uncomp_buf); >+ op->dst.offset =3D 0; >+ if (state =3D=3D RTE_COMP_OP_STATELESS) { >+ //TODO: FULL or FINAL? >+ op->flush_flag =3D RTE_COMP_FLUSH_FINAL; >+ } else { >+ RTE_LOG(ERR, USER1, >+ "Stateful operations are not supported " >+ "in these tests yet\n"); >+ goto exit; >+ } >+ op->input_chksum =3D 0; >+ >+ /* Compress data (either with Zlib API or compressdev API */ >+ if (zlib_dir =3D=3D ZLIB_COMPRESS || zlib_dir =3D=3D ZLIB_ALL) { >+ ret =3D compress_zlib(op, >+ (const struct rte_comp_xform *)&compress_xform, [Shally] why are we passing ** here, compress_zlib() input rte_comp_xform*,= this will cause a bug here. So, in call to decompress_zlib() below. Thanks Shally >+ DEFAULT_MEM_LEVEL); >+ if (ret < 0) >+ goto exit; >+ >+ op_processed =3D op; >+ } else { >+ /* Create compress xform private data */ >+ ret =3D rte_compressdev_private_xform_create(0, >+ (const struct rte_comp_xform *)compress_xform, >+ &priv_xform); >+ if (ret < 0) { >+ RTE_LOG(ERR, USER1, >+ "Compression private xform " >+ "could not be created\n"); >+ goto exit; >+ } >+ >+ /* Attach xform private data to operation */ >+ op->private_xform =3D priv_xform; >+ >+ /* Enqueue and dequeue all operations */ >+ ret =3D rte_compressdev_enqueue_burst(0, 0, &op, 1); >+ if (ret =3D=3D 0) { >+ RTE_LOG(ERR, USER1, >+ "The operation could not be enqueued\n"); >+ goto exit; >+ } >+ do { >+ /* >+ * If retrying a dequeue call, wait for 10 ms to allow >+ * enough time to the driver to process the operations >+ */ >+ if (deqd_retries !=3D 0) { >+ /* >+ * Avoid infinite loop if not all the >+ * operations get out of the device >+ */ >+ if (deqd_retries =3D=3D MAX_DEQD_RETRIES) { >+ RTE_LOG(ERR, USER1, >+ "Not all operations could be " >+ "dequeued\n"); >+ goto exit; >+ } >+ usleep(DEQUEUE_WAIT_TIME); >+ } >+ num_deqd =3D rte_compressdev_dequeue_burst(0, 0, >+ &op_processed, 1); >+ >+ deqd_retries++; >+ } while (num_deqd < 1); >+ >+ deqd_retries =3D 0; >+ >+ /* Free compress private xform */ >+ rte_compressdev_private_xform_free(0, priv_xform); >+ priv_xform =3D NULL; >+ } >+ >+ enum rte_comp_huffman huffman_type =3D >+ compress_xform->compress.deflate.huffman; >+ RTE_LOG(DEBUG, USER1, "Buffer compressed from %u to %u bytes " >+ "(level =3D %u, huffman =3D %s)\n", >+ op_processed->consumed, op_processed->produced, >+ compress_xform->compress.level, >+ huffman_type_strings[huffman_type]); >+ RTE_LOG(DEBUG, USER1, "Compression ratio =3D %.2f", >+ (float)op_processed->produced / >+ op_processed->consumed * 100); >+ op =3D NULL; >+ >+ /* >+ * Check operation status and free source mbuf (destination mbuf and >+ * compress operation information is needed for the decompression stage) >+ */ >+ if (op_processed->status !=3D RTE_COMP_OP_STATUS_SUCCESS) { >+ RTE_LOG(ERR, USER1, >+ "Some operations were not successful\n"); >+ goto exit; >+ } >+ rte_pktmbuf_free(uncomp_buf); >+ uncomp_buf =3D NULL; >+ >+ /* Allocate buffer for decompressed data */ >+ uncomp_buf =3D rte_pktmbuf_alloc(ts_params->mbuf_pool); >+ if (uncomp_buf =3D=3D NULL) { >+ RTE_LOG(ERR, USER1, >+ "Destination mbuf could not be allocated " >+ "from the mempool\n"); >+ goto exit; >+ } >+ >+ rte_pktmbuf_append(uncomp_buf, strlen(test_buffer) + 1); >+ >+ /* Build the decompression operations */ >+ op =3D rte_comp_op_alloc(ts_params->op_pool); >+ if (op =3D=3D NULL) { >+ RTE_LOG(ERR, USER1, >+ "Decompress operation could not be allocated " >+ "from the mempool\n"); >+ goto exit; >+ } >+ >+ /* Source buffer is the compressed data from the previous operation */ >+ op->m_src =3D op_processed->m_dst; >+ op->m_dst =3D uncomp_buf; >+ op->src.offset =3D 0; >+ /* >+ * Set the length of the compressed data to the >+ * number of bytes that were produced in the previous stage >+ */ >+ op->src.length =3D op_processed->produced; >+ op->dst.offset =3D 0; >+ if (state =3D=3D RTE_COMP_OP_STATELESS) { >+ //TODO: FULL or FINAL? >+ op->flush_flag =3D RTE_COMP_FLUSH_FINAL; >+ } else { >+ RTE_LOG(ERR, USER1, >+ "Stateful operations are not supported " >+ "in these tests yet\n"); >+ goto exit; >+ } >+ op->input_chksum =3D 0; >+ >+ /* >+ * Free the previous compress operation, >+ * as it is not needed anymore >+ */ >+ rte_comp_op_free(op_processed); >+ op_processed =3D NULL; >+ >+ /* Decompress data (either with Zlib API or compressdev API */ >+ if (zlib_dir =3D=3D ZLIB_DECOMPRESS || zlib_dir =3D=3D ZLIB_ALL) { >+ ret =3D decompress_zlib(op, >+ (const struct rte_comp_xform *)&decompress_xform); >+ if (ret < 0) >+ goto exit; >+ >+ op_processed =3D op; >+ } else { >+ num_deqd =3D 0; >+ /* Create decompress xform private data */ >+ ret =3D rte_compressdev_private_xform_create(0, >+ (const struct rte_comp_xform *)decompress_xform, >+ &priv_xform); >+ if (ret < 0) { >+ RTE_LOG(ERR, USER1, >+ "Decompression private xform " >+ "could not be created\n"); >+ goto exit; >+ } >+ >+ /* Attach xform private data to operation */ >+ op->private_xform =3D priv_xform; >+ >+ /* Enqueue and dequeue all operations */ >+ ret =3D rte_compressdev_enqueue_burst(0, 0, &op, 1); >+ if (ret =3D=3D 0) { >+ RTE_LOG(ERR, USER1, >+ "The operation could not be enqueued\n"); >+ goto exit; >+ } >+ do { >+ /* >+ * If retrying a dequeue call, wait for 10 ms to allow >+ * enough time to the driver to process the operations >+ */ >+ if (deqd_retries !=3D 0) { >+ /* >+ * Avoid infinite loop if not all the >+ * operations get out of the device >+ */ >+ if (deqd_retries =3D=3D MAX_DEQD_RETRIES) { >+ RTE_LOG(ERR, USER1, >+ "Not all operations could be " >+ "dequeued\n"); >+ goto exit; >+ } >+ usleep(DEQUEUE_WAIT_TIME); >+ } >+ num_deqd =3D rte_compressdev_dequeue_burst(0, 0, >+ &op_processed, 1); >+ >+ deqd_retries++; >+ } while (num_deqd < 1); >+ } >+ >+ RTE_LOG(DEBUG, USER1, "Buffer decompressed from %u to %u bytes\n", >+ op_processed->consumed, op_processed->produced); >+ op =3D NULL; >+ /* >+ * Check operation status and free source mbuf (destination mbuf and >+ * compress operation information is still needed) >+ */ >+ if (op_processed->status !=3D RTE_COMP_OP_STATUS_SUCCESS) { >+ RTE_LOG(ERR, USER1, >+ "Some operations were not successful\n"); >+ goto exit; >+ } >+ rte_pktmbuf_free(comp_buf); >+ comp_buf =3D NULL; >+ >+ /* >+ * Compare the original stream with the decompressed stream >+ * (in size and the data) >+ */ >+ if (compare_buffers(test_buffer, strlen(test_buffer) + 1, >+ rte_pktmbuf_mtod(op_processed->m_dst, const char *), >+ op_processed->produced) < 0) >+ goto exit; >+ >+ ret_status =3D 0; >+ >+exit: >+ /* Free resources */ >+ rte_pktmbuf_free(uncomp_buf); >+ rte_pktmbuf_free(comp_buf); >+ rte_comp_op_free(op); >+ rte_comp_op_free(op_processed); >+ >+ if (priv_xform !=3D NULL) >+ rte_compressdev_private_xform_free(0, priv_xform); >+ >+ return ret_status; >+} >+ >+static int >+test_compressdev_deflate_stateless_fixed(void) >+{ >+ struct comp_testsuite_params *ts_params =3D &testsuite_params; >+ const char *test_buffer; >+ uint16_t i; >+ struct rte_comp_xform compress_xform; >+ >+ memcpy(&compress_xform, &ts_params->def_comp_xform, >+ sizeof(struct rte_comp_xform)); >+ compress_xform.compress.deflate.huffman =3D RTE_COMP_HUFFMAN_FIXED; >+ >+ for (i =3D 0; i < RTE_DIM(compress_test_bufs); i++) { >+ test_buffer =3D compress_test_bufs[i]; >+ >+ /* Compress with compressdev, decompress with Zlib */ >+ if (test_deflate_comp_decomp(test_buffer, >+ &compress_xform, >+ &ts_params->def_decomp_xform, >+ RTE_COMP_OP_STATELESS, >+ ZLIB_DECOMPRESS) < 0) >+ return TEST_FAILED; >+ >+ /* Compress with Zlib, decompress with compressdev */ >+ if (test_deflate_comp_decomp(test_buffer, >+ &compress_xform, >+ &ts_params->def_decomp_xform, >+ RTE_COMP_OP_STATELESS, >+ ZLIB_COMPRESS) < 0) >+ return TEST_FAILED; >+ } >+ >+ return TEST_SUCCESS; >+} >+ >+static int >+test_compressdev_deflate_stateless_dynamic(void) >+{ >+ struct comp_testsuite_params *ts_params =3D &testsuite_params; >+ const char *test_buffer; >+ uint16_t i; >+ struct rte_comp_xform compress_xform; >+ >+ memcpy(&compress_xform, &ts_params->def_comp_xform, >+ sizeof(struct rte_comp_xform)); >+ compress_xform.compress.deflate.huffman =3D RTE_COMP_HUFFMAN_DYNAMIC; >+ >+ for (i =3D 0; i < RTE_DIM(compress_test_bufs); i++) { >+ test_buffer =3D compress_test_bufs[i]; >+ >+ /* Compress with compressdev, decompress with Zlib */ >+ if (test_deflate_comp_decomp(test_buffer, >+ &compress_xform, >+ &ts_params->def_decomp_xform, >+ RTE_COMP_OP_STATELESS, >+ ZLIB_DECOMPRESS) < 0) >+ return TEST_FAILED; >+ >+ /* Compress with Zlib, decompress with compressdev */ >+ if (test_deflate_comp_decomp(test_buffer, >+ &compress_xform, >+ &ts_params->def_decomp_xform, >+ RTE_COMP_OP_STATELESS, >+ ZLIB_COMPRESS) < 0) >+ return TEST_FAILED; >+ } >+ >+ return TEST_SUCCESS; >+} >+ >+static struct unit_test_suite compressdev_testsuite =3D { >+ .suite_name =3D "compressdev unit test suite", >+ .setup =3D testsuite_setup, >+ .teardown =3D testsuite_teardown, >+ .unit_test_cases =3D { >+ TEST_CASE_ST(generic_ut_setup, generic_ut_teardown, >+ test_compressdev_deflate_stateless_fixed), >+ TEST_CASE_ST(generic_ut_setup, generic_ut_teardown, >+ test_compressdev_deflate_stateless_dynamic), >+ TEST_CASES_END() /**< NULL terminate unit test array */ >+ } >+}; >+ >+static int >+test_compressdev(void) >+{ >+ return unit_test_suite_runner(&compressdev_testsuite); >+} >+ >+REGISTER_TEST_COMMAND(compressdev_autotest, test_compressdev); >diff --git a/test/test/test_compressdev_test_buffer.h b/test/test/test_com= pressdev_test_buffer.h >new file mode 100644 >index 000000000..c0492f89a >--- /dev/null >+++ b/test/test/test_compressdev_test_buffer.h >@@ -0,0 +1,295 @@ >+#ifndef TEST_COMPRESSDEV_TEST_BUFFERS_H_ >+#define TEST_COMPRESSDEV_TEST_BUFFERS_H_ >+ >+/* >+ * These test buffers are snippets obtained >+ * from the Canterbury and Calgary Corpus >+ * collection. >+ */ >+ >+/* Snippet of Alice's Adventures in Wonderland */ >+static const char test_buf_alice[] =3D >+ " Alice was beginning to get very tired of sitting by her sister\n" >+ "on the bank, and of having nothing to do: once or twice she had\n" >+ "peeped into the book her sister was reading, but it had no\n" >+ "pictures or conversations in it, `and what is the use of a book,'\n" >+ "thought Alice `without pictures or conversation?'\n\n" >+ " So she was considering in her own mind (as well as she could,\n" >+ "for the hot day made her feel very sleepy and stupid), whether\n" >+ "the pleasure of making a daisy-chain would be worth the trouble\n" >+ "of getting up and picking the daisies, when suddenly a White\n" >+ "Rabbit with pink eyes ran close by her.\n\n" >+ " There was nothing so VERY remarkable in that; nor did Alice\n" >+ "think it so VERY much out of the way to hear the Rabbit say to\n" >+ "itself, `Oh dear! Oh dear! I shall be late!' (when she thought\n" >+ "it over afterwards, it occurred to her that she ought to have\n" >+ "wondered at this, but at the time it all seemed quite natural);\n" >+ "but when the Rabbit actually TOOK A WATCH OUT OF ITS WAISTCOAT-\n" >+ "POCKET, and looked at it, and then hurried on, Alice started to\n" >+ "her feet, for it flashed across her mind that she had never\n" >+ "before seen a rabbit with either a waistcoat-pocket, or a watch to\n" >+ "take out of it, and burning with curiosity, she ran across the\n" >+ "field after it, and fortunately was just in time to see it pop\n" >+ "down a large rabbit-hole under the hedge.\n\n" >+ " In another moment down went Alice after it, never once\n" >+ "considering how in the world she was to get out again.\n\n" >+ " The rabbit-hole went straight on like a tunnel for some way,\n" >+ "and then dipped suddenly down, so suddenly that Alice had not a\n" >+ "moment to think about stopping herself before she found herself\n" >+ "falling down a very deep well.\n\n" >+ " Either the well was very deep, or she fell very slowly, for she\n" >+ "had plenty of time as she went down to look about her and to\n" >+ "wonder what was going to happen next. First, she tried to look\n" >+ "down and make out what she was coming to, but it was too dark to\n" >+ "see anything; then she looked at the sides of the well, and\n" >+ "noticed that they were filled with cupboards and book-shelves;\n" >+ "here and there she saw maps and pictures hung upon pegs. She\n" >+ "took down a jar from one of the shelves as she passed; it was\n" >+ "labelled `ORANGE MARMALADE', but to her great disappointment it\n" >+ "was empty: she did not like to drop the jar for fear of killing\n" >+ "somebody, so managed to put it into one of the cupboards as she\n" >+ "fell past it.\n\n" >+ " `Well!' thought Alice to herself, `after such a fall as this, I\n" >+ "shall think nothing of tumbling down stairs! How brave they'll\n" >+ "all think me at home! Why, I wouldn't say anything about it,\n" >+ "even if I fell off the top of the house!' (Which was very likely\n" >+ "true.)\n\n" >+ " Down, down, down. Would the fall NEVER come to an end! `I\n" >+ "wonder how many miles I've fallen by this time?' she said aloud.\n" >+ "`I must be getting somewhere near the centre of the earth. Let\n" >+ "me see: that would be four thousand miles down, I think--' (for,\n" >+ "you see, Alice had learnt several things of this sort in her\n" >+ "lessons in the schoolroom, and though this was not a VERY good\n" >+ "opportunity for showing off her knowledge, as there was no one to\n" >+ "listen to her, still it was good practice to say it over) `--yes,\n" >+ "that's about the right distance--but then I wonder what Latitude\n" >+ "or Longitude I've got to?' (Alice had no idea what Latitude was,\n" >+ "or Longitude either, but thought they were nice grand words to\n" >+ "say.)\n\n" >+ " Presently she began again. `I wonder if I shall fall right\n" >+ "THROUGH the earth! How funny it'll seem to come out among the\n" >+ "people that walk with their heads downward! The Antipathies, I\n" >+ "think--' (she was rather glad there WAS no one listening, this\n" >+ "time, as it didn't sound at all the right word) `--but I shall\n" >+ "have to ask them what the name of the country is, you know.\n" >+ "Please, Ma'am, is this New Zealand or Australia?' (and she tried\n" >+ "to curtsey as she spoke--fancy CURTSEYING as you're falling\n" >+ "through the air! Do you think you could manage it?) `And what\n" >+ "an ignorant little girl she'll think me for asking! No, it'll\n" >+ "never do to ask: perhaps I shall see it written up somewhere.'\n" >+ " Down, down, down. There was nothing else to do, so Alice soon\n" >+ "began talking again. `Dinah'll miss me very much to-night, I\n" >+ "should think!' (Dinah was the cat.) `I hope they'll remember\n" >+ "her saucer of milk at tea-time. Dinah my dear! I wish you were\n" >+ "down here with me! There are no mice in the air, I'm afraid, but\n" >+ "you might catch a bat, and that's very like a mouse, you know.\n" >+ "But do cats eat bats, I wonder?' And here Alice began to get\n" >+ "rather sleepy, and went on saying to herself, in a dreamy sort of\n" >+ "way, `Do cats eat bats? Do cats eat bats?' and sometimes, `Do\n" >+ "bats eat cats?' for, you see, as she couldn't answer either\n" >+ "question, it didn't much matter which way she put it. She felt\n" >+ "that she was dozing off, and had just begun to dream that she\n" >+ "was walking hand in hand with Dinah, and saying to her very\n" >+ "earnestly, `Now, Dinah, tell me the truth: did you ever eat a\n" >+ "bat?' when suddenly, thump! thump! down she came upon a heap of\n" >+ "sticks and dry leaves, and the fall was over.\n\n"; >+ >+/* Snippet of Shakespeare play */ >+static const char test_buf_shakespeare[] =3D >+ "CHARLES wrestler to Frederick.\n" >+ "\n" >+ "\n" >+ "OLIVER |\n" >+ " |\n" >+ "JAQUES (JAQUES DE BOYS:) | sons of Sir Rowland de Boys.\n" >+ " |\n" >+ "ORLANDO |\n" >+ "\n" >+ "\n" >+ "ADAM |\n" >+ " | servants to Oliver.\n" >+ "DENNIS |\n" >+ "\n" >+ "\n" >+ "TOUCHSTONE a clown.\n" >+ "\n" >+ "SIR OLIVER MARTEXT a vicar.\n" >+ "\n" >+ "\n" >+ "CORIN |\n" >+ " | shepherds.\n" >+ "SILVIUS |\n" >+ "\n" >+ "\n" >+ "WILLIAM a country fellow in love with Audrey.\n" >+ "\n" >+ " A person representing HYMEN. (HYMEN:)\n" >+ "\n" >+ "ROSALIND daughter to the banished duke.\n" >+ "\n" >+ "CELIA daughter to Frederick.\n" >+ "\n" >+ "PHEBE a shepherdess.\n" >+ "\n" >+ "AUDREY a country wench.\n" >+ "\n" >+ " Lords, pages, and attendants, &c.\n" >+ " (Forester:)\n" >+ " (A Lord:)\n" >+ " (First Lord:)\n" >+ " (Second Lord:)\n" >+ " (First Page:)\n" >+ " (Second Page:)\n" >+ "\n" >+ "\n" >+ "SCENE Oliver's house; Duke Frederick's court; and the\n" >+ " Forest of Arden.\n" >+ "\n" >+ "\n" >+ "\n" >+ "\n" >+ " AS YOU LIKE IT\n" >+ "\n" >+ "\n" >+ "ACT I\n" >+ "\n" >+ "\n" >+ "\n" >+ "SCENE I Orchard of Oliver's house.\n" >+ "\n" >+ "\n" >+ " [Enter ORLANDO and ADAM]\n" >+ "\n" >+ "ORLANDO As I remember, Adam, it was upon this fashion\n" >+ " bequeathed me by will but poor a thousand crowns,\n" >+ " and, as thou sayest, charged my brother, on his\n" >+ " blessing, to breed me well: and there begins my\n" >+ " sadness. My brother Jaques he keeps at school, and\n" >+ " report speaks goldenly of his profit: for my part,\n" >+ " he keeps me rustically at home, or, to speak more\n" >+ " properly, stays me here at home unkept; for call you\n" >+ " that keeping for a gentleman of my birth, that\n" >+ " differs not from the stalling of an ox? His horses\n" >+ " are bred better; for, besides that they are fair\n" >+ " with their feeding, they are taught their manage,\n" >+ " and to that end riders dearly hired: but I, his\n" >+ " brother, gain nothing under him but growth; for the\n" >+ " which his animals on his dunghills are as much\n" >+ " bound to him as I. Besides this nothing that he so\n" >+ " plentifully gives me, the something that nature gave\n" >+ " me his countenance seems to take from me: he lets\n" >+ " me feed with his hinds, bars me the place of a\n" >+ " brother, and, as much as in him lies, mines my\n" >+ " gentility with my education. This is it, Adam, that\n" >+ " grieves me; and the spirit of my father, which I\n" >+ " think is within me, begins to mutiny against this\n" >+ " servitude: I will no longer endure it, though yet I\n" >+ " know no wise remedy how to avoid it.\n" >+ "\n" >+ "ADAM Yonder comes my master, your brother.\n" >+ "\n" >+ "ORLANDO Go apart, Adam, and thou shalt hear how he will\n"; >+ >+/* Snippet of source code in Pascal */ >+static const char test_buf_pascal[] =3D >+ " Ptr =3D 1..DMem;\n" >+ " Loc =3D 1..IMem;\n" >+ " Loc0 =3D 0..IMem;\n" >+ " EdgeT =3D (hout,lin,hin,lout); {Warning this order is important in}\n= " >+ " {predicates such as gtS,geS}\n" >+ " CardT =3D (finite,infinite);\n" >+ " ExpT =3D Minexp..Maxexp;\n" >+ " ManT =3D Mininf..Maxinf; \n" >+ " Pflag =3D (PNull,PSoln,PTrace,PPrint);\n" >+ " Sreal =3D record\n" >+ " edge:EdgeT;\n" >+ " cardinality:CardT;\n" >+ " exp:ExpT; {exponent}\n" >+ " mantissa:ManT;\n" >+ " end;\n" >+ " Int =3D record\n" >+ " hi:Sreal;\n" >+ " lo:Sreal;\n" >+ " end;\n" >+ " Instr =3D record\n" >+ " Code:OpType;\n" >+ " Pars: array[0..Par] of 0..DMem;\n" >+ " end;\n" >+ " DataMem=3D record\n" >+ " D :array [Ptr] of Int;\n" >+ " S :array [Loc] of State;\n" >+ " LastHalve:Loc;\n" >+ " RHalve :array [Loc] of real;\n" >+ " end;\n" >+ " DataFlags=3Drecord\n" >+ " PF :array [Ptr] of Pflag;\n" >+ " end;\n" >+ "var\n" >+ " Debug : (none,activity,post,trace,dump);\n" >+ " Cut : (once,all);\n" >+ " GlobalEnd,Verifiable:boolean;\n" >+ " HalveThreshold:real;\n" >+ " I : array [Loc] of Instr; {Memory holding instructions}\n" >+ " End : Loc; {last instruction in I}\n" >+ " ParN : array [OpType] of -1..Par; {number of parameters for each \n" >+ " opcode. -1 means no result}\n" >+ " ParIntersect : array [OpType] of boolean ;\n" >+ " DInit : DataMem; {initial memory which is cleared and \n" >+ " used in first call}\n" >+ " DF : DataFlags; {hold flags for variables, e.g. print/trace}\n" >+ " MaxDMem:0..DMem;\n" >+ " Shift : array[0..Digits] of 1..maxint;{array of constant multipliers}= \n" >+ " {used for alignment etc.}\n" >+ " Dummy :Positive;\n" >+ " {constant intervals and Sreals}\n" >+ " PlusInfS,MinusInfS,PlusSmallS,MinusSmallS,ZeroS,\n" >+ " PlusFiniteS,MinusFiniteS:Sreal;\n" >+ " Zero,All,AllFinite:Int;\n" >+ "\n" >+ "procedure deblank;\n" >+ "var Ch:char;\n" >+ "begin\n" >+ " while (not eof) and (input^ in [' ',' ']) do read(Ch);\n" >+ "end;\n" >+ "\n" >+ "procedure InitialOptions;\n" >+ "\n" >+ "#include '/user/profs/cleary/bin/options.i';\n" >+ "\n" >+ " procedure Option;\n" >+ " begin\n" >+ " case Opt of\n" >+ " 'a','A':Debug:=3Dactivity;\n" >+ " 'd','D':Debug:=3Ddump;\n" >+ " 'h','H':HalveThreshold:=3DStringNum/100;\n" >+ " 'n','N':Debug:=3Dnone;\n" >+ " 'p','P':Debug:=3Dpost;\n" >+ " 't','T':Debug:=3Dtrace;\n" >+ " 'v','V':Verifiable:=3Dtrue;\n" >+ " end;\n" >+ " end;\n" >+ "\n" >+ "begin\n" >+ " Debug:=3Dtrace;\n" >+ " Verifiable:=3Dfalse;\n" >+ " HalveThreshold:=3D67/100;\n" >+ " Options;\n" >+ " writeln(Debug);\n" >+ " writeln('Verifiable:',Verifiable);\n" >+ " writeln('Halve threshold',HalveThreshold);\n" >+ "end;{InitialOptions}\n" >+ "\n" >+ "procedure NormalizeUp(E,M:integer;var S:Sreal;var Closed:boolean);\n" >+ "begin\n" >+ "with S do\n" >+ "begin\n" >+ " if M=3D0 then S:=3DZeroS else\n" >+ " if M>0 then\n"; >+ >+static const char * const compress_test_bufs[] =3D { >+ test_buf_alice, >+ test_buf_shakespeare, >+ test_buf_pascal >+}; >+ >+#endif /* TEST_COMPRESSDEV_TEST_BUFFERS_H_ */ >-- >2.17.0