Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ runs:
if [[ "01234567" == *"${JOBID}"* ]]; then export PDI_PLUGIN_PATH=/tmp/pdi_plugins; fi
export MAKEFLAGS='-j 4'
export CTEST_FLAGS="--output-junit /tmp/tests.xml"
export TEST_DIR="/tmp_dir_test"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is related to the CI, which breaks regularly.
Does this need a dedicated PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily for me, but is this directory always available. Shouldn't you then mount a tmpdir to ensure it's available?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily for me, but is this directory always available. Shouldn't you then mount a tmpdir to ensure it's available?

@JAuriac

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not include this change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TEST_DIR is necessary for another ongoing PR, which includes a fix.
#543 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. We will wait for the no-pdi PR first.
Anyway, if I exclude this change, the CI will not run, thus the PR can not be approved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what's the status, should this change remain in this PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will be overwritten by the no-pdi PR, where we use export CTEST_DIR="/tmp", so this change does not have to remain in this PR.

/src/bin/build_and_run_all_tests
EOF
docker run \
Expand Down
1 change: 1 addition & 0 deletions plugins/decl_netcdf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Removed

### Fixed
* Bug(typo) fixed: Config error raised when using the scalar format for the yaml write configuration.

### Security

Expand Down
8 changes: 5 additions & 3 deletions plugins/decl_netcdf/dnc_file_context.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (C) 2015-2024 Commissariat a l'energie atomique et aux energies alternatives (CEA)
* Copyright (C) 2015-2025 Commissariat a l'energie atomique et aux energies alternatives (CEA)
* Copyright (C) 2019-2021 Institute of Bioorganic Chemistry Polish Academy of Science (PSNC)
* All rights reserved.
*
Expand Down Expand Up @@ -127,7 +127,7 @@ Dnc_file_context::Dnc_file_context(PDI::Context& ctx, PC_tree_t config)

PC_tree_t write_node = PC_get(config, ".write");
if (!PC_status(write_node)) {
if (PDI::is_scalar(read_node)) {
if (PDI::is_scalar(write_node)) {
std::string write_desc = PDI::to_string(write_node);
m_ctx.logger().trace("Creating new empty write info for: {}", write_desc);
m_write.emplace(write_desc, Dnc_io{this->m_ctx, PC_tree_t{}});
Expand All @@ -138,12 +138,14 @@ Dnc_file_context::Dnc_file_context(PDI::Context& ctx, PC_tree_t config)
m_ctx.logger().trace("Creating new empty write info for: {}", write_desc);
m_write.emplace(write_desc, Dnc_io{this->m_ctx, PC_tree_t{}});
}
} else {
} else if (PDI::is_map(write_node)) {
PDI::each(write_node, [this](PC_tree_t desc_name, PC_tree_t write_value) {
std::string write_desc = PDI::to_string(desc_name);
m_ctx.logger().trace("Creating new write info for: {}", write_desc);
this->m_write.emplace(PDI::to_string(desc_name), Dnc_io{this->m_ctx, write_value});
});
} else {
throw PDI::Error{PDI_ERR_CONFIG, "write node is not parsed correctly"};
}
}

Expand Down
48 changes: 45 additions & 3 deletions plugins/decl_netcdf/tests/decl_netcdf_tests.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (C) 2020-2021 Institute of Bioorganic Chemistry Polish Academy of Science (PSNC)
* Copyright (C) 2024 Commissariat a l'energie atomique et aux energies alternatives (CEA)
* Copyright (C) 2024-2025 Commissariat a l'energie atomique et aux energies alternatives (CEA)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -680,7 +680,7 @@ TEST(decl_netcdf_test, 06)
" \n"
"plugins: \n"
" decl_netcdf: \n"
" - file: 'test_07.nc' \n"
" - file: 'test_06.nc' \n"
" on_event: 'write' \n"
" variables: \n"
" int_matrix_var: \n"
Expand All @@ -694,7 +694,7 @@ TEST(decl_netcdf_test, 06)
" variable_selection: \n"
" start: ['$iter', 0, 0] \n"
" subsize: [1, 8, 8] \n"
" - file: 'test_07.nc' \n"
" - file: 'test_06.nc' \n"
" on_event: 'read' \n"
" variables: \n"
" int_matrix_var: \n"
Expand Down Expand Up @@ -739,6 +739,48 @@ TEST(decl_netcdf_test, 06)
PDI_finalize();
}

/*
* Name: decl_netcdf_test.07
*
* Description: Tests yaml syntaxe with `write: data`
*/
TEST(decl_netcdf_test, 07)
{
const char* CONFIG_YAML
= "logging: trace \n"
"data: \n"
" int_matrix: \n"
" type: array \n"
" subtype: int \n"
" size: [8, 8] \n"
" \n"
"plugins: \n"
" decl_netcdf: \n"
" - file: 'test_07.nc' \n"
" on_event: 'write' \n"
" write: int_matrix \n";

// Use the null error handle explicitly. Otherwise, the error is not captured.
// Need further investigation
PDI_errhandler(PDI_NULL_HANDLER);

ASSERT_EQ(PDI_OK, PDI_init(PC_parse_string(CONFIG_YAML)));

int int_matrix[8][8];

// init data
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
int_matrix[i][j] = 100 + i * 8 + j;
}
}

// write data
ASSERT_EQ(PDI_OK, PDI_multi_expose("write", "int_matrix", int_matrix, PDI_OUT, NULL));

PDI_finalize();
}

/*
* Name: decl_netcdf_test.size_of
*
Expand Down
Loading