[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: what's a good way to check a file size (as part of a "make check") f
Re: what's a good way to check a file size (as part of a "make check") from automake?
Mon, 26 Dec 2005 17:52:00 -0700
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)
Alexandre Duret-Lutz <address@hidden> writes:
>>>> "EH" == Ed Hartnett <address@hidden> writes:
> EH> Should we just use 'ls -l $file' with sed to parse the output for the
> EH> file size?
> Depending on how portable you want to be, getting the size out of ls -l
> will not be as easy as it seems: see the comments in mdate-sh.
> EH> If so, do we have to check for the existence of ls and sed during the
> EH> configure? Or is going to be found everywhere?
> You can assume them. (configure wouldn't work if they didn't exist.)
> EH> Or is there some more clever way to check the size of a file?
> Sorry for not answering this question (I don't know the answer),
> but why test only the size ? Isn't the contents important too ?
> If the file isn't too big I'd ship the expected result and
> compare it with `cmp'. If it's too big you can still compute a
> checksum to compare.
This is one of many tests. This test is being added because of an
obscure bug that, in very unusual circumstances, a data file can be
truncated, and the fact not noticed by the data library.
So the fix involves a function that checks file sizes.
There are also many, many tests relating to file contents. But for
this test, we care about file size.
Ed Hartnett -- address@hidden