ssh2/test
2005-01-25 17:15:51 +00:00
..
auth.c First checkin of the test suite 2005-01-22 23:11:13 +00:00
forward.c First checkin of the test suite 2005-01-22 23:11:13 +00:00
libssh2-test.h First checkin of the test suite 2005-01-22 23:11:13 +00:00
main.c First checkin of the test suite 2005-01-22 23:11:13 +00:00
Makefile methods now tests all methods separately, and reports which one goes wrong 2005-01-25 05:46:00 +00:00
methods.c Improved error handling 2005-01-25 06:03:16 +00:00
README some more info on the tests done 2005-01-25 17:15:51 +00:00
util.c First checkin of the test suite 2005-01-22 23:11:13 +00:00

This directory contains some code meant to test libssh2's protocol compliance
against other implementations, as well as providing a body of example code.
The following tests are done:

* methods.c:

Tries a connection + authentication with every possible key exchange,
hostkey, encryption, mac and compression method (see
libssh2_session_method_pref()).

The first connection is done with methods that are required to be supported
by server implementations according to the standard: key exchange method
"diffie-hellman-group1-sha1", hostkey method "ssh-dss", encryption method
"3des-cbc", mac method "hmac-sha1" and no compression.

Then every method is tried in turn, with all the other methods set to these
"known good" methods. Hence, the test will report exactly which method of
which method type failed to initialize a connection. A total of 26 tests
is performed.


* auth.c:

This test tries to authenticate with username+pasword, and public/private
key + passphrase. In addition, the hostkey is retrieved in both MD5 and SHA1
formats, and sanity-checked.


* forward.c:

This test tries to make the remote host listen on a port, then requests a
tunnel through the remote host to that port, accepting the connection
locally. A block of data is then sent through the tunnel, and this data is
then compared to the original when received.

This is tried four times: one each for every combination of the remote
host's bind address provided or not, and bind port provided or not.



If you want to add a test, you will need to do the following:

* create a new source file, and add it to the Makefile
* call your main function (runtest_yourtest) from main() in main.c
* at the top of your source file, put:

	#include <libssh2.h>
	#include "libssh2-test.h"

	extern struct authdefs auth;

* call init_test("description of your test", number_of_steps)
* use new_socket() to get a connected socket, and log_line() to log
  errors if your test fails.
* before every step in your test, call increase_progress()
* after every step, if it was successful, call step_successful()
* after your test, print a "\n".