generic: new case to test getcwd(2)
[xfstests-dev.git] / src / t_holes.c
1 /*
2  * Copyright (c) 2010 Silicon Graphics, Inc.  All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it would be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write the Free Software Foundation,
15  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16  */
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <unistd.h>
20 #include <fcntl.h>
21 #include <sys/types.h>
22
23 int main(int argc, char **argv)
24 {
25         int buf[1024];
26         int fd, i, j;
27
28         fd = open(argv[1], O_RDWR|O_CREAT, 0666);
29         for (i = 1; i < 9100; i++) {
30                 for (j = 0; j < 1024; j++)
31                         buf[j]  = i | i << 5;
32
33                 if (write(fd,buf,253*4*sizeof(int))!= 253*4*sizeof(int)) {
34                         printf("Write did not return correct amount\n");
35                         exit(EXIT_FAILURE);
36                 }
37
38                 if ((i % 9) == 0 && i < 9001)
39                         lseek(fd, 4096 * 110,SEEK_CUR);
40         }
41
42         close(fd);
43         return 0;
44 }