2011-07-27 00:27:22 +04:00
|
|
|
/* testsuite.c
|
|
|
|
*
|
2014-04-12 01:58:58 +04:00
|
|
|
* Copyright (C) 2006-2014 wolfSSL Inc.
|
2011-07-27 00:27:22 +04:00
|
|
|
*
|
|
|
|
* This file is part of CyaSSL.
|
|
|
|
*
|
|
|
|
* CyaSSL is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* CyaSSL is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2014-04-12 01:58:58 +04:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2011-07-27 00:27:22 +04:00
|
|
|
*/
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2011-08-25 03:37:16 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
2011-08-05 02:42:55 +04:00
|
|
|
|
2013-04-10 23:17:23 +04:00
|
|
|
#include <cyassl/ctaocrypt/settings.h>
|
|
|
|
|
2011-08-26 01:28:57 +04:00
|
|
|
#include <cyassl/test.h>
|
2012-09-20 10:38:41 +04:00
|
|
|
#include "ctaocrypt/test/test.h"
|
|
|
|
|
2014-02-12 06:59:20 +04:00
|
|
|
#ifndef SINGLE_THREADED
|
|
|
|
|
|
|
|
#include <cyassl/openssl/ssl.h>
|
|
|
|
#include <cyassl/ctaocrypt/sha256.h>
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2012-09-20 10:38:41 +04:00
|
|
|
#include "examples/echoclient/echoclient.h"
|
|
|
|
#include "examples/echoserver/echoserver.h"
|
|
|
|
#include "examples/server/server.h"
|
2013-03-28 22:28:38 +04:00
|
|
|
#include "examples/client/client.h"
|
2011-02-05 22:14:47 +03:00
|
|
|
|
|
|
|
|
2012-09-21 02:39:15 +04:00
|
|
|
void file_test(const char* file, byte* hash);
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2013-03-27 09:00:39 +04:00
|
|
|
void simple_test(func_args*);
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
enum {
|
|
|
|
NUMARGS = 3
|
|
|
|
};
|
|
|
|
|
2014-01-29 00:22:16 +04:00
|
|
|
#ifndef USE_WINDOWS_API
|
2014-03-02 23:06:41 +04:00
|
|
|
static const char outputName[] = "/tmp/output";
|
2014-01-29 00:22:16 +04:00
|
|
|
#else
|
2014-03-02 23:06:41 +04:00
|
|
|
static const char outputName[] = "output";
|
2014-01-29 00:22:16 +04:00
|
|
|
#endif
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2012-08-02 04:33:49 +04:00
|
|
|
int myoptind = 0;
|
|
|
|
char* myoptarg = NULL;
|
|
|
|
|
2014-05-09 22:55:59 +04:00
|
|
|
|
2014-05-09 02:52:20 +04:00
|
|
|
#ifndef NO_TESTSUITE_MAIN_DRIVER
|
2014-05-09 22:55:59 +04:00
|
|
|
|
|
|
|
static int testsuite_test(int argc, char** argv);
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
return testsuite_test(argc, argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* NO_TESTSUITE_MAIN_DRIVER */
|
|
|
|
|
2014-05-09 02:52:20 +04:00
|
|
|
|
|
|
|
int testsuite_test(int argc, char** argv)
|
2011-02-05 22:14:47 +03:00
|
|
|
{
|
|
|
|
func_args server_args;
|
|
|
|
|
|
|
|
tcp_ready ready;
|
|
|
|
THREAD_TYPE serverThread;
|
|
|
|
|
2013-02-02 00:21:38 +04:00
|
|
|
#ifdef HAVE_CAVIUM
|
|
|
|
int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
|
|
|
|
if (ret != 0)
|
|
|
|
err_sys("Cavium OpenNitroxDevice failed");
|
|
|
|
#endif /* HAVE_CAVIUM */
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
StartTCP();
|
|
|
|
|
2013-03-27 09:00:39 +04:00
|
|
|
server_args.argc = argc;
|
|
|
|
server_args.argv = argv;
|
2011-06-16 22:46:45 +04:00
|
|
|
|
|
|
|
CyaSSL_Init();
|
2013-01-05 03:52:46 +04:00
|
|
|
#if defined(DEBUG_CYASSL) && !defined(HAVE_VALGRIND)
|
2011-06-16 22:46:45 +04:00
|
|
|
CyaSSL_Debugging_ON();
|
|
|
|
#endif
|
2011-09-24 03:13:02 +04:00
|
|
|
|
2014-09-09 06:40:03 +04:00
|
|
|
#if !defined(CYASSL_TIRTOS)
|
2014-01-29 00:22:16 +04:00
|
|
|
if (CurrentDir("testsuite") || CurrentDir("_build"))
|
2011-09-24 03:13:02 +04:00
|
|
|
ChangeDirBack(1);
|
2013-12-19 04:16:35 +04:00
|
|
|
else if (CurrentDir("Debug") || CurrentDir("Release"))
|
|
|
|
ChangeDirBack(3); /* Xcode->Preferences->Locations->Locations*/
|
|
|
|
/* Derived Data Advanced -> Custom */
|
|
|
|
/* Relative to Workspace, Build/Products */
|
|
|
|
/* Debug or Release */
|
2014-05-09 02:52:20 +04:00
|
|
|
#endif
|
|
|
|
|
2014-09-09 06:40:03 +04:00
|
|
|
#ifdef CYASSL_TIRTOS
|
|
|
|
fdOpenSession(Task_self());
|
2014-05-09 02:52:20 +04:00
|
|
|
#endif
|
|
|
|
|
2013-03-27 09:00:39 +04:00
|
|
|
server_args.signal = &ready;
|
|
|
|
InitTcpReady(&ready);
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
/* CTaoCrypt test */
|
2013-03-27 09:00:39 +04:00
|
|
|
ctaocrypt_test(&server_args);
|
|
|
|
if (server_args.return_code != 0) return server_args.return_code;
|
2011-02-05 22:14:47 +03:00
|
|
|
|
|
|
|
/* Simple CyaSSL client server test */
|
2013-03-27 09:00:39 +04:00
|
|
|
simple_test(&server_args);
|
2011-02-05 22:14:47 +03:00
|
|
|
if (server_args.return_code != 0) return server_args.return_code;
|
|
|
|
|
|
|
|
/* Echo input yaSSL client server test */
|
|
|
|
start_thread(echoserver_test, &server_args, &serverThread);
|
|
|
|
wait_tcp_ready(&server_args);
|
|
|
|
{
|
|
|
|
func_args echo_args;
|
|
|
|
char* myArgv[NUMARGS];
|
|
|
|
|
|
|
|
char argc0[32];
|
|
|
|
char argc1[32];
|
|
|
|
char argc2[32];
|
|
|
|
|
|
|
|
myArgv[0] = argc0;
|
|
|
|
myArgv[1] = argc1;
|
|
|
|
myArgv[2] = argc2;
|
|
|
|
|
2014-02-12 05:56:59 +04:00
|
|
|
echo_args.argc = 3;
|
2011-02-05 22:14:47 +03:00
|
|
|
echo_args.argv = myArgv;
|
|
|
|
|
|
|
|
strcpy(echo_args.argv[0], "echoclient");
|
|
|
|
strcpy(echo_args.argv[1], "input");
|
2014-01-29 00:22:16 +04:00
|
|
|
strcpy(echo_args.argv[2], outputName);
|
|
|
|
remove(outputName);
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2013-03-27 09:00:39 +04:00
|
|
|
/* Share the signal, it has the new port number in it. */
|
|
|
|
echo_args.signal = server_args.signal;
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
/* make sure OK */
|
|
|
|
echoclient_test(&echo_args);
|
|
|
|
if (echo_args.return_code != 0) return echo_args.return_code;
|
|
|
|
|
|
|
|
#ifdef CYASSL_DTLS
|
|
|
|
wait_tcp_ready(&server_args);
|
|
|
|
#endif
|
|
|
|
/* send quit to echoserver */
|
|
|
|
echo_args.argc = 2;
|
|
|
|
strcpy(echo_args.argv[1], "quit");
|
|
|
|
|
|
|
|
echoclient_test(&echo_args);
|
|
|
|
if (echo_args.return_code != 0) return echo_args.return_code;
|
|
|
|
join_thread(serverThread);
|
|
|
|
if (server_args.return_code != 0) return server_args.return_code;
|
|
|
|
}
|
|
|
|
|
2014-08-15 21:56:38 +04:00
|
|
|
/* show ciphers */
|
|
|
|
{
|
|
|
|
char ciphers[1024];
|
|
|
|
XMEMSET(ciphers, 0, sizeof(ciphers));
|
|
|
|
CyaSSL_get_ciphers(ciphers, sizeof(ciphers)-1);
|
|
|
|
printf("ciphers = %s\n", ciphers);
|
|
|
|
}
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
/* validate output equals input */
|
|
|
|
{
|
2013-03-12 03:07:46 +04:00
|
|
|
byte input[SHA256_DIGEST_SIZE];
|
|
|
|
byte output[SHA256_DIGEST_SIZE];
|
2011-02-05 22:14:47 +03:00
|
|
|
|
|
|
|
file_test("input", input);
|
2014-01-29 00:22:16 +04:00
|
|
|
file_test(outputName, output);
|
2011-02-05 22:14:47 +03:00
|
|
|
if (memcmp(input, output, sizeof(input)) != 0)
|
2011-08-25 02:54:58 +04:00
|
|
|
return EXIT_FAILURE;
|
2011-02-05 22:14:47 +03:00
|
|
|
}
|
|
|
|
|
2011-06-09 00:19:39 +04:00
|
|
|
CyaSSL_Cleanup();
|
2011-02-05 22:14:47 +03:00
|
|
|
FreeTcpReady(&ready);
|
|
|
|
|
2014-09-09 06:40:03 +04:00
|
|
|
#ifdef CYASSL_TIRTOS
|
|
|
|
fdCloseSession(Task_self());
|
2014-05-09 02:52:20 +04:00
|
|
|
#endif
|
2014-05-09 22:55:59 +04:00
|
|
|
|
2013-02-02 00:21:38 +04:00
|
|
|
#ifdef HAVE_CAVIUM
|
|
|
|
CspShutdown(CAVIUM_DEV_ID);
|
|
|
|
#endif
|
2011-02-05 22:14:47 +03:00
|
|
|
printf("\nAll tests passed!\n");
|
2011-08-25 02:54:58 +04:00
|
|
|
return EXIT_SUCCESS;
|
2011-02-05 22:14:47 +03:00
|
|
|
}
|
|
|
|
|
2013-03-27 09:00:39 +04:00
|
|
|
void simple_test(func_args* args)
|
|
|
|
{
|
|
|
|
THREAD_TYPE serverThread;
|
|
|
|
|
|
|
|
func_args svrArgs;
|
2014-02-12 05:56:59 +04:00
|
|
|
char *svrArgv[9];
|
2013-03-27 09:00:39 +04:00
|
|
|
char argc0s[32];
|
|
|
|
char argc1s[32];
|
|
|
|
char argc2s[32];
|
2014-02-12 05:56:59 +04:00
|
|
|
char argc3s[32];
|
|
|
|
char argc4s[32];
|
|
|
|
char argc5s[32];
|
|
|
|
char argc6s[32];
|
|
|
|
char argc7s[32];
|
|
|
|
char argc8s[32];
|
2013-03-27 09:00:39 +04:00
|
|
|
|
|
|
|
func_args cliArgs;
|
|
|
|
char *cliArgv[NUMARGS];
|
|
|
|
char argc0c[32];
|
|
|
|
char argc1c[32];
|
|
|
|
char argc2c[32];
|
|
|
|
|
|
|
|
svrArgv[0] = argc0s;
|
|
|
|
svrArgv[1] = argc1s;
|
|
|
|
svrArgv[2] = argc2s;
|
2014-02-12 05:56:59 +04:00
|
|
|
svrArgv[3] = argc3s;
|
|
|
|
svrArgv[4] = argc4s;
|
|
|
|
svrArgv[5] = argc5s;
|
|
|
|
svrArgv[6] = argc6s;
|
|
|
|
svrArgv[7] = argc7s;
|
|
|
|
svrArgv[8] = argc8s;
|
2013-03-27 09:00:39 +04:00
|
|
|
cliArgv[0] = argc0c;
|
|
|
|
cliArgv[1] = argc1c;
|
|
|
|
cliArgv[2] = argc2c;
|
|
|
|
|
|
|
|
svrArgs.argc = 1;
|
|
|
|
svrArgs.argv = svrArgv;
|
|
|
|
svrArgs.return_code = 0;
|
|
|
|
cliArgs.argc = 1;
|
|
|
|
cliArgs.argv = cliArgv;
|
|
|
|
cliArgs.return_code = 0;
|
|
|
|
|
|
|
|
strcpy(svrArgs.argv[0], "SimpleServer");
|
2014-05-09 02:52:20 +04:00
|
|
|
#if !defined(USE_WINDOWS_API) && !defined(CYASSL_SNIFFER) && \
|
2014-09-09 06:40:03 +04:00
|
|
|
!defined(CYASSL_TIRTOS)
|
2014-02-12 05:56:59 +04:00
|
|
|
strcpy(svrArgs.argv[svrArgs.argc++], "-p");
|
|
|
|
strcpy(svrArgs.argv[svrArgs.argc++], "0");
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NTRU
|
|
|
|
strcpy(svrArgs.argv[svrArgs.argc++], "-d");
|
|
|
|
strcpy(svrArgs.argv[svrArgs.argc++], "-n");
|
|
|
|
strcpy(svrArgs.argv[svrArgs.argc++], "-c");
|
|
|
|
strcpy(svrArgs.argv[svrArgs.argc++], "./certs/ntru-cert.pem");
|
|
|
|
strcpy(svrArgs.argv[svrArgs.argc++], "-k");
|
|
|
|
strcpy(svrArgs.argv[svrArgs.argc++], "./certs/ntru-key.raw");
|
2013-03-27 09:00:39 +04:00
|
|
|
#endif
|
|
|
|
/* Set the last arg later, when it is known. */
|
|
|
|
|
|
|
|
args->return_code = 0;
|
|
|
|
svrArgs.signal = args->signal;
|
|
|
|
start_thread(server_test, &svrArgs, &serverThread);
|
|
|
|
wait_tcp_ready(&svrArgs);
|
|
|
|
|
|
|
|
/* Setting the actual port number. */
|
|
|
|
strcpy(cliArgs.argv[0], "SimpleClient");
|
|
|
|
#ifndef USE_WINDOWS_API
|
|
|
|
cliArgs.argc = NUMARGS;
|
|
|
|
strcpy(cliArgs.argv[1], "-p");
|
2013-03-27 21:22:50 +04:00
|
|
|
snprintf(cliArgs.argv[2], sizeof(argc2c), "%d", svrArgs.signal->port);
|
2013-03-27 09:00:39 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
client_test(&cliArgs);
|
|
|
|
if (cliArgs.return_code != 0) {
|
|
|
|
args->return_code = cliArgs.return_code;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
join_thread(serverThread);
|
|
|
|
if (svrArgs.return_code != 0) args->return_code = svrArgs.return_code;
|
|
|
|
}
|
2011-02-05 22:14:47 +03:00
|
|
|
|
|
|
|
|
|
|
|
void wait_tcp_ready(func_args* args)
|
|
|
|
{
|
2013-05-02 00:17:11 +04:00
|
|
|
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
2011-02-05 22:14:47 +03:00
|
|
|
pthread_mutex_lock(&args->signal->mutex);
|
|
|
|
|
|
|
|
if (!args->signal->ready)
|
|
|
|
pthread_cond_wait(&args->signal->cond, &args->signal->mutex);
|
|
|
|
args->signal->ready = 0; /* reset */
|
|
|
|
|
|
|
|
pthread_mutex_unlock(&args->signal->mutex);
|
2013-05-02 00:17:11 +04:00
|
|
|
#else
|
|
|
|
(void)args;
|
2011-02-05 22:14:47 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread)
|
|
|
|
{
|
2013-05-02 00:17:11 +04:00
|
|
|
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
2011-02-05 22:14:47 +03:00
|
|
|
pthread_create(thread, 0, fun, args);
|
2011-08-25 02:54:58 +04:00
|
|
|
return;
|
2014-09-09 06:40:03 +04:00
|
|
|
#elif defined(CYASSL_TIRTOS)
|
2014-05-09 02:52:20 +04:00
|
|
|
/* Initialize the defaults and set the parameters. */
|
|
|
|
Task_Params taskParams;
|
|
|
|
Task_Params_init(&taskParams);
|
|
|
|
taskParams.arg0 = (UArg)args;
|
|
|
|
taskParams.stackSize = 65535;
|
|
|
|
*thread = Task_create((Task_FuncPtr)fun, &taskParams, NULL);
|
|
|
|
if (*thread == NULL) {
|
|
|
|
printf("Failed to create new Task\n");
|
|
|
|
}
|
|
|
|
Task_yield();
|
2011-08-25 02:54:58 +04:00
|
|
|
#else
|
|
|
|
*thread = (THREAD_TYPE)_beginthreadex(0, 0, fun, args, 0, 0);
|
2011-02-05 22:14:47 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void join_thread(THREAD_TYPE thread)
|
|
|
|
{
|
2013-05-02 00:17:11 +04:00
|
|
|
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
2011-08-25 02:54:58 +04:00
|
|
|
pthread_join(thread, 0);
|
2014-09-09 06:40:03 +04:00
|
|
|
#elif defined(CYASSL_TIRTOS)
|
2014-05-09 02:52:20 +04:00
|
|
|
while(1) {
|
|
|
|
if (Task_getMode(thread) == Task_Mode_TERMINATED) {
|
|
|
|
Task_sleep(5);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
Task_yield();
|
|
|
|
}
|
2011-08-25 02:54:58 +04:00
|
|
|
#else
|
2013-05-02 00:17:11 +04:00
|
|
|
int res = WaitForSingleObject((HANDLE)thread, INFINITE);
|
2011-02-05 22:14:47 +03:00
|
|
|
assert(res == WAIT_OBJECT_0);
|
2013-05-02 00:17:11 +04:00
|
|
|
res = CloseHandle((HANDLE)thread);
|
2011-02-05 22:14:47 +03:00
|
|
|
assert(res);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InitTcpReady(tcp_ready* ready)
|
|
|
|
{
|
|
|
|
ready->ready = 0;
|
2013-03-27 09:00:39 +04:00
|
|
|
ready->port = 0;
|
2013-05-02 00:17:11 +04:00
|
|
|
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
2011-08-25 02:54:58 +04:00
|
|
|
pthread_mutex_init(&ready->mutex, 0);
|
|
|
|
pthread_cond_init(&ready->cond, 0);
|
2011-02-05 22:14:47 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FreeTcpReady(tcp_ready* ready)
|
|
|
|
{
|
2013-05-02 00:17:11 +04:00
|
|
|
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
2011-02-05 22:14:47 +03:00
|
|
|
pthread_mutex_destroy(&ready->mutex);
|
|
|
|
pthread_cond_destroy(&ready->cond);
|
2013-05-02 00:17:11 +04:00
|
|
|
#else
|
|
|
|
(void)ready;
|
2011-02-05 22:14:47 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-09-21 02:39:15 +04:00
|
|
|
void file_test(const char* file, byte* check)
|
2011-02-05 22:14:47 +03:00
|
|
|
{
|
|
|
|
FILE* f;
|
2014-03-26 04:11:15 +04:00
|
|
|
int i = 0, j, ret;
|
2013-03-12 03:07:46 +04:00
|
|
|
Sha256 sha256;
|
2011-02-05 22:14:47 +03:00
|
|
|
byte buf[1024];
|
2013-03-12 03:07:46 +04:00
|
|
|
byte shasum[SHA256_DIGEST_SIZE];
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2014-03-26 04:11:15 +04:00
|
|
|
ret = InitSha256(&sha256);
|
|
|
|
if (ret != 0) {
|
|
|
|
printf("Can't InitSha256 %d\n", ret);
|
|
|
|
return;
|
|
|
|
}
|
2011-02-05 22:14:47 +03:00
|
|
|
if( !( f = fopen( file, "rb" ) )) {
|
|
|
|
printf("Can't open %s\n", file);
|
|
|
|
return;
|
|
|
|
}
|
2014-04-08 18:42:31 +04:00
|
|
|
while( ( i = (int)fread(buf, 1, sizeof(buf), f )) > 0 ) {
|
|
|
|
ret = Sha256Update(&sha256, buf, i);
|
|
|
|
if (ret != 0) {
|
|
|
|
printf("Can't Sha256Update %d\n", ret);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2014-04-08 18:42:31 +04:00
|
|
|
ret = Sha256Final(&sha256, shasum);
|
|
|
|
if (ret != 0) {
|
|
|
|
printf("Can't Sha256Final %d\n", ret);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-11-27 06:40:43 +04:00
|
|
|
memcpy(check, shasum, sizeof(shasum));
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2013-03-12 03:07:46 +04:00
|
|
|
for(j = 0; j < SHA256_DIGEST_SIZE; ++j )
|
2012-11-27 06:40:43 +04:00
|
|
|
printf( "%02x", shasum[j] );
|
2011-02-05 22:14:47 +03:00
|
|
|
|
|
|
|
printf(" %s\n", file);
|
|
|
|
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-12 06:59:20 +04:00
|
|
|
#else /* SINGLE_THREADED */
|
|
|
|
|
|
|
|
|
|
|
|
int myoptind = 0;
|
|
|
|
char* myoptarg = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
func_args server_args;
|
|
|
|
|
|
|
|
server_args.argc = argc;
|
|
|
|
server_args.argv = argv;
|
|
|
|
|
|
|
|
if (CurrentDir("testsuite") || CurrentDir("_build"))
|
|
|
|
ChangeDirBack(1);
|
|
|
|
else if (CurrentDir("Debug") || CurrentDir("Release"))
|
|
|
|
ChangeDirBack(3); /* Xcode->Preferences->Locations->Locations*/
|
|
|
|
/* Derived Data Advanced -> Custom */
|
|
|
|
/* Relative to Workspace, Build/Products */
|
|
|
|
/* Debug or Release */
|
|
|
|
|
|
|
|
ctaocrypt_test(&server_args);
|
|
|
|
if (server_args.return_code != 0) return server_args.return_code;
|
|
|
|
|
|
|
|
printf("\nAll tests passed!\n");
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* SINGLE_THREADED */
|
|
|
|
|