Hi everyone,
We need to set up some rules for the build/run system, to make the testing of your software suitable for automation.
Here's the basic rules, pasted from the assignment spec:
"Starting your server Your server must accept three command line arguments:
the IP address on which it will listen for client connections - we provide this in case the host where your server is running has multiple network interface cards and so it can listen on several different IP addresses.
the port
the directory where it will keep the files created by the clients
The file system Your server will store files created and written by client transactions in the directory specified on startup as a command line argument. When the server starts up, that directory may already contain some files (we could put some files there for testing). You must ensure that the files in that directory are not deleted after the server exits. We will use the contents in those files to check the correctness of your system.
Since your server is statefull, it probably needs to keep a log or records helping it to remember its state. Make sure that those housekeeping logs are hidden from view on the server's file system (recall how Unix implements hidden files). Those files must be deleted every time the server exits gracefully. (If the server exits gracefully it is okay for it to forget about any transactions executed in the past.)
Committing file data to stable storage When the client asks the server to commit a transaction, the server must ensure that the transaction data is flushed to disk on the local file system. Using the"write" system call (if you are programming in C) is not enough to accomplish this. If you remember from your operating systems course, the "write" system call puts the data into file system buffer cache, but does not force it to disk. Therefore, you must explicitly flush the data to disk when committing client transactions or when writing important housekeeping messages that must survive crashes. To flush thedata to disk, use the fsync (or fflush) system call. To tell you the truth, even fsync or fflush will not guarantee that the data is forced to disk: many operating systems return from fsync before the data is flushed to disk, while flushing the data on the background. To really flush the data to disk, you must call fsync (or fflush) twice.
If you are programming in a language other than C or C++ you must find out the equivalent to the fsync system call."
In addition to this, I will expect your directory to contain a bash script called build.sh and a script called run.sh:
build.sh - Builds the server program. The output filenames of your build don't really matter, because you need to have:
run.sh - Runs the server. This script needs to accept the arguments as stated in the specification. So, I will run your scripts with the following:
<your-dir>/build.sh
<your-dir>/run.sh <ip-address> <port> <directory>
Making these scripts will take 5 minutes of your time. Failing to make them will cause you to lose some points (not too much, but it's a motivating factor).
Next up: I will provide a test harness you can use to verify your server against some simple use cases. Stay tuned.
Cheers,
Svetozar