Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature #382, Feature #367, Support #303
- Loading branch information
1 parent
b32e440
commit 40714d7
Showing
32 changed files
with
1,936 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
## | ||
## @brief Test memory limit restarts - server | ||
## | ||
## @file atmisv62.c | ||
## | ||
## ----------------------------------------------------------------------------- | ||
## Enduro/X Middleware Platform for Distributed Transaction Processing | ||
## Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved. | ||
## Copyright (C) 2017-2018, Mavimax, Ltd. All Rights Reserved. | ||
## This software is released under one of the following licenses: | ||
## AGPL or Mavimax's license for commercial use. | ||
## ----------------------------------------------------------------------------- | ||
## AGPL license: | ||
## | ||
## This program is free software; you can redistribute it and/or modify it under | ||
## the terms of the GNU Affero General Public License, version 3 as published | ||
## by the Free Software Foundation; | ||
## | ||
## This program 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 Affero General Public License, version 3 | ||
## for more details. | ||
## | ||
## You should have received a copy of the GNU Affero General Public License along | ||
## with this program; if not, write to the Free Software Foundation, Inc., | ||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
## | ||
## ----------------------------------------------------------------------------- | ||
## A commercial use license is available from Mavimax, Ltd | ||
## contact@mavimax.com | ||
## ----------------------------------------------------------------------------- | ||
## | ||
|
||
cmake_minimum_required(VERSION 2.8) | ||
|
||
# Make sure the compiler can find include files from UBF library | ||
include_directories (${ENDUROX_SOURCE_DIR}/libubf | ||
${ENDUROX_SOURCE_DIR}/include | ||
${ENDUROX_SOURCE_DIR}/libnstd | ||
${ENDUROX_SOURCE_DIR}/ubftest) | ||
|
||
|
||
# Add debug options | ||
# By default if RELEASE_BUILD is not defined, then we run in debug! | ||
IF ($ENV{RELEASE_BUILD}) | ||
# do nothing | ||
ELSE ($ENV{RELEASE_BUILD}) | ||
ADD_DEFINITIONS("-D NDRX_DEBUG") | ||
ENDIF ($ENV{RELEASE_BUILD}) | ||
|
||
# Make sure the linker can find the UBF library once it is built. | ||
link_directories (${ENDUROX_BINARY_DIR}/libubf) | ||
|
||
############################# Test - executables ############################### | ||
add_executable (atmi.sv62 atmisv62.c ../../libatmisrv/rawmain_integra.c) | ||
add_executable (atmiclt62 atmiclt62.c) | ||
################################################################################ | ||
############################# Test - executables ############################### | ||
# Link the executable to the ATMI library & others... | ||
target_link_libraries (atmi.sv62 atmisrvinteg atmi ubf nstd m pthread ${RT_LIB}) | ||
target_link_libraries (atmiclt62 atmiclt atmi ubf nstd m pthread ${RT_LIB}) | ||
|
||
set_target_properties(atmi.sv62 PROPERTIES LINK_FLAGS "$ENV{MYLDFLAGS}") | ||
set_target_properties(atmiclt62 PROPERTIES LINK_FLAGS "$ENV{MYLDFLAGS}") | ||
################################################################################ | ||
|
||
# vim: set ts=4 sw=4 et smartindent: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/** | ||
* @brief Test memory limit restarts - client | ||
* | ||
* @file atmiclt62.c | ||
*/ | ||
/* ----------------------------------------------------------------------------- | ||
* Enduro/X Middleware Platform for Distributed Transaction Processing | ||
* Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved. | ||
* Copyright (C) 2017-2018, Mavimax, Ltd. All Rights Reserved. | ||
* This software is released under one of the following licenses: | ||
* AGPL or Mavimax's license for commercial use. | ||
* ----------------------------------------------------------------------------- | ||
* AGPL license: | ||
* | ||
* This program is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Affero General Public License, version 3 as published | ||
* by the Free Software Foundation; | ||
* | ||
* This program 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 Affero General Public License, version 3 | ||
* for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
* | ||
* ----------------------------------------------------------------------------- | ||
* A commercial use license is available from Mavimax, Ltd | ||
* contact@mavimax.com | ||
* ----------------------------------------------------------------------------- | ||
*/ | ||
#include <string.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <memory.h> | ||
#include <math.h> | ||
|
||
#include <atmi.h> | ||
#include <ubf.h> | ||
#include <ndebug.h> | ||
#include <test.fd.h> | ||
#include <ndrstandard.h> | ||
#include <nstopwatch.h> | ||
#include <fcntl.h> | ||
#include <unistd.h> | ||
#include <nstdutil.h> | ||
#include "test62.h" | ||
/*---------------------------Externs------------------------------------*/ | ||
/*---------------------------Macros-------------------------------------*/ | ||
/*---------------------------Enums--------------------------------------*/ | ||
/*---------------------------Typedefs-----------------------------------*/ | ||
/*---------------------------Globals------------------------------------*/ | ||
/*---------------------------Statics------------------------------------*/ | ||
/*---------------------------Prototypes---------------------------------*/ | ||
|
||
/** | ||
* Do the test call to the server | ||
*/ | ||
int main(int argc, char** argv) | ||
{ | ||
UBFH *p_ub = (UBFH *)tpalloc("UBF", NULL, 56000); | ||
long rsplen; | ||
int ret=EXSUCCEED; | ||
static char *buf = NULL; | ||
int i; | ||
|
||
if (argc < 2) | ||
{ | ||
NDRX_LOG(log_error, "Usage: %s srvrss|srvvsz|cltrss|cltvsz", argv[0]); | ||
EXFAIL_OUT(ret); | ||
} | ||
|
||
/* server tests */ | ||
if (0==strcmp("srvrss", argv[1])) | ||
{ | ||
if (EXFAIL == tpcall("RSSALLOC", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0)) | ||
{ | ||
NDRX_LOG(log_error, "RSSALLOC failed: %s", tpstrerror(tperrno)); | ||
ret=EXFAIL; | ||
goto out; | ||
} | ||
} | ||
else if (0==strcmp("srvvsz", argv[1])) | ||
{ | ||
if (EXFAIL == tpcall("VSZALLOC", (char *)p_ub, 0L, (char **)&p_ub, &rsplen,0)) | ||
{ | ||
NDRX_LOG(log_error, "VSZALLOC failed: %s", tpstrerror(tperrno)); | ||
ret=EXFAIL; | ||
goto out; | ||
} | ||
} | ||
|
||
/* client tests: */ | ||
else if (0==strcmp("cltrss", argv[1])) | ||
{ | ||
/* let system to pick up the pid */ | ||
sleep(20); | ||
if (NULL==buf) | ||
{ | ||
buf = NDRX_MALLOC(RSS_BLOCK); | ||
|
||
if (NULL==buf) | ||
{ | ||
NDRX_LOG(log_error, "TESTERROR ! Failed to alloc %d bytes: %s", | ||
RSS_BLOCK, strerror(errno)); | ||
EXFAIL_OUT(ret); | ||
} | ||
} | ||
|
||
/* store some values there and trick out the kernel not to | ||
* figure out our strategy */ | ||
for (i=0; i<RSS_BLOCK; i++) | ||
{ | ||
buf[i] = i/3; | ||
} | ||
sleep(9999); | ||
} | ||
else if (0==strcmp("cltvsz", argv[1])) | ||
{ | ||
/* let system to pick up the pid */ | ||
sleep(20); | ||
buf = NDRX_MALLOC(VSZ_BLOCK); | ||
if (NULL==buf) | ||
{ | ||
NDRX_LOG(log_error, "TESTERROR ! Failed to alloc %d bytes: %s", | ||
VSZ_BLOCK, strerror(errno)); | ||
EXFAIL_OUT(ret); | ||
} | ||
sleep(9999); | ||
} | ||
else | ||
{ | ||
NDRX_LOG(log_error, "Invalid test case: [%s]", argv[1]); | ||
EXFAIL_OUT(ret); | ||
} | ||
out: | ||
tpterm(); | ||
fprintf(stderr, "Exit with %d\n", ret); | ||
|
||
return ret; | ||
} | ||
|
||
/* vim: set ts=4 sw=4 et smartindent: */ | ||
|
Oops, something went wrong.