Clarified some issues in the test framework and added example test. #219
parent
48eb1880e9
commit
a536649abb
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue