Changeset 1526
- Timestamp:
- Dec 29, 2006, 6:22:11 PM (15 years ago)
- Location:
- zzuf/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/doc/zzuf.1
r1525 r1526 5 5 .B zzuf 6 6 [ 7 .B \-vqdh 7 .B \-vqdhi 8 8 ] [ 9 9 .B \-r … … 112 112 is very verbose but only its exit code is really useful to you. 113 113 .TP 114 .B \-i, \-\-stdin 115 Fuzz the application's standard input. By default 116 .B zzuf 117 only fuzzes files. 118 .TP 114 119 .B \-I, \-\-include <regex> 115 120 Only fuzz files whose name matches the -
zzuf/trunk/src/libzzuf.c
r1524 r1526 83 83 _zz_fd_init(); 84 84 85 tmp = getenv("ZZUF_STDIN"); 86 if(tmp && *tmp == '1') 87 _zz_register(0); 88 85 89 _zz_load_fd(); 86 90 _zz_load_stream(); -
zzuf/trunk/src/zzuf.c
r1525 r1526 98 98 { "include", 1, NULL, 'I' }, 99 99 { "exclude", 1, NULL, 'E' }, 100 { "stdin", 0, NULL, 'i' }, 100 101 { "seed", 1, NULL, 's' }, 101 102 { "ratio", 1, NULL, 'r' }, … … 108 109 { "version", 0, NULL, 'v' }, 109 110 }; 110 int c = getopt_long(argc, argv, "I:E: s:r:F:B:T:qdhv",111 int c = getopt_long(argc, argv, "I:E:is:r:F:B:T:qdhv", 111 112 long_options, &option_index); 112 113 # else 113 114 # define MOREINFO "Try `%s -h' for more information.\n" 114 int c = getopt(argc, argv, "I:E: s:r:F:B:T:qdhv");115 int c = getopt(argc, argv, "I:E:is:r:F:B:T:qdhv"); 115 116 # endif 116 117 if(c == -1) … … 124 125 case 'E': /* --exclude */ 125 126 setenv("ZZUF_EXCLUDE", optarg, 1); 127 break; 128 case 'i': /* --stdin */ 129 setenv("ZZUF_STDIN", "1", 1); 126 130 break; 127 131 case 's': /* --seed */ … … 426 430 static void usage(void) 427 431 { 428 printf("Usage: zzuf [ -vqdh ] [ -r ratio ] [ -s seed | -s start:stop]\n");429 printf(" [ -F children ] [ -B bytes ] [ -T seconds ]\n");430 printf(" [ -I include ] [ -E exclude ] COMMAND [ARGS]...\n");431 printf("Run COMMAND and randomly fuzz its input files.\n");432 printf("Usage: zzuf [ -vqdhi ] [ -r ratio ] [ -s seed | -s start:stop]\n"); 433 printf(" [ -F children ] [ -B bytes ] [ -T seconds ]\n"); 434 printf(" [ -I include ] [ -E exclude ] COMMAND [ARGS]...\n"); 435 printf("Run COMMAND and randomly fuzz its input.\n"); 432 436 printf("\n"); 433 437 printf("Mandatory arguments to long options are mandatory for short options too.\n"); … … 440 444 printf(" -T, --max-time <n> kill children that run for more than <n> seconds\n"); 441 445 printf(" -q, --quiet do not print children's messages\n"); 446 printf(" -i, --stdin fuzz standard input\n"); 442 447 printf(" -I, --include <regex> only fuzz files matching <regex>\n"); 443 448 printf(" -E, --exclude <regex> do not fuzz files matching <regex>\n"); … … 453 458 printf(" -T <n> kill children that run for more than <n> seconds\n"); 454 459 printf(" -q do not print the fuzzed application's messages\n"); 460 printf(" -i fuzz standard input\n"); 455 461 printf(" -I <regex> only fuzz files matching <regex>\n"); 456 462 printf(" -E <regex> do not fuzz files matching <regex>\n"); -
zzuf/trunk/test/testsuite.sh
r1521 r1526 35 35 rm -f /tmp/zzuf-random-$$ 36 36 rm -f /tmp/zzuf-text-$$ 37 echo "Temporary files removed." 38 else 39 echo "Files preserved:" 40 echo " /tmp/zzuf-zero-$$" 41 echo " /tmp/zzuf-random-$$" 42 echo " /tmp/zzuf-text-$$" 37 43 fi 38 44 } 39 45 40 trap "echo ''; echo ' Aborted.'; cleanup; exit 0" 1 2 1546 trap "echo ''; echo ''; echo 'Aborted.'; cleanup; exit 0" 1 2 15 41 47 42 48 seed=$(($RANDOM * $$)) … … 53 59 54 60 for file in /tmp/zzuf-text-$$ /tmp/zzuf-zero-$$ /tmp/zzuf-random-$$; do 55 for r in 0.0 0.00001 0.0001 0.001 0.01 0.1 1.0 10.0; do61 for r in 0.000000 0.00001 0.0001 0.001 0.01 0.1 1.0 10.0; do 56 62 echo "Testing zzuf on $file, ratio $r:" 57 63 OK=1 58 64 MD5="" 59 65 check $seed $r "cat $file" "cat" 60 # don't do grep, it adds a newline at EOF! 61 # check $seed $r "grep -- -a \\'\\' $file" "grep -a" 66 check $seed $r "cat < $file" "cat stdin" 67 # We don't include grep in the testsuite because it puts a newline 68 # at the end of its input if it was not there initially. 69 #check $seed $r "grep -- -a \\'\\' $file" "grep -a" 62 70 check $seed $r "sed n $file" "sed n" 63 71 check $seed $r "dd bs=65536 if=$file" "dd(bs=65536)" … … 75 83 done 76 84 done 77 cleanup78 85 79 86 if [ "$FAILED" != 0 ]; then 80 echo "$FAILED tests failed out of $TESTED. Files preserved:" 81 echo " /tmp/zzuf-zero-$$" 82 echo " /tmp/zzuf-random-$$" 83 echo " /tmp/zzuf-text-$$" 87 echo "$FAILED tests failed out of $TESTED." 88 cleanup 84 89 exit 1 85 90 fi 86 91 echo "All $TESTED tests OK." 92 93 cleanup 87 94 exit 0 88 95
Note: See TracChangeset
for help on using the changeset viewer.