[cs631apue] tcp Failure test failed [tcp file file2]

Jan Schaumann jschauma at stevens.edu
Sat Sep 17 11:21:00 EDT 2016


Runxi Ding <rding6 at stevens.edu> wrote:
 
> rding6 at rainman:~/cs631$ /home/rding6/cs631/a.out file file2
> Unable to open file: No such file or directory
> rding6 at rainman:~/cs631$ echo $?
> 1

This shows that your program returns an error when it tries to copy a
non-existent file.

The test case in the script checks if your program fails when it tries
to copy a file onto itself (albeit by another name).

Read the test script:

 cp ${TEST_FILE} file
 ln file file2
 <your-executable> file file2

That is, it first copies a test file to 'file', then creates a hard link
to file named 'file2'.  Now 'file' and 'file2' are the exact same file
(verify by checking the inode via 'ls -li file file2'), so copying
'file' to 'file2' should return an error, but it looks like your program
does not fail in this case.

-Jan


More information about the cs631apue mailing list