Michal Vasko | 77fad15 | 2016-02-03 15:36:15 +0100 | [diff] [blame^] | 1 | /** |
| 2 | * \file test_init_destroy_ssh_tls.c |
| 3 | * \author Michal Vasko <mvasko@cesnet.cz> |
| 4 | * \brief libnetconf2 tests - libssh with libssl/libcrypto init/destroy |
| 5 | * |
| 6 | * Copyright (c) 2015 CESNET, z.s.p.o. |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions |
| 10 | * are met: |
| 11 | * 1. Redistributions of source code must retain the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer. |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer in |
| 15 | * the documentation and/or other materials provided with the |
| 16 | * distribution. |
| 17 | * 3. Neither the name of the Company nor the names of its contributors |
| 18 | * may be used to endorse or promote products derived from this |
| 19 | * software without specific prior written permission. |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | #include <errno.h> |
| 24 | #include <fcntl.h> |
| 25 | #include <pthread.h> |
| 26 | #include <setjmp.h> |
| 27 | #include <stdarg.h> |
| 28 | #include <stddef.h> |
| 29 | #include <stdint.h> |
| 30 | #include <stdlib.h> |
| 31 | #include <unistd.h> |
| 32 | #include <string.h> |
| 33 | #include <sys/stat.h> |
| 34 | #include <sys/types.h> |
| 35 | #include <sys/socket.h> |
| 36 | |
| 37 | #include <cmocka.h> |
| 38 | #include <libyang/libyang.h> |
| 39 | |
| 40 | #include "config.h" |
| 41 | #include <netconf.h> |
| 42 | |
| 43 | static int |
| 44 | setup_ssh_tls(void **state) |
| 45 | { |
| 46 | (void)state; |
| 47 | |
| 48 | nc_ssh_tls_init(); |
| 49 | |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | static int |
| 54 | teardown_ssh_tls(void **state) |
| 55 | { |
| 56 | (void)state; |
| 57 | |
| 58 | nc_ssh_tls_destroy(); |
| 59 | |
| 60 | return 0; |
| 61 | } |
| 62 | |
| 63 | static void |
| 64 | test_dummy(void **state) |
| 65 | { |
| 66 | (void)state; |
| 67 | } |
| 68 | |
| 69 | int |
| 70 | main(void) |
| 71 | { |
| 72 | const struct CMUnitTest init_destroy[] = { |
| 73 | cmocka_unit_test_setup_teardown(test_dummy, setup_ssh_tls, teardown_ssh_tls) |
| 74 | }; |
| 75 | |
| 76 | return cmocka_run_group_tests(init_destroy, NULL, NULL); |
| 77 | } |
| 78 | |