Changeset 1745
- Timestamp:
- Feb 19, 2007, 10:16:10 AM (16 years ago)
- Location:
- zzuf/trunk/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/test/testsuite.sh
r1725 r1745 64 64 check "$ZZOPTS" "< $file" "zzuf" 65 65 fi 66 check "$ZZOPTS" "$ZZCAT 1 $file" "zzcat 1" 67 check "$ZZOPTS" "$ZZCAT 2 $file" "zzcat 2" 66 for n in 1 2 3; do 67 check "$ZZOPTS" "$ZZCAT $n $file" "zzcat $n" 68 done 68 69 if [ "$STATIC_CAT" = "" ]; then 69 70 check "$ZZOPTS" "cat $file" "cat" -
zzuf/trunk/test/zzcat.c
r1728 r1745 22 22 #if defined HAVE_UNISTD_H 23 23 # include <unistd.h> 24 #endif 25 #if defined HAVE_SYS_MMAN_H 26 # include <sys/mman.h> 24 27 #endif 25 28 #include <stdlib.h> … … 103 106 fclose(stream); 104 107 break; 108 case 3: /* mmap() */ 109 fd = open(name, O_RDONLY); 110 if(fd < 0) 111 return EXIT_FAILURE; 112 #ifdef HAVE_MMAP 113 for(i = 0; i < 128; i++) 114 { 115 int moff = myrand() % len; 116 int mlen = myrand() % (len - moff); 117 char *map = mmap(NULL, mlen, PROT_READ, MAP_PRIVATE, fd, moff); 118 for(j = 0; j < 128; j++) 119 { 120 int x = myrand() % mlen; 121 data[moff + x] = data[x]; 122 } 123 munmap(map); 124 } 125 #endif 126 close(fd); 105 127 } 106 128
Note: See TracChangeset
for help on using the changeset viewer.