Skip to content

Rust::com Integration test cases for Rust COM-API#237

Merged
castler merged 8 commits intoeclipse-score:mainfrom
bharatGoswami8:integration_test_cases
Apr 9, 2026
Merged

Rust::com Integration test cases for Rust COM-API#237
castler merged 8 commits intoeclipse-score:mainfrom
bharatGoswami8:integration_test_cases

Conversation

@bharatGoswami8
Copy link
Copy Markdown
Contributor

  • Added integration test cases to verify data type and size of type for primitive and user defined struct

@bharatGoswami8 bharatGoswami8 self-assigned this Mar 25, 2026
@bharatGoswami8 bharatGoswami8 force-pushed the integration_test_cases branch 4 times, most recently from 9b2c413 to 297ffad Compare March 26, 2026 08:45
@bharatGoswami8 bharatGoswami8 marked this pull request as draft March 26, 2026 11:04
@bharatGoswami8 bharatGoswami8 force-pushed the integration_test_cases branch 3 times, most recently from 982dc4b to d5ff26c Compare March 31, 2026 04:41
@bharatGoswami8 bharatGoswami8 marked this pull request as ready for review March 31, 2026 04:41
@bharatGoswami8 bharatGoswami8 force-pushed the integration_test_cases branch from d5ff26c to 69394d6 Compare March 31, 2026 04:52
@bharatGoswami8 bharatGoswami8 changed the title Rust::com Integration test cases for COM-API using rust-test Rust::com Integration test cases for Rust COM-API Mar 31, 2026
name = "filesystem",
deps = [
"//score/mw/com/test/com_api/consumer_async_apis:bigdata-com-api-async-pkg",
"//score/mw/com/test/basic_rust_api/consumer_async_apis:bigdata-com-api-async-pkg",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Question: what basic_rust_api means?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it is a folder name where we kept rust com api related integration tests, keeping name com-api is so generic.

// Test for primitive and complex data types, used in the com-api integration tests.

// Macro to generate data types with CommData impl with Eq trait
macro_rules! define_type {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Imo the macro should be changed slightly to be closer to the regular struct definition of Rust. This makes the code more readable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added the struct literal on macro parameter.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems picky but why #[eq] and not #[derive($($trait:name),+)]? This way, you a) stick to the conventions of Rust and b) enable extra traits to be derived.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added suggest changes.

};

// Macro to generate interface classes
#define CREATE_INTERFACE(ClassName, DataType, EventName) \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Imo the definition of a macro isn't worth the deduplication. Please remove this one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed and changed to each interface class.


match args.test_case {
// The bigdata test uses the `BigDataInterface` and its `map_api_lanes_stamped_` event.
TestCase::Bigdata => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please move the match arms to separate functions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.


match args.test_case {
// The bigdata test uses the `BigDataInterface` and its `map_api_lanes_stamped_` event.
TestCase::Bigdata => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move match arms to separate functions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.

// Test for primitive and complex data types, used in the com-api integration tests.

// Macro to generate data types with CommData impl with Eq trait
macro_rules! define_type {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems picky but why #[eq] and not #[derive($($trait:name),+)]? This way, you a) stick to the conventions of Rust and b) enable extra traits to be derived.

Comment on lines +110 to +116
#[repr(C)]
pub struct $name {
$(pub $field: $field_type,)*
}
impl CommData for $name {
const ID: &'static str = stringify!($name);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This could be deduplicated by introducing another macro. You can forward a whole AST part by using the tt matcher, along with the list of derive traits.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, added helper macro define_com_type_impl.

// Test for primitive and complex data types, used in the com-api integration tests.

// Macro to generate data types with CommData impl with Eq trait
macro_rules! define_type {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

define_type is super super generic. Can you change the name to reflect what its doing with that type? E.g. define_com_type?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@bharatGoswami8 bharatGoswami8 force-pushed the integration_test_cases branch 2 times, most recently from 20ca61b to 5c83fbc Compare April 8, 2026 14:12
* Added integration test cases to verify data type and size of type for primitive and user defined struct
* Created macro for primitive and user-defined struct
* created macro for genrated files
* Updated one test case for all the primitive types
* Updated complex struct test case
* Updated test cases and data types
@bharatGoswami8 bharatGoswami8 force-pushed the integration_test_cases branch from 5c83fbc to 63d9c6f Compare April 8, 2026 15:42
@castler castler added this pull request to the merge queue Apr 9, 2026
Merged via the queue into eclipse-score:main with commit 5c233a9 Apr 9, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants