| 1 |
Overview. |
| 2 |
|
| 3 |
$ ./configure && make tests |
| 4 |
|
| 5 |
You'll see some progress info. A failure will cause either the make to |
| 6 |
abort or the driver script to report a "FATAL" failure. |
| 7 |
|
| 8 |
The test consists of 2 parts. The first is the file-based tests which is |
| 9 |
driven by the Makefile, and the second is a set of network or proxycommand |
| 10 |
based tests, which are driven by a driver script (test-exec.sh) which is |
| 11 |
called multiple times by the Makefile. |
| 12 |
|
| 13 |
Failures in the first part will cause the Makefile to return an error. |
| 14 |
Failures in the second part will print a "FATAL" message for the failed |
| 15 |
test and continue. |
| 16 |
|
| 17 |
OpenBSD has a system-wide regression test suite. OpenSSH Portable's test |
| 18 |
suite is based on OpenBSD's with modifications. |
| 19 |
|
| 20 |
|
| 21 |
Environment variables. |
| 22 |
|
| 23 |
SKIP_UNIT: Skip unit tests. |
| 24 |
SUDO: path to sudo/doas command, if desired. Note that some systems |
| 25 |
(notably systems using PAM) require sudo to execute some tests. |
| 26 |
LTESTS: Whitespace separated list of tests (filenames without the .sh |
| 27 |
extension) to run. |
| 28 |
SKIP_LTESTS: Whitespace separated list of tests to skip. |
| 29 |
OBJ: used by test scripts to access build dir. |
| 30 |
TEST_SHELL: shell used for running the test scripts. |
| 31 |
TEST_SSH_FAIL_FATAL: set to "yes" to make any failure abort the test |
| 32 |
currently in progress. |
| 33 |
TEST_SSH_PORT: TCP port to be used for the listening tests. |
| 34 |
TEST_SSH_QUIET: set to "yes" to suppress non-fatal output. |
| 35 |
TEST_SSH_SSHD_CONFOPTS: Configuration directives to be added to sshd_config |
| 36 |
before running each test. |
| 37 |
TEST_SSH_SSH_CONFOPTS: Configuration directives to be added to |
| 38 |
ssh_config before running each test. |
| 39 |
TEST_SSH_TRACE: set to "yes" for verbose output from tests |
| 40 |
TEST_SSH_x: path to "ssh" command under test, where x is one of |
| 41 |
SSH, SSHD, SSHAGENT, SSHADD, SSHKEYGEN, SSHKEYSCAN, SFTP or |
| 42 |
SFTPSERVER |
| 43 |
USE_VALGRIND: Run the tests under valgrind memory checker. |
| 44 |
|
| 45 |
|
| 46 |
Individual tests. |
| 47 |
|
| 48 |
You can run an individual test from the top-level Makefile, eg: |
| 49 |
$ make tests LTESTS=agent-timeout |
| 50 |
|
| 51 |
If you need to manipulate the environment more you can invoke test-exec.sh |
| 52 |
directly if you set up the path to find the binaries under test and the |
| 53 |
test scripts themselves, for example: |
| 54 |
|
| 55 |
$ cd regress |
| 56 |
$ PATH=`pwd`/..:$PATH:. TEST_SHELL=/bin/sh sh test-exec.sh `pwd` \ |
| 57 |
agent-timeout.sh |
| 58 |
ok agent timeout test |
| 59 |
|
| 60 |
|
| 61 |
Files. |
| 62 |
|
| 63 |
test-exec.sh: the main test driver. Sets environment, creates config files |
| 64 |
and keys and runs the specified test. |
| 65 |
|
| 66 |
At the time of writing, the individual tests are: |
| 67 |
connect.sh: simple connect |
| 68 |
proxy-connect.sh: proxy connect |
| 69 |
connect-privsep.sh: proxy connect with privsep |
| 70 |
connect-uri.sh: uri connect |
| 71 |
proto-version.sh: sshd version with different protocol combinations |
| 72 |
proto-mismatch.sh: protocol version mismatch |
| 73 |
exit-status.sh: remote exit status |
| 74 |
envpass.sh: environment passing |
| 75 |
transfer.sh: transfer data |
| 76 |
banner.sh: banner |
| 77 |
rekey.sh: rekey |
| 78 |
stderr-data.sh: stderr data transfer |
| 79 |
stderr-after-eof.sh: stderr data after eof |
| 80 |
broken-pipe.sh: broken pipe test |
| 81 |
try-ciphers.sh: try ciphers |
| 82 |
yes-head.sh: yes pipe head |
| 83 |
login-timeout.sh: connect after login grace timeout |
| 84 |
agent.sh: simple connect via agent |
| 85 |
agent-getpeereid.sh: disallow agent attach from other uid |
| 86 |
agent-timeout.sh: agent timeout test |
| 87 |
agent-ptrace.sh: disallow agent ptrace attach |
| 88 |
keyscan.sh: keyscan |
| 89 |
keygen-change.sh: change passphrase for key |
| 90 |
keygen-convert.sh: convert keys |
| 91 |
keygen-moduli.sh: keygen moduli |
| 92 |
key-options.sh: key options |
| 93 |
scp.sh: scp |
| 94 |
scp-uri.sh: scp-uri |
| 95 |
sftp.sh: basic sftp put/get |
| 96 |
sftp-chroot.sh: sftp in chroot |
| 97 |
sftp-cmds.sh: sftp command |
| 98 |
sftp-badcmds.sh: sftp invalid commands |
| 99 |
sftp-batch.sh: sftp batchfile |
| 100 |
sftp-glob.sh: sftp glob |
| 101 |
sftp-perm.sh: sftp permissions |
| 102 |
sftp-uri.sh: sftp-uri |
| 103 |
ssh-com-client.sh: connect with ssh.com client |
| 104 |
ssh-com-keygen.sh: ssh.com key import |
| 105 |
ssh-com-sftp.sh: basic sftp put/get with ssh.com server |
| 106 |
ssh-com.sh: connect to ssh.com server |
| 107 |
reconfigure.sh: simple connect after reconfigure |
| 108 |
dynamic-forward.sh: dynamic forwarding |
| 109 |
forwarding.sh: local and remote forwarding |
| 110 |
multiplex.sh: connection multiplexing |
| 111 |
reexec.sh: reexec tests |
| 112 |
brokenkeys.sh: broken keys |
| 113 |
sshcfgparse.sh: ssh config parse |
| 114 |
cfgparse.sh: sshd config parse |
| 115 |
cfgmatch.sh: sshd_config match |
| 116 |
cfgmatchlisten.sh: sshd_config matchlisten |
| 117 |
addrmatch.sh: address match |
| 118 |
localcommand.sh: localcommand |
| 119 |
forcecommand.sh: forced command |
| 120 |
portnum.sh: port number parsing |
| 121 |
keytype.sh: login with different key types |
| 122 |
kextype.sh: login with different key exchange algorithms |
| 123 |
cert-hostkey.sh certified host keys |
| 124 |
cert-userkey.sh: certified user keys |
| 125 |
host-expand.sh: expand %h and %n |
| 126 |
keys-command.sh: authorized keys from command |
| 127 |
forward-control.sh: sshd control of local and remote forwarding |
| 128 |
integrity.sh: integrity |
| 129 |
krl.sh: key revocation lists |
| 130 |
multipubkey.sh: multiple pubkey |
| 131 |
limit-keytype.sh: restrict pubkey type |
| 132 |
hostkey-agent.sh: hostkey agent |
| 133 |
keygen-knownhosts.sh: ssh-keygen known_hosts |
| 134 |
hostkey-rotate.sh: hostkey rotate |
| 135 |
principals-command.sh: authorized principals command |
| 136 |
cert-file.sh: ssh with certificates |
| 137 |
cfginclude.sh: config include |
| 138 |
allow-deny-users.sh: AllowUsers/DenyUsers |
| 139 |
authinfo.sh: authinfo |
| 140 |
|
| 141 |
|
| 142 |
Problems? |
| 143 |
|
| 144 |
Run the failing test with shell tracing (-x) turned on: |
| 145 |
$ PATH=`pwd`/..:$PATH:. sh -x test-exec.sh `pwd` agent-timeout.sh |
| 146 |
|
| 147 |
Failed tests can be difficult to diagnose. Suggestions: |
| 148 |
- run the individual test via ./test-exec.sh `pwd` [testname] |
| 149 |
- set LogLevel to VERBOSE in test-exec.sh and enable syslogging of |
| 150 |
auth.debug (eg to /var/log/authlog). |
| 151 |
|
| 152 |
|
| 153 |
Known Issues. |
| 154 |
|
| 155 |
- Similarly, if you do not have "scp" in your system's $PATH then the |
| 156 |
multiplex scp tests will fail (since the system's shell startup scripts |
| 157 |
will determine where the shell started by sshd will look for scp). |
| 158 |
|
| 159 |
- Recent GNU coreutils deprecate "head -[n]": this will cause the yes-head |
| 160 |
test to fail. The old behaviour can be restored by setting (and |
| 161 |
exporting) _POSIX2_VERSION=199209 before running the tests. |