This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add expandargv test to libiberty testsuite.
On Thu, Nov 24, 2005 at 09:23:24AM -0500, DJ Delorie wrote:
> I was thinking something like this:
>
> const char *test_data[] = {
> "data to write\nto some file N"
> "data to write to\r\nsome file N+1",
> 0, /* ends list of files */
> "argv[1]",
> "@argv[2]",
> 0, /* ends list of "before" command line */
> "argv[1]",
> "argv[2]",
> "argv[3]",
> 0, /* ends list of "after" command line */
> "start\bof\bsecond\btest\b",
> ...
> 0,
> 0
> };
>
> The test would just cycle through the whole array, building and
> running tests as it found them. Testing for \0 might be tricky; we'd
> have to have some hook that says "When you see \b, write \0". Output
> files would have predetermined names, like "file1.txt" through
> "fileN.txt" so the tests can put the right @file in.
Yes, the "\0" is definately something that needs a special case.
I think that is probably the only consideration in a test setup like
this.
Is the test assumed to write the data files to the current directory?
> This way, we avoid the problem of checking binary files into cvs/svn
> (cr/lf conversions happen by accident a lot) and keep everything in
> one source file. It also lets us comment the test cases.
Sounds good then. I'll code that up this weekend.
Cheers,
Carlos.