torture: Add torture_teardown_socket_dir().

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2014-04-15 21:50:19 +02:00
parent 13f68fc2d5
commit fd09c4cb29
2 changed files with 26 additions and 0 deletions

View File

@@ -796,6 +796,30 @@ void torture_setup_socket_dir(void **state)
*state = s;
}
void torture_teardown_socket_dir(void **state)
{
struct torture_state *s = *state;
char *env = getenv("TORTURE_SKIP_CLEANUP");
int rc;
if (env != NULL && env[0] == '1') {
fprintf(stderr, ">>> Skipping cleanup of %s\n", s->socket_dir);
} else {
rc = torture_rmdirs(s->socket_dir);
if (rc < 0) {
fprintf(stderr,
"torture_rmdirs(%s) failed: %s",
s->socket_dir,
strerror(errno));
}
}
free(s->socket_dir);
free(s->pcap_file);
free(s->srv_pidfile);
free(s);
}
int torture_libssh_verbosity(void){
return verbosity;
}

View File

@@ -109,6 +109,8 @@ int torture_server_port(void);
void torture_setup_socket_dir(void **state);
void torture_teardown_socket_dir(void **state);
/*
* This function must be defined in every unit test file.
*/