예제 #1
0
파일: unit.c 프로젝트: kaleb-himes/wolfssl
int unit_test(int argc, char** argv)
{
    int ret = 0;

    (void)argc;
    (void)argv;

#ifdef WOLFSSL_FORCE_MALLOC_FAIL_TEST
    if (argc > 1) {
        word32 memFailCount = atoi(argv[1]);
        printf("\n--- SET RNG MALLOC FAIL AT %d---\n", memFailCount);
        wolfSSL_SetMemFailCount(memFailCount);
    }
#endif

    printf("starting unit tests...\n");

#if defined(DEBUG_WOLFSSL) && !defined(HAVE_VALGRIND)
    wolfSSL_Debugging_ON();
#endif

#ifdef HAVE_WNR
    if (wc_InitNetRandom(wnrConfig, NULL, 5000) != 0)
        err_sys("Whitewood netRandom global config failed");
#endif /* HAVE_WNR */

#ifndef WOLFSSL_TIRTOS
    ChangeToWolfRoot();
#endif

    ApiTest();

    if ( (ret = HashTest()) != 0){
        printf("hash test failed with %d\n", ret);
        goto exit;
    }

#if !defined(NO_WOLFSSL_CLIENT) && !defined(NO_WOLFSSL_SERVER)
#ifndef SINGLE_THREADED
    if ( (ret = SuiteTest(argc, argv)) != 0){
        printf("suite test failed with %d\n", ret);
        goto exit;
    }
#endif
#endif

    SrpTest();

exit:
#ifdef HAVE_WNR
    if (wc_FreeNetRandom() < 0)
        err_sys("Failed to free netRandom context");
#endif /* HAVE_WNR */

    return ret;
}
예제 #2
0
파일: unit.c 프로젝트: atigyi/wolfssl
int unit_test(int argc, char** argv)
{
    int ret;

    (void)argc;
    (void)argv;
    printf("starting unit tests...\n");

#if defined(DEBUG_WOLFSSL) && !defined(HAVE_VALGRIND)
    wolfSSL_Debugging_ON();
#endif

#ifdef HAVE_WNR
    if (wc_InitNetRandom(wnrConfig, NULL, 5000) != 0)
        err_sys("Whitewood netRandom global config failed");
#endif /* HAVE_WNR */

#ifndef WOLFSSL_TIRTOS
    ChangeToWolfRoot();
#endif

    ApiTest();

    if ( (ret = HashTest()) != 0){
        printf("hash test failed with %d\n", ret);
        return ret;
    }

#ifndef SINGLE_THREADED
    if ( (ret = SuiteTest()) != 0){
        printf("suite test failed with %d\n", ret);
        return ret;
    }
#endif

    SrpTest();

#ifdef HAVE_WNR
    if (wc_FreeNetRandom() < 0)
        err_sys("Failed to free netRandom context");
#endif /* HAVE_WNR */

    return 0;
}
예제 #3
0
int unit_test(int argc, char** argv)
{
    int ret;

    (void)argc;
    (void)argv;
    printf("starting unit tests...\n");

#if defined(DEBUG_WOLFSSL) && !defined(HAVE_VALGRIND)
    wolfSSL_Debugging_ON();
#endif
#ifdef HAVE_CAVIUM
    ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
    if (ret != 0)
        err_sys("Cavium OpenNitroxDevice failed");
#endif /* HAVE_CAVIUM */

#ifndef WOLFSSL_TIRTOS
    ChangeToWolfRoot();
#endif

    ApiTest();

    if ( (ret = HashTest()) != 0){
        printf("hash test failed with %d\n", ret);
        return ret;
    }

#ifndef SINGLE_THREADED
    if ( (ret = SuiteTest()) != 0){
        printf("suite test failed with %d\n", ret);
        return ret;
    }
#endif

    SrpTest();

#ifdef HAVE_CAVIUM
        CspShutdown(CAVIUM_DEV_ID);
#endif

    return 0;
}
예제 #4
0
파일: unit.c 프로젝트: jschanck-si/wolfssl
int unit_test(int argc, char** argv)
{
    int ret;

    (void)argc;
    (void)argv;
    printf("starting unit tests...\n");

#ifdef HAVE_CAVIUM
    ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
    if (ret != 0)
        err_sys("Cavium OpenNitroxDevice failed");
#endif /* HAVE_CAVIUM */

#ifndef WOLFSSL_TIRTOS
    if (CurrentDir("tests") || CurrentDir("_build"))
        ChangeDirBack(1);
    else if (CurrentDir("Debug") || CurrentDir("Release"))
        ChangeDirBack(3);
#endif

    ApiTest();

    if ( (ret = HashTest()) != 0){
        printf("hash test failed with %d\n", ret);
        return ret;
    }

#ifndef SINGLE_THREADED
    if ( (ret = SuiteTest()) != 0){
        printf("suite test failed with %d\n", ret);
        return ret;
    }
#endif

#ifdef HAVE_CAVIUM
        CspShutdown(CAVIUM_DEV_ID);
#endif

    return 0;
}