Re: [PATCH 6/6] Add a simple test script, embed expected results into test files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Damien Lespiau wrote:
> A small update,
> 
>> Yes, but I still prefer the delimited format for readability.
> 
> Ok: expected output is now between check-output-start / check-output-end
> tags.
> I've added a clean-check target in the Makefile, updated the provided
> test-cases and documentation.

Thanks!  Will review and apply soon.

>> You can't redirect two things independently to the same file; that will
>> open the file twice, and the writes will conflict, giving exactly the
>> result you saw.  > o 2>&1 should work; it has exactly the same effect as
>> &> .
> 
> For some reason I was expecting that:
> 
> [pid  8877] open("o", O_WRONLY|O_CREAT|O_TRUNC| \
>         O_LARGEFILE, 0666) = 3
> [pid  8877] dup2(3, 1)                  = 1
> [pid  8877] close(3)                    = 0
> [pid  8877] open("o", O_WRONLY|O_CREAT|O_TRUNC| \
>         O_LARGEFILE, 0666) = 3
> [pid  8877] dup2(3, 2)                  = 2
> [pid  8877] close(3)                    = 0
> 
> and
> 
> [pid 10777] open("o", O_WRONLY|O_CREAT|O_TRUNC| \
>         O_LARGEFILE, 0666) = 3
> [pid 10777] dup2(3, 1)                  = 1
> [pid 10777] close(3)                    = 0
> [pid 10777] dup2(1, 2)                  = 2
> 
> followed by:
> 
> [pid  xxxxx] write(2, "validation/preprocessor19.c:4:9:"..., 73) = 73
> [pid  xxxxx] write(2, "validation/preprocessor19.c:3:9:"..., 66) = 66
> [pid  xxxxx] write(1, "\ny\n", 3)        = o
> 
> to give the same result and that the first one would not eat characters.

In the first case, fd 1 and fd 2 represent separate open files, and have
independent file offsets; thus, writes through the two file descriptors
overwrite each other.  In the second case, fd 1 and fd 2 represent the same
open file, and have the same file offset, so writes to either one appear in
the file in sequence.

- Josh Triplett

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux