1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-29 13:01:13 +03:00

Link benchmark code statically with libssh

benchmark code present in tests/benchmarks/ directory
was linked with libssh dynamically due to which it
could use only the functions exposed in the public API
of libssh.

To be able to use those functions in the benchmark
code which are a part of libssh api but not a part of
the public api for libssh (examples of such functions
are ssh_list api functions), the benchmark code needs
to be linked statically to libssh.

Signed-off-by: Eshan Kelkar <eshankelkar@galorithm.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Eshan Kelkar
2023-06-01 21:10:19 +05:30
committed by Sahana Prasad
parent 08a8bd936c
commit be0c558bcc
2 changed files with 16 additions and 2 deletions

View File

@ -19,6 +19,8 @@
* MA 02111-1307, USA.
*/
#define LIBSSH_STATIC
#include "config.h"
#include "benchmarks.h"
#include <libssh/libssh.h>
@ -390,7 +392,7 @@ int main(int argc, char **argv)
{
struct argument_s arguments;
ssh_session session = NULL;
int i;
int i, r;
arguments_init(&arguments);
cmdline_parse(argc, argv, &arguments);
@ -427,6 +429,12 @@ int main(int argc, char **argv)
fprintf(stdout,"\n");
}
r = ssh_init();
if (r == SSH_ERROR) {
fprintf(stderr, "Failed to initialize libssh\n");
return EXIT_FAILURE;
}
for (i = 0; i < arguments.nhosts; ++i) {
if (arguments.verbose > 0)
fprintf(stdout, "Connecting to \"%s\"...\n", arguments.hosts[i]);
@ -447,6 +455,12 @@ int main(int argc, char **argv)
ssh_free(session);
}
r = ssh_finalize();
if (r == SSH_ERROR) {
fprintf(stderr, "Failed to finalize libssh\n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}