Skip to content

Commit

Permalink
Clarified some issues in the test framework and added example test. #219
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianKunkel committed May 20, 2020
1 parent 48eb188 commit a536649
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 13 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 1 addition & 9 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS = .
SUBDIRS = . test

bin_PROGRAMS = ior mdtest
if USE_CAPS
Expand Down Expand Up @@ -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)
3 changes: 3 additions & 0 deletions src/ior-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions src/ior.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/test/Makefile.am
Original file line number Diff line number Diff line change
@@ -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 changes: 31 additions & 0 deletions src/test/example.c
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit a536649

Please sign in to comment.