1
1
libssh/tests/unittests/torture_channel.c
Aris Adamantiadis d42a1a35b0 tests: allow conditionnal execution on pattern
Option can be used to filter out irrelevant tests
usage: ./torture_pki '*ed25519'

Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-02 17:34:15 +01:00

51 строка
931 B
C

#define LIBSSH_STATIC
#include <libssh/priv.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "torture.h"
#include "channels.c"
static void torture_channel_select(void **state)
{
fd_set readfds;
int fd;
int rc;
int i;
(void)state; /* unused */
fd = open("/dev/null", 0);
assert_true(fd > 2);
FD_ZERO(&readfds);
FD_SET(fd, &readfds);
for (i = 0; i < 10; i++) {
ssh_channel cin[1] = { NULL, };
ssh_channel cout[1] = { NULL, };
struct timeval tv = { .tv_sec = 0, .tv_usec = 1000 };
rc = ssh_select(cin, cout, fd + 1, &readfds, &tv);
assert_int_equal(rc, SSH_OK);
}
close(fd);
}
int torture_run_tests(void) {
int rc;
UnitTest tests[] = {
unit_test(torture_channel_select),
};
ssh_init();
torture_filter_tests(tests);
rc = run_tests(tests);
ssh_finalize();
return rc;
}