diff --git a/configure.ac b/configure.ac index 0cb99c48..cd71b396 100755 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index 1c37a6e3..3786560f 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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) diff --git a/src/ior-internal.h b/src/ior-internal.h index 7daf8de6..9cc8406b 100644 --- a/src/ior-internal.h +++ b/src/ior-internal.h @@ -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; diff --git a/src/ior.c b/src/ior.c index c831a84f..2237cc3d 100755 --- a/src/ior.c +++ b/src/ior.c @@ -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; diff --git a/src/test/Makefile.am b/src/test/Makefile.am new file mode 100755 index 00000000..1f2b1413 --- /dev/null +++ b/src/test/Makefile.am @@ -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 diff --git a/src/test/example.c b/src/test/example.c new file mode 100644 index 00000000..5bb4b2b5 --- /dev/null +++ b/src/test/example.c @@ -0,0 +1,31 @@ +#include + +#include +#include + +// 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; +}