Changeset 4252


Ignore:
Timestamp:
Jan 13, 2010, 12:53:56 AM (7 years ago)
Author:
sam
Message:

Reduce the number of hardcoded figures in check-utils.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/test/check-utils

    r4247 r4252  
    11#!/bin/sh
     2#
     3#  check-utils - check that zzuf properly fuzzes common utilities
     4#  Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net>
     5#                All Rights Reserved
     6#
     7#  This program is free software. It comes without any warranty, to
     8#  the extent permitted by applicable law. You can redistribute it
     9#  and/or modify it under the terms of the Do What The Fuck You Want
     10#  To Public License, Version 2, as published by Sam Hocevar. See
     11#  http://sam.zoy.org/wtfpl/COPYING for more details.
     12#
    213
    314. "$(dirname "$0")/functions.inc"
     
    6374              "eglibc (2.9-21) bug regression"
    6475        if [ "$HAVE_GET_UNLOCKED $HAVE_GETLINE" = "y y" ]; then
    65           check "$ZZOPTS" "$ZZCAT -x \"repeat(33000,getc_unlocked() ungetc() getline() feof(10))\" $file" \
     76          check "$ZZOPTS" "$ZZCAT -x \"repeat(33000,getc_unlocked(),feof(10),ungetc(),getline()))\" $file" \
    6677                "sed getc_unlocked() bug regression"
    6778        fi
     
    6980        for n in \
    7081          "fread(1,33000)" \
    71           "repeat(33,fread(1,1000))" \
    72           "repeat(1000,fread(1,33))" \
     82          "repeat(-1,fread(1,1000),feof(1))" \
     83          "repeat(-1,fread(1,33),feof(1))" \
    7384          "getc() fread(1,33000)" \
    7485          "fgetc() fread(1,33000)" \
    7586          "getc() ungetc() fread(1,33000)" \
    7687          "fgetc() ungetc() fread(1,33000)" \
    77           "repeat(33000,getc(),feof(10))" \
    78           "repeat(33000,fgetc(),feof(10))" \
     88          "repeat(-1,getc(),feof(10))" \
     89          "repeat(-1,fgetc(),feof(10))" \
    7990          "repeat(8000,getc()) fread(1,33000)" \
    8091          "repeat(8000,fgetc()) fread(1,33000)" \
    8192          "fread(1,100) fseek(50,SEEK_SET) fread(1,33000)" \
    8293          "fread(1,100) rewind() fseek(50,SEEK_CUR) fread(1,33000)" \
    83           "fread(1,33000) rewind() repeat(10000,fseek(1,SEEK_CUR) fread(1,1))" \
    84           "fread(1,33000) rewind() repeat(10000,fseek(2,SEEK_CUR) fread(1,2))" \
    85           "fread(1,33000) rewind() repeat(10000,fseek(3,SEEK_CUR) fread(1,3))" \
    86           "fread(1,33000) rewind() repeat(10000,fseek(4,SEEK_CUR) fread(1,4))" \
    87           "fread(1,33000) fseek(1000,SEEK_CUR) repeat(10000,fread(1,2),feof(10))" \
    88           "fread(1,33000) fseek(1000,SEEK_CUR) repeat(10000,getc(),feof(10))" \
    89           "fread(1,33000) fseek(1000,SEEK_CUR) repeat(10000,fgetc(),feof(10))" \
     94          "fread(1,33000) rewind() repeat(-1,fseek(1,SEEK_CUR),fread(1,1),feof(1))" \
     95          "fread(1,33000) rewind() repeat(-1,fseek(2,SEEK_CUR),fread(1,2),feof(1))" \
     96          "fread(1,33000) rewind() repeat(-1,fseek(3,SEEK_CUR),fread(1,3),feof(1))" \
     97          "fread(1,33000) rewind() repeat(-1,fseek(4,SEEK_CUR),fread(1,4),feof(1))" \
     98          "fread(1,33000) fseek(1000,SEEK_CUR) repeat(-1,fread(1,2),feof(10))" \
     99          "fread(1,33000) fseek(1000,SEEK_CUR) repeat(-1,getc(),feof(10))" \
     100          "fread(1,33000) fseek(1000,SEEK_CUR) repeat(-1,fgetc(),feof(10))" \
    90101          ; do
    91102            check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
     
    95106            for n in \
    96107              "repeat(10,getline()) fread(1,33000)" \
    97               "repeat(33000,getc() ungetc() getline() feof(10))" \
    98               "repeat(33000,fgetc() ungetc() getline() feof(10))" \
     108              "repeat(-1,getc(),feof(10),ungetc(),getline())" \
     109              "repeat(-1,fgetc(),feof(10),ungetc(),getline())" \
    99110              ; do
    100111                check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
     
    113124              "getc_unlocked() fread(1,33000)" \
    114125              "getc_unlocked() ungetc() fread(1,33000)" \
    115               "repeat(33000,getc_unlocked(),feof(10))" \
     126              "repeat(-1,getc_unlocked(),feof(10))" \
    116127              "repeat(8000,getc_unlocked()) fread(1,33000)" \
    117               "fread(1,33000) fseek(1000,SEEK_CUR) repeat(10000,getc_unlocked(),feof(10))" \
     128              "fread(1,33000) fseek(1000,SEEK_CUR) repeat(-1,getc_unlocked(),feof(10))" \
    118129              ; do
    119130                check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
     
    124135              "fgetc_unlocked() fread(1,33000)" \
    125136              "fgetc_unlocked() ungetc() fread(1,33000)" \
    126               "repeat(33000,fgetc_unlocked(),feof(10))" \
     137              "repeat(-1,fgetc_unlocked(),feof(10))" \
    127138              "repeat(8000,fgetc_unlocked()) fread(1,33000)" \
    128139              ; do
Note: See TracChangeset for help on using the changeset viewer.