Skip to content

Commit

Permalink
Fixing testplugin tests for server2.
Browse files Browse the repository at this point in the history
  • Loading branch information
jholloc committed Sep 17, 2024
1 parent 12fdb98 commit 1a649b9
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 126 deletions.
2 changes: 1 addition & 1 deletion source/plugins/testplugin/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ test60-62: ENUMLIST structures

plugin: test calling other plugins

error: Error reporting and server termination tests;
error: Error reporting and server termination tests
11 changes: 10 additions & 1 deletion source/plugins/testplugin/testplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ int TestPlugin::test8(UDA_PLUGIN_INTERFACE* plugin_interface)

int TestPlugin::test9(UDA_PLUGIN_INTERFACE* plugin_interface)
{
init_structure_definitions(plugin_interface);

// Create Data

TEST9* data = (TEST9*)malloc(4 * sizeof(TEST9)); // Structured Data Must be a heap variable
Expand Down Expand Up @@ -1340,6 +1342,7 @@ int TestPlugin::test32(UDA_PLUGIN_INTERFACE* plugin_interface)

test32_fields[0] = udaNewCompoundField("count", "int structure element", &offset, UDA_TYPE_INT, 0, nullptr);
int shape[1] = {100};
offset = offsetof(TEST32, coords);
test32_fields[1] = udaNewCompoundUserTypeArrayField("coords", "structure TEST32A", &offset, test32a_type, 1, shape);

USERDEFINEDTYPE* test32_type =
Expand All @@ -1352,8 +1355,9 @@ int TestPlugin::test32(UDA_PLUGIN_INTERFACE* plugin_interface)
TEST32* data = (TEST32*)malloc(data_n * sizeof(TEST32)); // Structured Data Must be a heap variable
udaRegisterMalloc(plugin_interface, (void*)data, data_n, sizeof(TEST32), "TEST32");

constexpr int field_count = 2;
constexpr int field_count = 100;

memset(data, '\0', sizeof(TEST32));
data->count = field_count;

for (int i = 0; i < field_count; i++) {
Expand Down Expand Up @@ -1397,6 +1401,7 @@ int TestPlugin::test33(UDA_PLUGIN_INTERFACE* plugin_interface)
test33_fields[0] = udaNewCompoundField("count", "int structure element", &offset, UDA_TYPE_INT, 0, nullptr);
// int shape[1] = {100};
// test33_fields[1] = udaNewCompoundUserTypeArrayField("coords", "structure TEST33A", &offset, test33a_type, 1, shape);
offset = offsetof(TEST33, coords);
test33_fields[1] = udaNewCompoundUserTypePointerField("coords", "structure TEST33A", &offset, test33a_type);

USERDEFINEDTYPE* test33_type =
Expand Down Expand Up @@ -1442,7 +1447,9 @@ int TestPlugin::test34(UDA_PLUGIN_INTERFACE* plugin_interface)
COMPOUNDFIELD* test34a_fields[2] = {nullptr};
int offset = 0;

offset = offsetof(TEST34A, R);
test34a_fields[0] = udaNewCompoundPointerField("R", "unsigned char structure element", &offset, UDA_TYPE_UNSIGNED_CHAR, false);
offset = offsetof(TEST34A, Z);
test34a_fields[1] = udaNewCompoundPointerField("Z", "unsigned char structure element", &offset, UDA_TYPE_UNSIGNED_CHAR, false);

USERDEFINEDTYPE* test34a_type =
Expand All @@ -1457,7 +1464,9 @@ int TestPlugin::test34(UDA_PLUGIN_INTERFACE* plugin_interface)
COMPOUNDFIELD* test34_fields[2] = {nullptr};
offset = 0;

offset = offsetof(TEST34, count);
test34_fields[0] = udaNewCompoundField("count", "int structure element", &offset, UDA_TYPE_INT, 0, nullptr);
offset = offsetof(TEST34, coords);
test34_fields[1] = udaNewCompoundUserTypePointerField("coords", "structure TEST34A", &offset, test34a_type);

USERDEFINEDTYPE* test34_type =
Expand Down
14 changes: 14 additions & 0 deletions source/server2/get_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,20 @@ int uda::server::Server::get_data(int* depth, RequestData* request_data, DataBlo
return rc; // An Error Occurred
}

// Perform data subsetting if requested

if (request_data->datasubset.nbound > 0) {
UDA_LOG(UDA_LOG_DEBUG, "Calling serverSubsetData (Subset) {}", *depth);
Action action = {};
init_action(&action);
action.actionType = UDA_SUBSET_TYPE;
action.subset = request_data->datasubset;
if ((rc = server_subset_data(data_block, action, _log_malloc_list)) != 0) {
(*depth)--;
return rc;
}
}

//--------------------------------------------------------------------------------------------------------------------------
// If the Request is Not for a Generic Signal then exit - No XML source to apply to data as it is just regular data.
// Allow Composites (C) or Signal Switch (S) through regardless of request type
Expand Down
Loading

0 comments on commit 1a649b9

Please sign in to comment.