~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to tests/kernel/llseek/test.c

  • Committer: Tyler Hicks
  • Date: 2012-11-05 06:05:54 UTC
  • Revision ID: tyhicks@canonical.com-20121105060554-5ji4q2865a9qk1ct
* autogen.sh:
  - Use the --copy option when invoking intltoolize

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
#include <stdlib.h>
15
15
#include <string.h>
16
16
#include <stdint.h>
17
 
#include <inttypes.h>
18
17
 
19
18
int main(int argc, char *argv[])
20
19
{
44
43
        }
45
44
        size = lseek(fd, 4096, SEEK_END);
46
45
        if (size != 4096) {
47
 
                fprintf(stderr, "Expected 4096 from lseek; got [%jd]\n",
48
 
                        (intmax_t)size);
 
46
                fprintf(stderr, "Expected 4096 from lseek; got [%ld]\n", size);
49
47
                rc = 1;
50
48
                goto out;
51
49
        }
58
56
                goto out;
59
57
        }
60
58
        if (s.st_size != 0) {
61
 
                fprintf(stderr, "Filesize is [%jd]; expected 0\n",
62
 
                        (intmax_t)s.st_size);
 
59
                fprintf(stderr, "Filesize is [%ld]; expected 0\n", s.st_size);
63
60
                rc = 1;
64
61
                goto out;
65
62
        }
77
74
                goto out;
78
75
        }
79
76
        if ((size = lseek(fd, 4096, SEEK_END)) != 4096) {
80
 
                fprintf(stderr, "Expected 4096 from lseek; got [%jd]\n",
81
 
                        (intmax_t)size);
 
77
                fprintf(stderr, "Expected 4096 from lseek; got [%ld]\n", size);
82
78
                rc = 1;
83
79
                goto out;
84
80
        }
85
81
        if ((size = write(fd, (char *)&deadbeef, 4)) != 4) {
86
 
                fprintf(stderr, "Expected a write of 4 bytes; got [%jd] "
87
 
                        "instead\n", (intmax_t)size);
 
82
                fprintf(stderr, "Expected a write of 4 bytes; got [%ld] "
 
83
                        "instead\n", size);
88
84
                rc = 1;
89
85
                goto out;
90
86
        }
91
87
        if ((size = lseek(fd, 5120, SEEK_SET)) != 5120) {
92
 
                fprintf(stderr, "Expected 5120 from lseek; got [%jd]\n",
93
 
                        (intmax_t)size);
 
88
                fprintf(stderr, "Expected 5120 from lseek; got [%ld]\n", size);
94
89
                rc = 1;
95
90
                goto out;
96
91
        }
97
92
        if ((size = write(fd, (char *)&baadf00d, 4)) != 4) {
98
 
                fprintf(stderr, "Expected a write of 4 bytes; got [%jd] "
99
 
                        "instead\n", (intmax_t)size);
 
93
                fprintf(stderr, "Expected a write of 4 bytes; got [%ld] "
 
94
                        "instead\n", size);
100
95
                rc = 1;
101
96
                goto out;
102
97
        }
103
98
        if ((size = lseek(fd, 4096, SEEK_SET)) != 4096) {
104
 
                fprintf(stderr, "Expected 4096 from lseek; got [%jd]\n",
105
 
                        (intmax_t)size);
 
99
                fprintf(stderr, "Expected 4096 from lseek; got [%ld]\n", size);
106
100
                rc = 1;
107
101
                goto out;
108
102
        }
109
103
        if ((size = read(fd, buf, 4)) != 4) {
110
104
                fprintf(stderr, "Error attempting to read data. Expected "
111
 
                        "[%d] bytes; read [%jd] instead\n", 4, (intmax_t)size);
 
105
                        "[%d] bytes; read [%ld] instead\n", 4, size);
112
106
                rc = 1;
113
107
                goto out;
114
108
        }
119
113
        }
120
114
        if ((size = read(fd, buf, 1020)) != 1020) {
121
115
                fprintf(stderr, "Error attempting to read data. Expected "
122
 
                        "[%d] bytes; read [%jd] instead\n", 1020,
123
 
                        (intmax_t)size);
 
116
                        "[%d] bytes; read [%ld] instead\n", 1020, size);
124
117
                rc = 1;
125
118
                goto out;
126
119
        }
133
126
                }
134
127
        if ((size = read(fd, buf, 4)) != 4) {
135
128
                fprintf(stderr, "Error attempting to read data. Expected "
136
 
                        "[%d] bytes; read [%jd] instead\n", 4, (intmax_t)size);
 
129
                        "[%d] bytes; read [%ld] instead\n", 4, size);
137
130
                rc = 1;
138
131
                goto out;
139
132
        }
144
137
        }
145
138
        if ((size = read(fd, buf, 1)) != 0) {
146
139
                fprintf(stderr, "Error attempting to read data. Expected "
147
 
                        "[%d] bytes; read [%jd] instead\n", 0, (intmax_t)size);
 
140
                        "[%d] bytes; read [%ld] instead\n", 0, size);
148
141
                rc = 1;
149
142
                goto out;
150
143
        }
151
144
        if ((size = lseek(fd, 0, SEEK_SET)) != 0) {
152
 
                fprintf(stderr, "Expected 0 from lseek; got [%jd]\n",
153
 
                        (intmax_t)size);
 
145
                fprintf(stderr, "Expected 0 from lseek; got [%ld]\n", size);
154
146
                rc = 1;
155
147
                goto out;
156
148
        }
157
149
        if ((size = read(fd, buf, 4096)) != 4096) {
158
150
                fprintf(stderr, "Error attempting to read data. Expected "
159
 
                        "[%d] bytes; read [%jd] instead\n", 4096,
160
 
                        (intmax_t)size);
 
151
                        "[%d] bytes; read [%ld] instead\n", 4096, size);
161
152
                rc = 1;
162
153
                goto out;
163
154
        }
177
168
                goto out;
178
169
        }
179
170
        if (s.st_size != 5124) {
180
 
                fprintf(stderr, "Filesize is [%jd]; expected 5124\n",
181
 
                        (intmax_t)s.st_size);
 
171
                fprintf(stderr, "Filesize is [%ld]; expected 5124\n",
 
172
                        s.st_size);
182
173
                rc = 1;
183
174
                goto out;
184
175
        }
191
182
        }
192
183
        if ((size = read(fd, buf, 4096)) != 4096) {
193
184
                fprintf(stderr, "Error attempting to read data. Expected "
194
 
                        "[%d] bytes; read [%jd] instead\n", 4096,
195
 
                        (intmax_t)size);
 
185
                        "[%d] bytes; read [%ld] instead\n", 4096, size);
196
186
                rc = 1;
197
187
                goto out;
198
188
        }
205
195
                }
206
196
        if ((size = read(fd, buf, 4)) != 4) {
207
197
                fprintf(stderr, "Error attempting to read data. Expected "
208
 
                        "[%d] bytes; read [%jd] instead\n", 4, (intmax_t)size);
 
198
                        "[%d] bytes; read [%ld] instead\n", 4, size);
209
199
                rc = 1;
210
200
                goto out;
211
201
        }
216
206
        }
217
207
        if ((size = read(fd, buf, 1020)) != 1020) {
218
208
                fprintf(stderr, "Error attempting to read data. Expected "
219
 
                        "[%d] bytes; read [%jd] instead\n", 1020,
220
 
                        (intmax_t)size);
 
209
                        "[%d] bytes; read [%ld] instead\n", 1020, size);
221
210
                rc = 1;
222
211
                goto out;
223
212
        }
230
219
                }
231
220
        if ((size = read(fd, buf, 4)) != 4) {
232
221
                fprintf(stderr, "Error attempting to read data. Expected "
233
 
                        "[%d] bytes; read [%jd] instead\n", 4, (intmax_t)size);
 
222
                        "[%d] bytes; read [%ld] instead\n", 4, size);
234
223
                rc = 1;
235
224
                goto out;
236
225
        }
241
230
        }
242
231
        if ((size = read(fd, buf, 1)) != 0) {
243
232
                fprintf(stderr, "Error attempting to read data. Expected "
244
 
                        "[%d] bytes; read [%jd] instead\n", 0, (intmax_t)size);
 
233
                        "[%d] bytes; read [%ld] instead\n", 0, size);
245
234
                rc = 1;
246
235
                goto out;
247
236
        }