OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [services/] [compress/] [zlib/] [v2_0/] [tests/] [zlib2.c] - Blame information for rev 1254

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
//=================================================================
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
 
64
static cyg_handle_t thread[NTHREADS];
65
 
66
static cyg_thread thread_obj[NTHREADS];
67
static char stack[NTHREADS][STACKSIZE];
68
 
69
 
70
unsigned char gzip_test[] = {
71
0x1f, 0x8b, 0x08, 0x08, 0x23, 0xce, 0xa8, 0x3a, 0x00, 0x03, 0x61, 0x00, 0x8d, 0x56, 0xdb, 0x6e,
72
0xe3, 0x36, 0x10, 0x7d, 0xe7, 0x57, 0x10, 0x01, 0x8a, 0x66, 0x01, 0xd7, 0xdd, 0xb4, 0xdd, 0xed,
73
0xe5, 0x2d, 0x9b, 0x64, 0xd1, 0x00, 0x7b, 0x29, 0x92, 0x45, 0x17, 0x7d, 0xa4, 0xa9, 0x91, 0x4d,
74
0x44, 0x22, 0x55, 0x92, 0xb2, 0x93, 0xbf, 0xdf, 0x33, 0x43, 0x49, 0x96, 0x9c, 0x06, 0xa8, 0x9f,
75
0x4c, 0x91, 0x9c, 0x39, 0x33, 0x73, 0xe6, 0x0c, 0xef, 0xa8, 0xd2, 0x7f, 0x9a, 0xac, 0xe9, 0x2a,
76
0x24, 0xfd, 0x57, 0xbf, 0x69, 0x9c, 0xd5, 0x1f, 0x9c, 0x25, 0x9f, 0x48, 0xef, 0x2f, 0xd6, 0x17,
77
0x0a, 0xbf, 0x8b, 0xb5, 0xbe, 0xbe, 0x79, 0x7f, 0xfb, 0xe9, 0xf6, 0xcb, 0xed, 0xe7, 0x4f, 0xf7,
78
0xbc, 0xc6, 0x97, 0xb3, 0xab, 0xe0, 0x73,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 0x22, 0x8c, 0xc5, 0x66, 0x49, 0x30, 0xcb, 0xca, 0xa8, 0x5f, 0x72, 0xe5, 0xd4,
113
0xcd, 0xcb, 0x1e, 0x20, 0xc5, 0xaf, 0x51, 0xbb, 0xc5, 0x85, 0xb1, 0x76, 0x33, 0xb2, 0xb2, 0x75,
114
0x50, 0xad, 0x83, 0xfa, 0x46, 0x35, 0x75, 0xad, 0xb0, 0xa9, 0xf0, 0x90, 0x09, 0x41, 0xc9, 0x42,
115
0x10, 0x8e, 0xdd, 0xfd, 0x7f, 0xc9, 0xce, 0xf5, 0x38, 0x91, 0x5d, 0x48, 0x95, 0x12, 0xc3, 0xf8,
116
0x9b, 0xc5, 0x58, 0x76, 0xad, 0xa0, 0x70, 0x48, 0xed, 0x50, 0x48, 0xdd, 0xfb, 0x4a, 0xc8, 0x71,
117
0x64, 0x2c, 0x97, 0x99, 0xe9, 0x6d, 0x1a, 0x8c, 0x86, 0xea, 0x69, 0x49, 0x81, 0x25, 0xe7, 0x4f,
118
0x68, 0x7e, 0xc1, 0x23, 0x69, 0x86, 0x78, 0xde, 0xf5, 0xc8, 0x1e, 0x24, 0x87, 0xed, 0x14, 0xfd,
119
0x28, 0x99, 0x5e, 0xd8, 0x66, 0xa9, 0x6a, 0xcd, 0x03, 0xd7, 0xb8, 0x5d, 0x88, 0x33, 0xc8, 0xe2,
120
0xf2, 0xea, 0xa8, 0xad, 0x0a, 0x42, 0xc8, 0x47, 0x7a, 0x70, 0x0e, 0x3b, 0x53, 0x21, 0x31, 0x6a,
121
0x9a, 0x7e, 0xe8, 0x97, 0x94, 0x82, 0x75, 0xa6, 0xe8, 0x24, 0x12, 0x5e, 0x1b, 0x4b, 0xaa, 0xa2,
122
0xda, 0xf9, 0xc2, 0xbf, 0x81, 0xaf, 0x9c, 0xed, 0x2e, 0x0f, 0xe3, 0x08, 0x6e, 0x64, 0x40, 0x86,
123
0x46, 0xea, 0xe4, 0x1a, 0x71, 0x2f, 0x92, 0x0f, 0xe3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c, 0xf1, 0x9e, 0x68,
135
0x35, 0x13, 0x65, 0xa0, 0xda, 0xa8, 0xce, 0xab, 0x25, 0xd9, 0xc5, 0x7e, 0xdd, 0x8b, 0x58, 0xee,
136
0xcb, 0xeb, 0x66, 0x94, 0x70, 0x75, 0x6c, 0x88, 0xd4, 0x23, 0x0b, 0xa5, 0x55, 0xee, 0x31, 0x47,
137
0xf9, 0xd0, 0x5b, 0x7e, 0x80, 0xbd, 0xc7, 0xf5, 0x19, 0x38, 0x88, 0xe1, 0x4a, 0x95, 0x58, 0x0a,
138
0x59, 0xa9, 0xb0, 0x71, 0x78, 0x8e, 0x8d, 0xe3, 0x46, 0x38, 0xc6, 0x2f, 0x87, 0x34, 0x2e, 0x1a,
139
0x14, 0x72, 0xf3, 0x24, 0x44, 0x72, 0x43, 0x3c, 0x1c, 0x4a, 0x0b, 0x3f, 0x23, 0x25, 0x25, 0x1e,
140
0x98, 0x2e, 0x4e, 0xbb, 0x3e, 0x76, 0x21, 0x89, 0xf6, 0xaa, 0x32, 0x4a, 0x26, 0x6e, 0xaf, 0xf4,
141
0xd9, 0x70, 0x67, 0xcc, 0xe8, 0xb9, 0x79, 0x55, 0x7a, 0x30, 0x1c, 0x38, 0x4f, 0x15, 0xd4, 0xc3,
142
0x66, 0xc5, 0xbe, 0x7c, 0xf9, 0xbf, 0x12, 0xee, 0x1b, 0x74, 0x81, 0x9c, 0x2b, 0x1f, 0x87, 0xd2,
143
0xb6, 0xc6, 0x9b, 0x2d, 0xf1, 0x94, 0x62, 0x5f, 0xa9, 0x9f, 0x5e, 0x97, 0x2b, 0xc4, 0x43, 0x42,
144
0x50, 0x68, 0x81, 0x78, 0x34, 0x36, 0xf3, 0x0d, 0x61, 0xed, 0xc1, 0xa5, 0xd2, 0x18, 0xe7, 0x9b,
145
0x57, 0x0a, 0xd4, 0x45, 0x6a, 0x77, 0xae, 0x2b, 0xa3, 0xa2, 0x46, 0x2e, 0x30, 0xd0, 0x2d, 0xdb,
146
0x3c, 0x7f, 0xf3, 0xfa, 0xbb, 0x57, 0xe2, 0x27, 0xc4, 0x91, 0xc7, 0x2a, 0xf4, 0x99, 0x87, 0x99,
147
0xbc, 0xa3, 0x12, 0x98, 0x22, 0xaf, 0x57, 0x70, 0xd6, 0x23, 0x48, 0xcb, 0xad, 0xb4, 0x30, 0xc8,
148
0x98, 0x54, 0xc1, 0x54, 0x08, 0xc5, 0xef, 0xc0, 0xbb, 0xe1, 0x4d, 0xfd, 0x0e, 0x8f, 0x9d, 0x6a,
149
0x7a, 0x0f, 0x4a, 0xc6, 0xab, 0x41, 0xff, 0x87, 0x23, 0xaa, 0x1a, 0x5f, 0x61, 0x52, 0xad, 0xea,
150
0x47, 0x4e, 0x2f, 0xc8, 0xc2, 0x2a, 0x29, 0xa1, 0x88, 0x00, 0x1d, 0x0f, 0x95, 0xf2, 0xa8, 0xa9,
151
0xb5, 0x75, 0x61, 0x96, 0xbc, 0x85, 0x38, 0x7b, 0x77, 0x2f, 0xbf, 0xe6, 0xd7, 0x6a, 0xd8, 0x44,
152
0x77, 0xce, 0x81, 0x21, 0xc9, 0x4f, 0xa3, 0x8a, 0x0d, 0x93, 0x28, 0xce, 0xb9, 0x3b, 0x97, 0xc9,
153
0xb5, 0xfa, 0x06, 0x64, 0xed, 0xaa, 0x07, 0x2f, 0x0c, 0x00};
154
 
