Con il comando "make test" è possibile eseguire un test dell'applicazione client-server che comprenda praticamente tutte le situazioni in cui la struttura della directory common_dir del server può trovarsi.
Inizialmente vengono creati i seguenti alberi di directory, una per il lato server e l'altra per il lato client.
server_common_dir client_common_dir |-- [Apr 23 8:49] 0_file.c |-- [Apr 23 8:49] 0_file.c |-- [Apr 23 15:50] 1_file.c |-- [Apr 23 15:50] 2_both `-- [Apr 23 15:50] 2_both | `-- [Apr 23 15:50] 3_common-name `-- [Apr 23 15:50] 3_common-name `-- [Apr 23 15:50] 5_dir `-- [Apr 23 8:53] 4_file.c `-- [Apr 23 8:47] 6_file.c
Come si può notare il file 0_file.c è presente nella stessa posizione e con la stessa data di ultima modifica in entrambe le direcory, mentre il file 1_file.c si trova solo nella directory del server. 2_both è una sottodirectory presente sia sul server che sul client, cosí come il nome 3_common-name, che però sul server indica una directory, mentre sul client un file. Inoltre questa directory contiene il file 4_file.c che è nuovo per il client. La directory 5_dir, infine, andrà eliminata.
Lanciando i programmi con i comandi "./server server_common_dir" e "./client localhost client_common_dir", si ottiene il seguente output:
./server: started host: quark [127.0.0.1] prot: 5330 |
|
./server: connected client: 127.0.0.1 port: 1024 |
./client: socket opened server: localhost [127.0.0.1] port: 5330 |
./server: Scanning dir "server_common_dir" ./server: 3 files found. |
./client: Scanning dir "client_common_dir" ./client: 3 files found |
./server: Rcvd: Another file ( 13 bytes) ./server: Rcvd: 0_file.c (256 bytes) |
./client: Send: Another file ( 13 bytes) ./client: Send: 0_file.c (256 bytes) |
./server: Send: Stat ( 13 bytes) |
./client: Rcvd: Stat ( 13 bytes) |
./server: Rcvd: File stat ( 88 bytes) |
./client: Send: File stat ( 88 bytes) |
./server: Send: File updated ( 13 bytes) |
./client: Rcvd: File updated ( 13 bytes) |
./server: Rcvd: Another dir ( 13 bytes) ./server: Rcvd: 2_both (256 bytes) |
./client: Send: Another dir ( 13 bytes) ./client: Send: 2_both (256 bytes) |
./server: Send: New file ( 13 bytes) ./server: Send: 1_file.c (256 bytes) ./server: Send: File stat ( 88 bytes) ./server: Send 6798 bytes data file |
./client: Rcvd: New file ( 13 bytes) ./client: Rcvd: 1_file.c (256 bytes) ./client: Rcvd: File stat ( 88 bytes) ./client: Recv 6798 bytes data file |
./server: Rcvd: Another dir ( 13 bytes) ./server: Rcvd: 2_both (256 bytes) |
./client: Send: Another dir ( 13 bytes) ./client: Send: 2_both (256 bytes) |
./server: Send: Enter dir ( 13 bytes) ./server: Scanning dir "2_both" ./server: 1 files found. |
./client: Rcvd: Enter dir ( 13 bytes) ./client: Scanning dir "2_both" ./client: 1 files found |
./server: Rcvd: Another file ( 13 bytes) ./server: Rcvd: 3_common-name (256 bytes) |
./client: Send: Another file ( 13 bytes) ./client: Send: 3_common-name (256 bytes) |
./server: Send: File removed ( 13 bytes) |
./client: Rcvd: File removed ( 13 bytes) ./client: File "3_common-name" removed |
./server: Rcvd: End of list ( 13 bytes) |
./client: Send: End of list ( 13 bytes) |
./server: Send: New dir ( 13 bytes) ./server: Send: 3_common-name (256 bytes) ./server: Send: File stat ( 88 bytes) ./server: Scanning dir "3_common-name" ./server: 1 files found. |
./client: Rcvd: New dir ( 13 bytes) ./client: Rcvd: 3_common-name (256 bytes) ./client: Rcvd: File stat ( 88 bytes) ./client: Scanning dir "3_common-name" ./client: 0 files found |
./server: Rcvd: End of list ( 13 bytes) |
./client: Send: End of list ( 13 bytes) |
./server: Send: New file ( 13 bytes) ./server: Send: 4_file.c (256 bytes) ./server: Send: File stat ( 88 bytes) ./server: Send 1477 bytes data file |
./client: Rcvd: New file ( 13 bytes) ./client: Rcvd: 4_file.c (256 bytes) ./client: Rcvd: File stat ( 88 bytes) ./client: Recv 1477 bytes data file |
./server: Rcvd: End of list ( 13 bytes) |
./client: Send: End of list ( 13 bytes) |
./server: Send: End of list ( 13 bytes) |
./client: Rcvd: End of list ( 13 bytes) |
./server: Rcvd: End of list ( 13 bytes) |
./client: Send: End of list ( 13 bytes) |
./server: Send: End of list ( 13 bytes) |
./client: Rcvd: End of list ( 13 bytes) |
./server: Rcvd: Another dir ( 13 bytes) |
./client: Send: Another dir ( 13 bytes) |
./server: Send: End of list ( 13 bytes) |
./client: Send: 3_dir (256 bytes) |
./client: Rcvd: End of list ( 13 bytes) ./client: File "6_file.c" removed ./client: Dir "3_dir" removed |
A questo punto la directory del client è stata aggiornata ed il suo contenuto rispecchia fedelmente quella del server.
server_common_dir client_common_dir |-- [Apr 23 8:49] 0_file.c |-- [Apr 23 8:49] 0_file.c |-- [Apr 23 15:50] 1_file.c |-- [Apr 23 15:50] 1_file.c `-- [Apr 23 15:50] 2_both `-- [Apr 23 15:50] 2_both `-- [Apr 23 15:50] 3_common-name `-- [Apr 23 15:50] 3_common-name `-- [Apr 23 8:53] 4_file.c `-- [Apr 23 8:53] 4_file.c