source: SVN/cambria/redboot/packages/services/compress/zlib/current/tests/zlib2.c @ 1

Last change on this file since 1 was 1, checked in by Tim Harvey, 3 years ago

restored latest version of files from server backup

Signed-off-by: Tim Harvey <tharvey@…>

File size: 15.3 KB
Line 
1//=================================================================
2//
3//        zlib2.c
4//
5//        zlib decompression test 2
6//
7//==========================================================================
8//####ECOSGPLCOPYRIGHTBEGIN####
9// -------------------------------------------
10// This file is part of eCos, the Embedded Configurable Operating System.
11// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12//
13// eCos is free software; you can redistribute it and/or modify it under
14// the terms of the GNU General Public License as published by the Free
15// Software Foundation; either version 2 or (at your option) any later version.
16//
17// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20// for more details.
21//
22// You should have received a copy of the GNU General Public License along
23// with eCos; if not, write to the Free Software Foundation, Inc.,
24// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25//
26// As a special exception, if other files instantiate templates or use macros
27// or inline functions from this file, or you compile this file and link it
28// with other works to produce a work based on this file, this file does not
29// by itself cause the resulting work to be covered by the GNU General Public
30// License. However the source code for this file must still be made available
31// in accordance with section (3) of the GNU General Public License.
32//
33// This exception does not invalidate any other reasons why a work based on
34// this file might be covered by the GNU General Public License.
35//
36// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37// at http://sources.redhat.com/ecos/ecos-license/
38// -------------------------------------------
39//####ECOSGPLCOPYRIGHTEND####
40//==========================================================================
41//#####DESCRIPTIONBEGIN####
42//
43// Author(s):     jskov
44// Contributors:  jskov
45// Date:          2001-03-09
46// Description:   Tests zlib compression of gz compressed image.
47//####DESCRIPTIONEND####
48
49
50#include <cyg/hal/hal_arch.h>           // CYGNUM_HAL_STACK_SIZE_TYPICAL
51
52#include <cyg/kernel/kapi.h>
53
54#include <cyg/infra/testcase.h>
55
56#ifdef CYGFUN_KERNEL_API_C
57
58#include <cyg/compress/zlib.h>
59#include <stdlib.h>
60
61#define NTHREADS 1
62#define STACKSIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL > 8192 ? CYGNUM_HAL_STACK_SIZE_TYPICAL : 8192)
63
64static cyg_handle_t thread[NTHREADS];
65
66static cyg_thread thread_obj[NTHREADS];
67static char stack[NTHREADS][STACKSIZE];
68
69
70unsigned char gzip_test[] = {
710x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x8d, 0x56, 0xdb, 0x6e, 0xe3, 0x36,
720x10, 0xed, 0x33, 0xbf, 0x82, 0x08, 0x50, 0x74, 0x03, 0xb8, 0xee, 0xa6, 0xed, 0x6e, 0x2f, 0x6f,
730xd9, 0x24, 0x8b, 0x06, 0xd8, 0x4b, 0x91, 0x2c, 0xba, 0xe8, 0x23, 0x4d, 0x8d, 0x6c, 0x22, 0x12,
740xa9, 0x92, 0x94, 0x9d, 0xfc, 0x7d, 0xcf, 0x0c, 0x25, 0x59, 0x72, 0x1a, 0xa0, 0x7e, 0x32, 0x45,
750x72, 0xe6, 0xcc, 0xcc, 0x99, 0x33, 0xbc, 0xa3, 0x4a, 0xff, 0x61, 0xb2, 0xa6, 0xab, 0x90, 0xf4,
760x9f, 0xfd, 0xa6, 0x71, 0x56, 0x7f, 0x70, 0x96, 0x7c, 0x22, 0xbd, 0xbf, 0x58, 0x5f, 0x28, 0xfc,
770x2e, 0xd6, 0xfa, 0xfa, 0xe6, 0xfd, 0xed, 0xa7, 0xdb, 0x2f, 0xb7, 0x9f, 0x3f, 0xdd, 0xf3, 0x1a,
780x5f, 0xce, 0xae, 0x82, 0xcf, 0xd1, 0x6d, 0xfa, 0x1c, 0xe2, 0x99, 0x6e, 0xc9, 0xf8, 0xa4, 0xc9,
790xd8, 0x9d, 0x26, 0x9f, 0x5d, 0x7e, 0xd2, 0x79, 0x07, 0xab, 0x36, 0x92, 0xc9, 0x94, 0x74, 0x88,
800xca, 0x8e, 0xc7, 0xb1, 0xcc, 0x01, 0xdb, 0x54, 0x76, 0x5d, 0xf0, 0x3a, 0xd4, 0xfa, 0x63, 0xa8,
810x5c, 0xed, 0xac, 0xac, 0xd3, 0x9a, 0x7d, 0xfc, 0xb8, 0xf4, 0xa1, 0xff, 0xa2, 0x98, 0xb0, 0x39,
820xfa, 0x12, 0x03, 0xa1, 0xdd, 0x38, 0x3f, 0xd9, 0xc0, 0x27, 0xf5, 0x39, 0xba, 0x2d, 0x3e, 0x35,
830xfa, 0x2a, 0x54, 0xb4, 0xd2, 0x5d, 0x74, 0xb8, 0xba, 0x30, 0xae, 0xfb, 0x84, 0x98, 0x37, 0x4f,
840xda, 0xa8, 0x99, 0xf9, 0x95, 0x36, 0xbe, 0x12, 0xa3, 0xcb, 0xc3, 0xad, 0xa9, 0x88, 0x0f, 0x73,
850x38, 0xaa, 0x33, 0x31, 0x3b, 0xdb, 0x37, 0x26, 0xea, 0xd9, 0x55, 0x41, 0xfb, 0x93, 0xa0, 0xdd,
860x53, 0x84, 0x6d, 0x76, 0x3d, 0x87, 0xb9, 0xc0, 0xc4, 0xb9, 0x58, 0xba, 0x00, 0xc0, 0xff, 0x0e,
870x66, 0x79, 0x51, 0x31, 0xc0, 0xc5, 0xcd, 0x95, 0x76, 0xbe, 0xe4, 0xdc, 0x1a, 0x94, 0xcb, 0x79,
880xdb, 0xf4, 0x95, 0xf3, 0x5b, 0xdd, 0x85, 0x28, 0x07, 0x14, 0x8c, 0x44, 0x0a, 0xb5, 0x20, 0xfc,
890x19, 0x08, 0x6f, 0x1a, 0xb2, 0x39, 0x06, 0x8f, 0x22, 0x5f, 0xbb, 0x54, 0x02, 0x60, 0x7f, 0x1f,
900xc9, 0xee, 0x8c, 0x77, 0xa9, 0x1d, 0x61, 0x1b, 0xd5, 0x8e, 0x9f, 0xf4, 0x96, 0x3c, 0x45, 0xd3,
910x34, 0xc8, 0x98, 0xb5, 0xd4, 0x65, 0x44, 0x08, 0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5,
1030xb1, 0x81, 0x05, 0xc5, 0xaf, 0x8c, 0xa2, 0xac, 0x8f, 0x99, 0xc0, 0x99, 0x2a, 0xd8, 0x9e, 0xeb,
1040x25, 0x87, 0x7e, 0xc3, 0xa1, 0x05, 0xb5, 0x26, 0xb0, 0x48, 0xba, 0xa9, 0x2a, 0x27, 0x2c, 0x41,
1050xdb, 0x02, 0x59, 0x85, 0x72, 0xf2, 0x52, 0xd5, 0x31, 0xb4, 0x85, 0x06, 0xfd, 0x26, 0x65, 0xe3,
1060xad, 0x00, 0x07, 0xab, 0x7a, 0x9b, 0x7b, 0x90, 0x02, 0x68, 0xc8, 0x31, 0xfc, 0x05, 0x97, 0xa7,
1070x08, 0xd9, 0x74, 0x17, 0x69, 0xef, 0x42, 0x9f, 0x4e, 0xda, 0x5f, 0x7f, 0xdd, 0x91, 0x3f, 0x21,
1080x40, 0x52, 0x11, 0x8e, 0x4d, 0x2a, 0x55, 0x32, 0x3a, 0x51, 0x74, 0x24, 0x21, 0xd7, 0xae, 0x21,
1090xf4, 0x82, 0x59, 0x18, 0xc1, 0x85, 0xdf, 0x95, 0xd2, 0xfc, 0xbb, 0x5c, 0xeb, 0xcb, 0x97, 0xc3,
1100xd0, 0x63, 0x18, 0xe5, 0x30, 0xcb, 0x14, 0xb2, 0x22, 0x86, 0x8d, 0x98, 0x96, 0x4f, 0xc6, 0x79,
1110x6e, 0xac, 0x67, 0x9d, 0x2c, 0x77, 0x5e, 0x88, 0x62, 0x70, 0xff, 0xae, 0xb8, 0xf7, 0x74, 0x28,
1120xe6, 0x8a, 0x30, 0x16, 0x9b, 0x25, 0xc1, 0x2c, 0x2b, 0xa3, 0x7e, 0xc9, 0x95, 0x53, 0x37, 0x2f,
1130x7b, 0x80, 0x14, 0xbf, 0x46, 0xed, 0x16, 0x17, 0xc6, 0xda, 0xcd, 0xc8, 0xca, 0xd6, 0x41, 0xb5,
1140x0e, 0xea, 0x1b, 0xd5, 0xd4, 0xb5, 0xc2, 0xa6, 0xc2, 0x43, 0x26, 0x04, 0x25, 0x0b, 0x41, 0x38,
1150x76, 0xf7, 0xff, 0x25, 0x3b, 0xd7, 0xe3, 0x44, 0x76, 0x21, 0x55, 0x4a, 0x0c, 0xe3, 0x6f, 0x16,
1160x63, 0xd9, 0xb5, 0x82, 0xc2, 0x21, 0xb5, 0x43, 0x21, 0x75, 0xef, 0x2b, 0x21, 0xc7, 0x91, 0xb1,
1170x5c, 0x66, 0xa6, 0xb7, 0x69, 0x30, 0x1a, 0xaa, 0xa7, 0x25, 0x05, 0x96, 0x9c, 0x3f, 0xa1, 0xf9,
1180x05, 0x8f, 0xa4, 0x19, 0xe2, 0x79, 0xd7, 0x23, 0x7b, 0x90, 0x1c, 0xb6, 0x53, 0xf4, 0xa3, 0x64,
1190x7a, 0x61, 0x9b, 0xa5, 0xaa, 0x35, 0x0f, 0x5c, 0xe3, 0x76, 0x21, 0xce, 0x20, 0x8b, 0xcb, 0xab,
1200xa3, 0xb6, 0x2a, 0x08, 0x21, 0x1f, 0xe9, 0xc1, 0x39, 0xec, 0x4c, 0x85, 0xc4, 0xa8, 0x69, 0xfa,
1210xa1, 0x5f, 0x52, 0x0a, 0xd6, 0x99, 0xa2, 0x93, 0x48, 0x78, 0x6d, 0x2c, 0xa9, 0x8a, 0x6a, 0xe7,
1220x0b, 0xff, 0x06, 0xbe, 0x72, 0xb6, 0xbb, 0x3c, 0x8c, 0x23, 0xb8, 0x91, 0x01, 0x19, 0x1a, 0xa9,
1230x93, 0x6b, 0xc4, 0xbd, 0x48, 0x3e, 0x8c, 0x67, 0x38, 0x9d, 0x06, 0x03, 0x64, 0xef, 0x28, 0x96,
1240x2b, 0xe9, 0x24, 0xdd, 0x40, 0xcc, 0x79, 0x2f, 0x49, 0x02, 0x94, 0x14, 0x16, 0x51, 0x20, 0x6a,
1250x96, 0x36, 0x53, 0x8c, 0x9a, 0xe8, 0x12, 0x87, 0x64, 0xb6, 0x0c, 0x38, 0xcf, 0x9a, 0x53, 0x3d,
1260x23, 0x9c, 0xf1, 0xa2, 0xb2, 0xfa, 0x40, 0x08, 0xf7, 0xc1, 0x87, 0x83, 0x47, 0x25, 0xf7, 0x06,
1270xb8, 0xe0, 0xf4, 0x44, 0xac, 0xca, 0xac, 0x9a, 0x0d, 0xc4, 0xef, 0x92, 0xb6, 0xbb, 0x80, 0xe2,
1280xac, 0xf5, 0x97, 0x25, 0x8f, 0x30, 0xa8, 0xbc, 0xde, 0x90, 0x62, 0x39, 0x17, 0x4c, 0x91, 0x12,
1290x87, 0xcf, 0x1e, 0xa3, 0xdd, 0xb9, 0x3d, 0x20, 0x70, 0x8d, 0x78, 0x70, 0x07, 0x08, 0x35, 0xc9,
1300x48, 0x56, 0xa6, 0xc3, 0x12, 0xa3, 0x1c, 0x39, 0x05, 0x4d, 0xc7, 0x7b, 0x92, 0x0f, 0x6e, 0xe4,
1310xef, 0xcb, 0x5d, 0x2e, 0xde, 0xc4, 0x6d, 0x10, 0xe9, 0x80, 0xfb, 0x3c, 0xb4, 0x26, 0xd8, 0x5c,
1320x64, 0x8f, 0x44, 0xef, 0x58, 0x94, 0x0b, 0x6b, 0xf8, 0x91, 0xf1, 0x77, 0xe8, 0x8f, 0x72, 0x77,
1330x32, 0x22, 0x90, 0x5a, 0xda, 0xe2, 0xef, 0x30, 0x2a, 0xe8, 0x91, 0xa2, 0x75, 0x89, 0x3d, 0x21,
1340x63, 0x3b, 0xae, 0x1e, 0x73, 0xb8, 0x3c, 0x1e, 0x18, 0x57, 0xf3, 0xc4, 0x7b, 0xa2, 0xd5, 0x4c,
1350x94, 0x81, 0x6a, 0xa3, 0x3a, 0xaf, 0x96, 0x64, 0x17, 0xfb, 0x75, 0x2f, 0x62, 0xb9, 0x2f, 0xaf,
1360x9b, 0x51, 0xc2, 0xd5, 0xb1, 0x21, 0x52, 0x8f, 0x2c, 0x94, 0x56, 0xb9, 0xc7, 0x1c, 0xe5, 0x43,
1370x6f, 0xf9, 0x01, 0xf6, 0x1e, 0xd7, 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c, 0x76, 0xaa, 0xe9, 0x3d,
1490x28, 0x19, 0xaf, 0x06, 0xfd, 0x1f, 0x8e, 0xa8, 0x6a, 0x7c, 0x85, 0x49, 0xb5, 0xaa, 0x1f, 0x38,
1500xbd, 0x20, 0x0b, 0xab, 0xa4, 0x84, 0x22, 0x02, 0x74, 0x3c, 0x54, 0xca, 0xa3, 0xa6, 0xd6, 0xd6,
1510x85, 0x59, 0xf2, 0x16, 0xe2, 0xec, 0xdd, 0xbd, 0xfc, 0x9a, 0x5f, 0xab, 0x61, 0x13, 0xdd, 0x39,
1520x07, 0x86, 0x24, 0x3f, 0x8d, 0x2a, 0x36, 0x4c, 0xa2, 0x38, 0xe7, 0xee, 0x5c, 0x26, 0xd7, 0xea,
1530x9b, 0x7f, 0x01, 0x21, 0xe0, 0xda, 0x98, 0x30, 0x0c, 0x00, 0x00};
154
155unsigned char gzip_test_ref[] =
156"Red Hat eCos Public License v1.1\n"
157"\n"
158"\n"
159"\n"
160"1. DEFINITIONS\n"
161"\n"
162"1.1. \"Contributor\" means each entity that creates or\n"
163"contributes to the creation of Modifications.\n"
164"\n"
165"1.2. \"Contributor Version\" means the combination of the\n"
166"Original Code, prior Modifications used by a\n"
167"Contributor, and the Modifications made by that\n"
168"particular Contributor.\n"
169"\n"
170"1.3. \"Covered Code\" means the Original Code or\n"
171"Modifications or the combination of the Original Code\n"
172"and Modifications, in each case including portions\n"
173"thereof.\n"
174"\n"
175"1.4. \"Electronic Distribution Mechanism\" means a\n"
176"mechanism generally accepted in the software development\n"
177"community for the electronic transfer of data.\n"
178"\n"
179"1.5. \"Executable\" means Covered Code in any form other\n"
180"than Source Code.\n"
181"1.6. \"Initial Developer\" means the individual or entity\n"
182"identified as the Initial Developer in the Source Code\n"
183"notice required by Exhibit A.\n"
184"\n"
185"1.7. \"Larger Work\" means a work which combines Covered\n"
186"Code or portions thereof with code not governed by the\n"
187"terms of this License.\n"
188"\n"
189"1.8. \"License\" means this document.\n"
190"\n"
191"1.9. \"Modifications\" means any addition to or deletion\n"
192"from the substance or structure of either the Original\n"
193"Code or any previous Modifications. When Covered Code is\n"
194"released as a series of files, a Modification is:\n"
195"\n"
196"     A. Any addition to or deletion from the\n"
197"     contents of a file containing Original Code or\n"
198"     previous Modifications.\n"
199"\n"
200"     B. Any new file that contains any part of the\n"
201"     Original Code or previous Modifications.\n"
202"\n"
203"1.10. \"Original Code\" means Source Code of computer\n"
204"software code which is described in the Source Code\n"
205"notice required by Exhibit A as Original Code, and\n"
206"which, at the time of its release under this License is\n"
207"not already Covered Code governed by this License.\n"
208"\n"
209"1.11. \"Source Code\" means the preferred form of the\n"
210"Covered Code for making modifications to it, including\n"
211"all modules it contains, plus any associated interface\n"
212"definition files, scripts used to control compilation\n"
213"and installation of an Executable, or a list of source\n"
214"code differential comparisons against either the\n"
215"Original Code or another well known, available Covered\n"
216"Code of the Contributor's choice. The Source Code can be\n"
217"in a compressed or archival form, provided the\n"
218"appropriate decompression or de-archiving software is\n"
219"widely available for no charge.\n"
220"\n"
221"1.12. \"You\" means an individual or a legal entity\n"
222"exercising rights under, and complying with all of the\n"
223"terms of, this License or a future version of this\n"
224"License issued under Section 6.1. For legal entities,\n"
225"\"You\" includes any entity which controls, is controlled\n"
226"by, or is under common control with You. For purposes of\n"
227"this definition, \"control\" means (a) the power, direct\n"
228"or indirect, to cause the direction or management of\n"
229"such entity, whether by contract or otherwise, or (b)\n"
230"ownership of fifty percent (50%) or more of the\n"
231"outstanding shares or beneficial ownership of such\n"
232"entity.\n"
233"\n"
234"1.13. \"Red Hat Branded Code\" is code that Red Hat\n"
235"distributes and/or permits others to distribute under\n"
236"different terms than the Red Hat eCos Public License.\n"
237"Red Hat's Branded Code may contain part or all of the\n"
238"Covered Code.\n";
239
240static void entry0( cyg_addrword_t data )
241{
242    int i;
243    unsigned long len;
244    int err;
245    int buf_size = sizeof(gzip_test_ref)+512;
246    unsigned char* unpacked = malloc(buf_size);
247   
248    if (NULL == unpacked)
249        CYG_TEST_NA("Not enough memory for buffers");
250
251    CYG_TEST_INFO("Decompressing");
252    len = buf_size;
253    err = uncompress(unpacked, &len, gzip_test, sizeof(gzip_test));
254
255    switch (err) {
256    case Z_OK:
257        break;
258    case Z_MEM_ERROR:
259        CYG_TEST_NA("Not enough memory for decompression");
260        break;
261    case Z_BUF_ERROR:
262        CYG_TEST_FAIL_FINISH("Decompressed data larger than original");
263        break;
264    case Z_DATA_ERROR:
265        CYG_TEST_FAIL_FINISH("Decompression failed");
266        break;
267    default:
268        CYG_TEST_FAIL_FINISH("Unknown decompression error");
269        break;
270    }
271
272    for (i = 0; i < sizeof(gzip_test_ref)-1; i++) {
273        if (gzip_test_ref[i] != unpacked[i])
274            CYG_TEST_FAIL_FINISH("Verify failed");
275    }
276
277    CYG_TEST_PASS_FINISH("zlib2 OK");
278}
279
280void zlib2_main( void )
281{
282    CYG_TEST_INIT();
283
284    cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "zlib1",
285        (void *)stack[0], STACKSIZE,&thread[0], &thread_obj[0]);
286    cyg_thread_resume(thread[0]);
287
288    cyg_scheduler_start();
289
290    CYG_TEST_FAIL_FINISH("Not reached");
291}
292
293externC void
294cyg_start( void )
295{ 
296    zlib2_main();
297}
298
299#else /* def CYGFUN_KERNEL_API_C */
300externC void
301cyg_start( void )
302{
303    CYG_TEST_INIT();
304    CYG_TEST_NA("Kernel C API layer disabled");
305}
306#endif /* def CYGFUN_KERNEL_API_C */
307
308// EOF zlib1.c
Note: See TracBrowser for help on using the repository browser.