155
unsigned char gzip_test_ref[] =
156
"Red Hat eCos Public License v1.1
157
 
158
 
159
 
160
1. DEFINITIONS
161
 
162
1.1. \"Contributor\" means each entity that creates or
163
contributes to the creation of Modifications.
164
 
165
1.2. \"Contributor Version\" means the combination of the
166
Original Code, prior Modifications used by a
167
Contributor, and the Modifications made by that
168
particular Contributor.
169
 
170
1.3. \"Covered Code\" means the Original Code or
171
Modifications or the combination of the Original Code
172
and Modifications, in each case including portions
173
thereof.
174
 
175
1.4. \"Electronic Distribution Mechanism\" means a
176
mechanism generally accepted in the software development
177
community for the electronic transfer of data.
178
 
179
1.5. \"Executable\" means Covered Code in any form other
180
than Source Code.
181
1.6. \"Initial Developer\" means the individual or entity
182
identified as the Initial Developer in the Source Code
183
notice required by Exhibit A.
184
 
185
1.7. \"Larger Work\" means a work which combines Covered
186
Code or portions thereof with code not governed by the
187
terms of this License.
188
 
189
1.8. \"License\" means this document.
190
 
191
1.9. \"Modifications\" means any addition to or deletion
192
from the substance or structure of either the Original
193
Code or any previous Modifications. When Covered Code is
194
released as a series of files, a Modification is:
195
 
