libssh2

Форк
0
/
runner.c 
79 строк · 2.6 Кб
1
/* Copyright (C) Alexander Lamaison
2
 * All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms,
5
 * with or without modification, are permitted provided
6
 * that the following conditions are met:
7
 *
8
 *   Redistributions of source code must retain the above
9
 *   copyright notice, this list of conditions and the
10
 *   following disclaimer.
11
 *
12
 *   Redistributions in binary form must reproduce the above
13
 *   copyright notice, this list of conditions and the following
14
 *   disclaimer in the documentation and/or other materials
15
 *   provided with the distribution.
16
 *
17
 *   Neither the name of the copyright holder nor the names
18
 *   of any other contributors may be used to endorse or
19
 *   promote products derived from this software without
20
 *   specific prior written permission.
21
 *
22
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23
 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
34
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
35
 * OF SUCH DAMAGE.
36
 *
37
 * SPDX-License-Identifier: BSD-3-Clause
38
 */
39

40
#include "runner.h"
41

42
int main(void)
43
{
44
    int exit_code;
45
    int retries = 0, retry = 0;
46

47
#ifdef LIBSSH2_WINCNG
48
    /* FIXME: Retry tests with WinCNG due to flakiness in hostkey
49
       verification: https://github.com/libssh2/libssh2/issues/804 */
50
    retries += 2;
51
#endif
52

53
    do {
54
        int skipped, rc;
55
        LIBSSH2_SESSION *session = start_session_fixture(&skipped, &rc);
56
        if(session) {
57
            exit_code = (test(session) == 0) ? 0 : 1;
58
        }
59
        else if(skipped) {
60
            fprintf(stderr, "Test skipped.\n");
61
            exit_code = 0;
62
        }
63
        else {
64
            exit_code = 1;
65
        }
66
        stop_session_fixture();
67
        if(exit_code == 0 ||
68
#ifdef LIBSSH2_WINCNG
69
           rc != LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE ||
70
#endif
71
           ++retry > retries) {
72
            break;
73
        }
74
        fprintf(stderr, "Test failed (%d). Retrying... %d / %d\n",
75
                        rc, retry, retries);
76
    } while(1);
77

78
    return exit_code;
79
}
80

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.