Skip to content

Commit

Permalink
further test development
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jul 4, 2019
1 parent 100af62 commit d9014ad
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/clib/pio.h
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,8 @@ extern "C" {
int nc_init_intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, int rearr,
int *iosysidp);

int nc_free_iosystem(int iosysid);

#if defined(__cplusplus)
}
#endif
Expand Down
14 changes: 13 additions & 1 deletion src/ncint/ncint_pio.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#include <pio_internal.h>
#include "ncintdispatch.h"

/* The default io system id. */
extern int diosysid;

/**
* Same as PIOc_Init_Intracomm().
*
Expand All @@ -19,7 +22,16 @@ int
nc_init_intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, int rearr,
int *iosysidp)
{
return PIOc_Init_Intracomm(comp_comm, num_iotasks, stride, base, rearr, iosysidp);
int ret;

if ((ret = PIOc_Init_Intracomm(comp_comm, num_iotasks, stride, base, rearr,
iosysidp)))
return ret;

/* Remember the io system id. */
diosysid = *iosysidp;

return PIO_NOERR;
}

/**
Expand Down
26 changes: 18 additions & 8 deletions src/ncint/ncintdispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "config.h"
#include <stdlib.h>
#include "ncintdispatch.h"
#include "pio.h"

/* This is the dispatch object that holds pointers to all the
* functions that make up the NCINT dispatch interface. */
Expand Down Expand Up @@ -128,41 +129,50 @@ NC_NCINT_finalize(void)
return NC_NOERR;
}

/** Default iosysid. */
int diosysid;

#define TEST_VAL_42 42
int
NC_NCINT_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
void *parameters, const NC_Dispatch *dispatch, NC *nc_file)
void *parameters, const NC_Dispatch *dispatch, NC *nc_file)
{
return NC_NOERR;
int ret;
nc_file->int_ncid = nc_file->ext_ncid;

if ((ret = PIOc_open(diosysid, path, mode, &nc_file->ext_ncid)))
return ret;

return NC_NOERR;
}

int
NC_NCINT_abort(int ncid)
{
return TEST_VAL_42;
return TEST_VAL_42;
}

int
NC_NCINT_close(int ncid, void *v)
{
return NC_NOERR;
return NC_NOERR;
}

int
NC_NCINT_inq_format(int ncid, int *formatp)
{
return TEST_VAL_42;
return TEST_VAL_42;
}

int
NC_NCINT_inq_format_extended(int ncid, int *formatp, int *modep)
{
return TEST_VAL_42;
return TEST_VAL_42;
}

int
NC_NCINT_get_vara(int ncid, int varid, const size_t *start, const size_t *count,
void *value, nc_type t)
void *value, nc_type t)
{
return TEST_VAL_42;
return TEST_VAL_42;
}
10 changes: 5 additions & 5 deletions tests/ncint/tst_pio_udf.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ main(int argc, char **argv)
if (nc_open(FILE_NAME, NC_UDF0, &ncid)) ERR;
if (nc_close(ncid)) ERR;

/* Open file again and abort, which is the same as closing it. */
if (nc_open(FILE_NAME, NC_UDF0, &ncid)) ERR;
if (nc_inq_format(ncid, NULL) != TEST_VAL_42) ERR;
if (nc_inq_format_extended(ncid, NULL, NULL) != TEST_VAL_42) ERR;
if (nc_abort(ncid) != TEST_VAL_42) ERR;
/* /\* Open file again and abort, which is the same as closing it. *\/ */
/* if (nc_open(FILE_NAME, NC_UDF0, &ncid)) ERR; */
/* if (nc_inq_format(ncid, NULL) != TEST_VAL_42) ERR; */
/* if (nc_inq_format_extended(ncid, NULL, NULL) != TEST_VAL_42) ERR; */
/* if (nc_abort(ncid) != TEST_VAL_42) ERR; */

/* Close the iosystem. */
if (nc_free_iosystem(iosysid)) ERR;
Expand Down

0 comments on commit d9014ad

Please sign in to comment.