196
     A. Any addition to or deletion from the
197
     contents of a file containing Original Code or
198
     previous Modifications.
199
 
200
     B. Any new file that contains any part of the
201
     Original Code or previous Modifications.
202
 
203
1.10. \"Original Code\" means Source Code of computer
204
software code which is described in the Source Code
205
notice required by Exhibit A as Original Code, and
206
which, at the time of its release under this License is
207
not already Covered Code governed by this License.
208
 
209
1.11. \"Source Code\" means the preferred form of the
210
Covered Code for making modifications to it, including
211
all modules it contains, plus any associated interface
212
definition files, scripts used to control compilation
213
and installation of an Executable, or a list of source
214
code differential comparisons against either the
215
Original Code or another well known, available Covered
216
Code of the Contributor's choice. The Source Code can be
217
in a compressed or archival form, provided the
218
appropriate decompression or de-archiving software is
219
widely available for no charge.
220
 
221
1.12. \"You\" means an individual or a legal entity
222
exercising rights under, and complying with all of the
223
terms of, this License or a future version of this
224
License issued under Section 6.1. For legal entities,
225
\"You\" includes any entity which controls, is controlled
226
by, or is under common control with You. For purposes of
227
this definition, \"control\" means (a) the power, direct
228
or indirect, to cause the direction or management of
229
such entity, whether by contract or otherwise, or (b)
230
ownership of fifty percent (50%) or more of the
231
outstanding shares or beneficial ownership of such
232
entity.
233
 
234
1.13. \"Red Hat Branded Code\" is code that Red Hat
235
distributes and/or permits others to distribute under
236
different terms than the Red Hat eCos Public License.
237
Red Hat's Branded Code may contain part or all of the
238
Covered Code.
239
";
240
 
241
static void entry0( cyg_addrword_t data )
242
{
243
    int i;
244
    unsigned long len;
245
    int err;
246
    int buf_size = sizeof(gzip_test_ref)+512;
247
    unsigned char* unpacked = malloc(buf_size);
248
 
249
    if (NULL == unpacked)
250
        CYG_TEST_NA("Not enough memory for buffers");
251
 
252
    CYG_TEST_INFO("Decompressing");
253
    len = buf_size;
254
    err = uncompress(unpacked, &len, gzip_test, sizeof(gzip_test));
255
 
256
    switch (err) {
257
    case Z_OK:
258
        break;
259
    case Z_MEM_ERROR:
260
        CYG_TEST_NA("Not enough memory for decompression");
261
        break;
262
    case Z_BUF_ERROR:
263
        CYG_TEST_FAIL_FINISH("Decompressed data larger than original");
264
        break;
265
    case Z_DATA_ERROR:
266
        CYG_TEST_FAIL_FINISH("Decompression failed");
267
        break;
268
    default:
269
        CYG_TEST_FAIL_FINISH("Unknown decompression error");
270
        break;
271
    }
272
 
273
    for (i = 0; i < sizeof(gzip_test_ref)-1; i++) {
274
        if (gzip_test_ref[i] != unpacked[i])
275
            CYG_TEST_FAIL_FINISH("Verify failed");
276
    }
277
 
278
    CYG_TEST_PASS_FINISH("zlib2 OK");
279
}
280
 
281
void zlib2_main( void )
282
{
283
    CYG_TEST_INIT();
284
 
285
    cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "zlib1",
286
        (void *)stack[0], STACKSIZE,&thread[0], &thread_obj[0]);
287
    cyg_thread_resume(thread[0]);
288
 
289
    cyg_scheduler_start();
290
 
291
    CYG_TEST_FAIL_FINISH("Not reached");
292
}
293
 
294
externC void
295
cyg_start( void )
296
{
297
    zlib2_main();
298
}
299
 
300
#else /* def CYGFUN_KERNEL_API_C */
301
externC void
302
cyg_start( void )
303
{
304
    CYG_TEST_INIT();
305
    CYG_TEST_NA("Kernel C API layer disabled");
306
}
307
#endif /* def CYGFUN_KERNEL_API_C */
308
 
309
// EOF zlib1.c

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.