Clarified some issues in the test framework and added example test. #219

master
Julian M. Kunkel 2020-05-20 17:46:35 +01:00
parent 48eb1880e9
commit a536649abb
6 changed files with 46 additions and 13 deletions

View File

@ -348,6 +348,7 @@ AM_CONDITIONAL([USE_CAPS], [test x$enable_caps = xyes])
AC_CONFIG_FILES([Makefile
src/Makefile
src/test/Makefile
contrib/Makefile
doc/Makefile])
AC_OUTPUT

View File

@ -1,4 +1,4 @@
SUBDIRS = .
SUBDIRS = . test
bin_PROGRAMS = ior mdtest
if USE_CAPS
@ -123,11 +123,3 @@ MDTEST_CPPFLAGS = $(mdtest_CPPFLAGS)
libaiori_a_SOURCES += $(extraSOURCES)
libaiori_a_CPPFLAGS = $(extraCPPFLAGS)
TESTS = testlib
bin_PROGRAMS += testlib
testlib_SOURCES = ./test/lib.c
testlib_LDFLAGS = $(extraLDFLAGS)
testlib_LDADD = libaiori.a $(extraLDADD)

View File

@ -26,6 +26,9 @@ void PrintTestEnds();
void PrintTableHeader();
/* End of ior-output */
IOR_offset_t *GetOffsetArraySequential(IOR_param_t * test, int pretendRank);
IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank, int access);
struct results {
double min;
double max;

View File

@ -1731,8 +1731,7 @@ static void ValidateTests(IOR_param_t * test)
* @param pretendRank int pretended Rank for shifting the offsest corectly
* @return IOR_offset_t
*/
static IOR_offset_t *GetOffsetArraySequential(IOR_param_t * test,
int pretendRank)
IOR_offset_t *GetOffsetArraySequential(IOR_param_t * test, int pretendRank)
{
IOR_offset_t i, j, k = 0;
IOR_offset_t offsets;
@ -1781,8 +1780,7 @@ static IOR_offset_t *GetOffsetArraySequential(IOR_param_t * test,
* @return IOR_offset_t
* @return
*/
static IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank,
int access)
IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank, int access)
{
int seed;
IOR_offset_t i, value, tmp;

8
src/test/Makefile.am Executable file
View File

@ -0,0 +1,8 @@
LDFLAGS = $(extraLDFLAGS)
LDADD = ../libaiori.a $(extraLDADD)
# Add test here
TESTS = testlib testexample
check_PROGRAMS = $(TESTS)
testexample_SOURCES = example.c
testlib_SOURCES = lib.c

31
src/test/example.c Normal file
View File

@ -0,0 +1,31 @@
#include <assert.h>
#include <ior.h>
#include <ior-internal.h>
// build a single test via, e.g., mpicc example.c -I ../src/ ../src/libaiori.a -lm
int main(){
IOR_param_t test;
init_IOR_Param_t(& test);
test.blockSize = 10;
test.transferSize = 10;
test.segmentCount = 5;
test.numTasks = 2;
// having an individual file
test.filePerProc = 1;
IOR_offset_t * offsets;
offsets = GetOffsetArraySequential(& test, 0);
assert(offsets[0] == 0);
assert(offsets[1] == 10);
assert(offsets[2] == 20);
assert(offsets[3] == 30);
assert(offsets[4] == 40);
// for(int i = 0; i < test.segmentCount; i++){
// printf("%lld\n", (long long int) offsets[i]);
// }
printf("OK\n");
return 0;
}