diff --git a/.github/workflows/ci_dustdds.yml b/.github/workflows/ci_dustdds.yml new file mode 100644 index 0000000..73f82cf --- /dev/null +++ b/.github/workflows/ci_dustdds.yml @@ -0,0 +1,31 @@ +name: CI DustDDS + +on: + workflow_dispatch: + pull_request: + paths: + - 'src/rs/DustDDS/**' + +jobs: + create_bin_release: + name: Create binary release + runs-on: ubuntu-latest + defaults: + run: + working-directory: src/rs/DustDDS + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Build executable + run: cargo build --package dust_dds_test_main --release + - name: Rename executable + run: | + version=$( cargo tree --package dust_dds --depth 0 --prefix none | grep -oP '(?<=v)[0-9]+\.[0-9]+\.[0-9]+' ) + cp ./target/release/dust_dds_test_main ./dust_dds-${version}_test_main_linux + mkdir artifacts + zip --junk-paths artifacts/dust_dds-${version}_test_main_linux.zip ./dust_dds-${version}_test_main_linux + - name: Upload executable artifact + uses: actions/upload-artifact@v4 + with: + name: interoperability_executable + path: src/rs/DustDDS/artifacts/ diff --git a/.gitignore b/.gitignore index dac6903..eadb392 100644 --- a/.gitignore +++ b/.gitignore @@ -78,3 +78,6 @@ doc/detailed_report.rst doc/test_results.rst test_description.rst doc/test_description.rst + +# Rust target files +target/ diff --git a/CLA/CLA_S2E_Software_Systems.md b/CLA/CLA_S2E_Software_Systems.md new file mode 100644 index 0000000..3bc747e --- /dev/null +++ b/CLA/CLA_S2E_Software_Systems.md @@ -0,0 +1,60 @@ +# OMG DDS INTEROPERABILITY REPOSITORY - CONTRIBUTOR LICENSE AGREEMENT + +**This Contributor License Agreement ("Agreement") specifies the terms under which the individual or corporate entity specified in the signature block below (“You”) agree to make intellectual property contributions to the OMG DDS Interoperability Repository. BY SIGNING BELOW YOU ARE AGREEING TO BE BOUND BY THE TERMS OF THIS AGREEMENT. If You are signing this Agreement in Your capacity as an employee, THEN YOUR EMPLOYER AND YOU ARE BOTH BOUND BY THIS AGREEMENT.** + +1. Definitions + + 1. "OMG DDS Xtypes Interoperability Repository" (or “Repository”) means the Git repository [https://github.com/omg-dds/dds-xtypes](https://github.com/omg-dds/dds-xtypes). + + 2. "Moderator" means an entity or individual responsible for authorizing changes to the Repository. + + 3. "Submit" (or “Submitted”) means any submission, including source code, binaries, code, pull requests, issue reports, comments, etc., made to the Moderators for inclusion in the Repository either through the Git repository interface or through electronic file transfer. + + 4. A "Contribution" is any original work of authorship, including any modifications or additions to an existing work, that You Submit to the DDS Interoperability Repository. + + 5. A "User" is anyone who accesses the Repository. + +2. Allowable Contribution Representations + + 1. You represent that You have the necessary rights to the Contribution(s) to meet the obligations of this Agreement. If You are employed, Your employer has authorized Contribution(s) under this Agreement. + + 2. You represent that you have no knowledge of third-party intellectual property rights that are likely to be infringed by the Contribution(s). You represent that you have no knowledge that such infringement or any allegation of misappropriation of intellectual property rights is likely to be claimed or has already been claimed. + +3. License + + You grant Moderators a perpetual, worldwide, non-exclusive, assignable, paid-up license to publish, display, and redistribute the Contribution as part of the Repository. You also license to Moderators under the same terms any other intellectual property rights required to publish, display, and redistribute the Contributions as part of the Repository. You further grant all Users of the Repository a license to the Contribution under the terms of the [OMG DDS Interoperability Testing License](../LICENSE.md) included in the Repository. Moderators are under no obligation to publish Contributions. + +4. No Warranty, Consequential Damages. Limited Liability + + Other than explicitly stated herein, You provide the Contribution(s) "as is" with no warranty nor claims of fitness to any purpose. Neither party shall be liable for consequential or special damages of any kind. Other than for breach of warranty or representations herein, the liability of either party to the other shall be limited to $1000. + +5. General + + 1. If You are an agency of the United States Government, then this Agreement will be governed by the United States federal common law. Otherwise, this Agreement will be governed by the laws of the State of California except with regard to its choice of law rules. + + 2. A party may assign this Agreement to an entity acquiring essentially all of the party’s relevant business. + +6. Electronic Signatures + + "Electronic Signature" means any electronic sound, symbol, or process attached to or logically associated with a record and executed and adopted by a party with the intent to sign such record. + + Each party agrees that the Electronic Signatures, whether digital or encrypted, of the parties included in this Agreement are intended to authenticate this writing and to have the same force and effect as manual signatures. + + +IN WITNESS WHEREOF, You, intending to be legally bound, have executed this Agreement or caused Your employer’s proper and duly authorized officer to execute and deliver this Agreement, for good and valuable consideration, the sufficiency of which is hereby acknowledged, as of the day and year first written below. + +**For:** + +Entity Name: S2E Software Systems B.V. + +Address: St. Jacobstraat 125, 3511 BP Utrecht, The Netherlands + + ("**You**") + +**By:** + +Name: Stefan Kimmer + +Title: Director + +Date: May 22, 2026 diff --git a/src/rs/DustDDS/Cargo.toml b/src/rs/DustDDS/Cargo.toml new file mode 100644 index 0000000..099fba6 --- /dev/null +++ b/src/rs/DustDDS/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "dust_dds_test_main" +version = "0.1.0" +description = "OMG DDS_XTYPES Interoperability" +edition = "2024" +rust-version = "1.87" + +[dependencies] +clap = { version = "4.5.47", features = ["derive", "string"] } +ctrlc = "3.4" +dust_dds = { version = "0.16.0", git = "https://github.com/s2e-systems/dust-dds", branch = "main", features = [ + "xtypes-xml", +] } diff --git a/src/rs/DustDDS/src/main.rs b/src/rs/DustDDS/src/main.rs new file mode 100644 index 0000000..642d0e9 --- /dev/null +++ b/src/rs/DustDDS/src/main.rs @@ -0,0 +1,668 @@ +use clap::{Parser, ValueEnum}; +use ctrlc; +use dust_dds::{ + domain::{ + domain_participant::DomainParticipant, + domain_participant_factory::DomainParticipantFactory, + domain_participant_listener::DomainParticipantListener, + }, + infrastructure::{ + error::DdsError, + listener::NO_LISTENER, + qos::{DataReaderQos, DataWriterQos, PublisherQos, QosKind, SubscriberQos}, + qos_policy::{ + self, DataRepresentationQosPolicy, DurabilityQosPolicy, HistoryQosPolicy, + HistoryQosPolicyKind, OwnershipQosPolicy, OwnershipQosPolicyKind, + OwnershipStrengthQosPolicy, PartitionQosPolicy, ReliabilityQosPolicy, + XCDR_DATA_REPRESENTATION, XCDR2_DATA_REPRESENTATION, + }, + sample_info::{ANY_INSTANCE_STATE, ANY_SAMPLE_STATE, ANY_VIEW_STATE}, + status::{NO_STATUS, StatusKind}, + time::DurationKind, + }, + publication::data_writer::DataWriter, + subscription::data_reader::DataReader, + xtypes::{ + dynamic_type::DynamicData, + dynamic_type::DynamicDataFactory, + dynamic_type::{DynamicType, DynamicTypeBuilderFactory}, + }, +}; +use std::{ + fmt::Debug, + process::{ExitCode, Termination}, + sync::mpsc::Receiver, +}; + +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] +#[clap(rename_all = "kebab_case")] +enum TypeConsistencyArg { + /// True + T, + /// False + F, + /// Default + D, +} + +#[derive(Parser, Clone)] +#[command(author, version, about, long_about = None)] +struct Options { + /// domain id (default: 0) + #[clap(short = 'd', default_value_t = 0)] + domain_id: i32, + + /// BEST_EFFORT reliability + #[clap(short = 'b', default_value_t = false)] + best_effort_reliability: bool, + + /// RELIABLE reliability + #[clap(short = 'r', default_value_t = false)] + reliable_reliability: bool, + + /// keep history depth [0: KEEP_ALL] + #[clap(short = 'k', default_value_t = -1, allow_negative_numbers = true)] + history_depth: i32, + + /// set a 'deadline' with interval (seconds) [0: OFF] + #[clap(short = 'f', default_value_t = 0)] + deadline_interval: u64, + + /// apply 'time based filter' with interval (seconds) [0: OFF] + #[clap(short = 'i', default_value_t = 0)] + timebasedfilter_interval: u64, + + /// set ownership strength [-1: SHARED] + #[clap(short = 's', default_value_t = -1, allow_negative_numbers = true)] + ownership_strength: i32, + + /// set the topic name + #[clap(short = 't')] + topic_name: Option, + + /// set the type name + #[clap(short = 'y')] + type_name: Option, + + /// set a 'partition' string + #[clap(short = 'p')] + partition: Option, + + /// set durability [v: VOLATILE, l: TRANSIENT_LOCAL, t: TRANSIENT, p: PERSISTENT] + #[clap(short = 'D', default_value_t = 'v')] + durability_kind: char, + + /// publish samples + #[clap(short = 'P', default_value_t = false)] + publish: bool, + + /// subscribe samples + #[clap(short = 'S', default_value_t = false)] + subscribe: bool, + + /// set data representation [1: XCDR, 2: XCDR2] + #[clap(short = 'x', default_value_t = 1)] + data_representation: u16, + + /// folder containing type definitions (eg: types) + #[clap(long)] + type_folder: Option, + + /// type definition file name without extension + #[clap(long)] + type_file: Option, + + /// folder containing data samples (eg: data) + #[clap(long)] + data_folder: Option, + + /// data sample file name without extension + #[clap(long)] + data_file: Option, + + /// print Publisher's samples + #[clap(short = 'w', default_value_t = false)] + print_writer_samples: bool, + + /// enable, disable or default value for type_consistency.force_type_validation + #[clap(long)] + force_type_validation: Option, + + /// enable, disable or default value for type_consistency.ignore_member_names + #[clap(long)] + ignore_member_names: Option, + + /// enable, disable or default value for type_consistency.ignore_sequence_bounds + #[clap(long)] + ignore_seq_bounds: Option, + + /// enable, disable or default value for type_consistency.ignore_string_bounds + #[clap(long)] + ignore_str_bounds: Option, + + /// enable, disable or default value for type_consistency.prevent_type_widening + #[clap(long)] + prevent_type_widening: Option, + + /// enable, disable type coercion or default value for type_consistency.kind + #[clap(long)] + allow_type_coercion: Option, + + /// disable sending the type info for type assignability + #[clap(long, default_value_t = false)] + disable_type_info: bool, + + /// set the Type Object version to use. Default: 2. + #[clap(long, default_value_t = 2)] + type_object_version: u32, + + /// print typeid (TypeObjectV1) or equivalence hash (TypeObjectV2) + #[clap(long, default_value_t = false)] + print_typeid: bool, + + /// set log message verbosity [e: ERROR, d: DEBUG] + #[clap(short = 'v', default_value_t = 'e')] + log_message_verbosity: char, +} + +impl Options { + fn validate(&self) -> Result<(), ParsingError> { + if self.topic_name.is_none() { + return Err(ParsingError( + "topic name unspecified [-t], using \"test\" by default".to_string(), + )); + } + if self.type_name.is_none() { + return Err(ParsingError("please specify type name [-y]".to_string())); + } + if !self.publish && !self.subscribe { + return Err(ParsingError( + "please specify publish [-P] or subscribe [-S]".to_string(), + )); + } + if self.publish && self.subscribe { + return Err(ParsingError( + "please specify only one of: publish [-P] or subscribe [-S]".to_string(), + )); + } + if self.type_folder.is_none() && self.type_file.is_none() { + return Err(ParsingError( + "please provide the types via --type-folder or --type-file".to_string(), + )); + } + Ok(()) + } + + fn reliability_qos_policy(&self) -> ReliabilityQosPolicy { + let mut reliability = DataWriterQos::default().reliability; + if self.best_effort_reliability { + reliability.kind = qos_policy::ReliabilityQosPolicyKind::BestEffort; + } + if self.reliable_reliability { + reliability.kind = qos_policy::ReliabilityQosPolicyKind::Reliable; + } + reliability + } + + fn partition_qos_policy(&self) -> PartitionQosPolicy { + if let Some(partition) = &self.partition { + PartitionQosPolicy { + name: vec![partition.to_owned()], + } + } else { + PartitionQosPolicy::default() + } + } + + fn durability_qos_policy(&self) -> DurabilityQosPolicy { + DurabilityQosPolicy { + kind: match self.durability_kind { + 'v' => qos_policy::DurabilityQosPolicyKind::Volatile, + 'l' => qos_policy::DurabilityQosPolicyKind::TransientLocal, + 't' => qos_policy::DurabilityQosPolicyKind::Transient, + 'p' => qos_policy::DurabilityQosPolicyKind::Persistent, + _ => panic!("durability not valid"), + }, + } + } + + fn data_representation_qos_policy(&self) -> DataRepresentationQosPolicy { + let data_representation = match self.data_representation { + 1 => XCDR_DATA_REPRESENTATION, + 2 => XCDR2_DATA_REPRESENTATION, + _ => panic!("Wrong data representation"), + }; + qos_policy::DataRepresentationQosPolicy { + value: vec![data_representation], + } + } + + fn ownership_qos_policy(&self) -> OwnershipQosPolicy { + OwnershipQosPolicy { + kind: match self.ownership_strength { + -1 => qos_policy::OwnershipQosPolicyKind::Shared, + _ => qos_policy::OwnershipQosPolicyKind::Exclusive, + }, + } + } + + fn history_depth_qos_policy(&self) -> HistoryQosPolicy { + match self.history_depth { + -1 => HistoryQosPolicy::default(), + 0 => HistoryQosPolicy { + kind: HistoryQosPolicyKind::KeepAll, + }, + x if x >= 1 => HistoryQosPolicy { + kind: HistoryQosPolicyKind::KeepLast(x as u32), + }, + _ => panic!("history_depth not valid"), + } + } + + fn ownership_strength_qos_policy(&self) -> OwnershipStrengthQosPolicy { + if self.ownership_strength < -1 { + panic!("Ownership strength must be positive or zero") + } + OwnershipStrengthQosPolicy { + value: self.ownership_strength, + } + } +} + +struct Listener; +impl DomainParticipantListener for Listener {} + +fn init_publisher( + participant: &DomainParticipant, + options: Options, + dynamic_type: &'static dyn DynamicType, +) -> Result, InitializeError> { + let topic_name = options.topic_name.clone().unwrap_or("test".to_string()); + let type_name = options.type_name.clone().unwrap(); + + let topic = participant.create_dynamic_topic( + &topic_name, + &type_name, + QosKind::Default, + NO_LISTENER, + NO_STATUS, + dynamic_type, + )?; + + println!("Create topic: {}", topic_name); + + let publisher_qos = QosKind::Specific(PublisherQos { + partition: options.partition_qos_policy(), + ..Default::default() + }); + let publisher = participant.create_publisher(publisher_qos, NO_LISTENER, NO_STATUS)?; + + let mut data_writer_qos = DataWriterQos { + durability: options.durability_qos_policy(), + reliability: options.reliability_qos_policy(), + representation: options.data_representation_qos_policy(), + ownership: options.ownership_qos_policy(), + history: options.history_depth_qos_policy(), + ..Default::default() + }; + if options.deadline_interval > 0 { + data_writer_qos.deadline.period = + DurationKind::Finite(core::time::Duration::from_secs(options.deadline_interval).into()); + } + if options.ownership_qos_policy().kind == OwnershipQosPolicyKind::Exclusive { + data_writer_qos.ownership_strength = options.ownership_strength_qos_policy(); + } + + println!("Create writer for topic: {} type: {}", topic_name, type_name); + + let data_writer = publisher.create_datawriter::( + &topic, + QosKind::Specific(data_writer_qos), + NO_LISTENER, + NO_STATUS, + )?; + + Ok(data_writer) +} + +fn run_publisher( + data_writer: &DataWriter, + options: Options, + dynamic_type: &'static dyn DynamicType, + all_done: Receiver<()>, +) -> Result<(), RunningError> { + let mut dd = DynamicDataFactory::create_data(dynamic_type); + + // Attempt to load JSON data into DynamicData + if let (Some(data_folder), Some(data_file)) = (&options.data_folder, &options.data_file) { + let file_path = format!("{}/xml/{}.xml", data_folder, data_file); + if let Ok(content) = std::fs::read_to_string(&file_path) { + dd.from_xml(&content) + .map_err(|e| RunningError(format!("{e:?}")))?; + } + } + + while all_done.try_recv().is_err() { + if options.print_writer_samples { + println!(" Wrote:"); + } + // Write dynamic data + data_writer.write(dd.clone(), None).ok(); + std::thread::sleep(std::time::Duration::from_secs(1)); + } + Ok(()) +} + +fn init_subscriber( + participant: &DomainParticipant, + options: Options, + dynamic_type: &'static dyn DynamicType, +) -> Result, InitializeError> { + let topic_name = options.topic_name.clone().unwrap_or("test".to_string()); + let type_name = options.type_name.clone().unwrap(); + + let topic = participant + .create_dynamic_topic( + &topic_name, + &type_name, + QosKind::Default, + NO_LISTENER, + NO_STATUS, + dynamic_type, + ) + .unwrap(); + + println!("Create topic: {}", topic_name); + + let subscriber_qos = QosKind::Specific(SubscriberQos { + partition: options.partition_qos_policy(), + ..Default::default() + }); + let subscriber = participant.create_subscriber(subscriber_qos, NO_LISTENER, NO_STATUS)?; + + let mut data_reader_qos = DataReaderQos { + durability: options.durability_qos_policy(), + reliability: options.reliability_qos_policy(), + representation: options.data_representation_qos_policy(), + ownership: options.ownership_qos_policy(), + history: options.history_depth_qos_policy(), + ..Default::default() + }; + if options.deadline_interval > 0 { + data_reader_qos.deadline.period = + DurationKind::Finite(core::time::Duration::from_secs(options.deadline_interval).into()); + } + if options.timebasedfilter_interval > 0 { + data_reader_qos.time_based_filter.minimum_separation = DurationKind::Finite( + core::time::Duration::from_secs(options.timebasedfilter_interval).into(), + ); + } + + // // Set type consistency enforcement based on arguments + // let mut type_consistency = TypeConsistencyEnforcementQosPolicy::default(); + + // if let Some(allow_type_coercion) = options.allow_type_coercion { + // match allow_type_coercion { + // TypeConsistencyArg::T => type_consistency.kind = TypeConsistencyKind::AllowTypeCoercion, + // TypeConsistencyArg::F => { + // type_consistency.kind = TypeConsistencyKind::DisallowTypeCoercion + // } + // TypeConsistencyArg::D => { + // type_consistency.kind = TypeConsistencyEnforcementQosPolicy::default().kind + // } + // } + // } + // if let Some(force_type_validation) = options.force_type_validation { + // match force_type_validation { + // TypeConsistencyArg::T => type_consistency.force_type_validation = true, + // TypeConsistencyArg::F => type_consistency.force_type_validation = false, + // TypeConsistencyArg::D => { + // type_consistency.force_type_validation = + // TypeConsistencyEnforcementQosPolicy::default().force_type_validation + // } + // } + // } + // if let Some(ignore_member_names) = options.ignore_member_names { + // match ignore_member_names { + // TypeConsistencyArg::T => type_consistency.ignore_member_names = true, + // TypeConsistencyArg::F => type_consistency.ignore_member_names = false, + // TypeConsistencyArg::D => { + // type_consistency.ignore_member_names = + // TypeConsistencyEnforcementQosPolicy::default().ignore_member_names + // } + // } + // } + // if let Some(ignore_seq_bounds) = options.ignore_seq_bounds { + // match ignore_seq_bounds { + // TypeConsistencyArg::T => type_consistency.ignore_sequence_bounds = true, + // TypeConsistencyArg::F => type_consistency.ignore_sequence_bounds = false, + // TypeConsistencyArg::D => { + // type_consistency.ignore_sequence_bounds = + // TypeConsistencyEnforcementQosPolicy::default().ignore_sequence_bounds + // } + // } + // } + // if let Some(ignore_str_bounds) = options.ignore_str_bounds { + // match ignore_str_bounds { + // TypeConsistencyArg::T => type_consistency.ignore_string_bounds = true, + // TypeConsistencyArg::F => type_consistency.ignore_string_bounds = false, + // TypeConsistencyArg::D => { + // type_consistency.ignore_string_bounds = + // TypeConsistencyEnforcementQosPolicy::default().ignore_string_bounds + // } + // } + // } + // if let Some(prevent_type_widening) = options.prevent_type_widening { + // match prevent_type_widening { + // TypeConsistencyArg::T => type_consistency.prevent_type_widening = true, + // TypeConsistencyArg::F => type_consistency.prevent_type_widening = false, + // TypeConsistencyArg::D => { + // type_consistency.prevent_type_widening = + // TypeConsistencyEnforcementQosPolicy::default().prevent_type_widening + // } + // } + // } + + // data_reader_qos.type_consistency = type_consistency; + + println!("Create reader for topic: {}", topic_name); + + let data_reader = subscriber.create_datareader::( + &topic, + QosKind::Specific(data_reader_qos), + NO_LISTENER, + NO_STATUS, + )?; + + Ok(data_reader) +} + +fn run_subscriber( + data_reader: &DataReader, + options: Options, + dynamic_type: &'static dyn DynamicType, + all_done: Receiver<()>, +) -> Result<(), RunningError> { + let mut expected_data = None; + if let (Some(data_folder), Some(data_file)) = (&options.data_folder, &options.data_file) { + let file_path = format!("{}/xml/{}.xml", data_folder, data_file); + if let Ok(content) = std::fs::read_to_string(&file_path) { + let mut dd = DynamicDataFactory::create_data(dynamic_type); + if dd.from_xml(&content).is_ok() { + expected_data = Some(dd); + } + } + } + + while all_done.try_recv().is_err() { + let mut previous_handle = None; + loop { + let max_samples = i32::MAX; + let read_result = data_reader.take_next_instance( + max_samples, + previous_handle, + ANY_SAMPLE_STATE, + ANY_VIEW_STATE, + ANY_INSTANCE_STATE, + ); + match read_result { + Ok(samples) => { + for sample in samples { + if sample.sample_info.valid_data { + println!("sample_received()"); + if let Some(expected) = &expected_data { + if sample.data.as_ref() == Some(expected) { + println!("Received sample is the same as loaded"); + } else { + println!("Received sample is not the same as loaded"); + } + } + } + previous_handle = Some(sample.sample_info.instance_handle); + } + std::thread::sleep(std::time::Duration::from_millis(100)); + } + Err(_) => break, + } + } + } + Ok(()) +} + +fn initialize(options: &Options) -> Result { + let participant_factory = DomainParticipantFactory::get_instance(); + + // Set domain participant factory QoS if needed + + let participant = participant_factory.create_participant( + options.domain_id, + QosKind::Default, + Some(Listener), + &[ + StatusKind::InconsistentTopic, + StatusKind::OfferedIncompatibleQos, + StatusKind::PublicationMatched, + StatusKind::OfferedDeadlineMissed, + StatusKind::LivelinessLost, + StatusKind::RequestedIncompatibleQos, + StatusKind::SubscriptionMatched, + StatusKind::RequestedDeadlineMissed, + StatusKind::LivelinessChanged, + ], + )?; + + Ok(participant) +} + +struct ParsingError(String); +struct InitializeError(String); +struct RunningError(String); + +impl From for InitializeError { + fn from(value: DdsError) -> Self { + Self(format!("DdsError: {:?}", value)) + } +} +impl From for RunningError { + fn from(value: DdsError) -> Self { + Self(format!("DdsError: {:?}", value)) + } +} + +struct Return { + code: u8, + description: String, +} +impl Debug for Return { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_fmt(format_args!("code {}: {}", self.code, self.description)) + } +} + +impl Termination for Return { + fn report(self) -> ExitCode { + self.code.into() + } +} + +impl From for Return { + fn from(value: ParsingError) -> Self { + Self { + code: 1, + description: value.0, + } + } +} + +fn main() -> Result<(), Return> { + let (tx, rx) = std::sync::mpsc::channel(); + ctrlc::set_handler(move || { + tx.send(()).expect("Could not send signal on channel."); + }) + .expect("Error setting Ctrl-C handler"); + + let mut options = Options::parse(); + if options.topic_name.is_none() { + options.topic_name = Some("test".to_string()); + } + + if let Err(e) = options.validate() { + return Err(e.into()); + } + + let participant = initialize(&options).map_err(|e| Return { + code: 2, + description: e.0, + })?; + + // Create the type + let mut dt: Option<&'static dyn DynamicType> = None; + if let (Some(type_folder), Some(type_file), Some(type_name)) = + (&options.type_folder, &options.type_file, &options.type_name) + { + let file_path = format!("{}/xml/{}.xml", type_folder, type_file); + let type_xml = std::fs::read_to_string(file_path).unwrap(); + // This function is unimplemented in dust_dds currently + println!("type_name {type_name}"); + let type_builder = + DynamicTypeBuilderFactory::create_type_w_document(&type_xml, type_name, vec![]) + .unwrap(); + dt = Some(type_builder.build()); + } + + if dt.is_none() { + return Err(Return { + code: 2, + description: "Failed to create type".to_string(), + }); + } + + // Since dt is checked above, it is Some + let dt = dt.unwrap(); + + if options.publish { + let data_writer = + init_publisher(&participant, options.clone(), dt).map_err(|e| Return { + code: 2, + description: e.0, + })?; + run_publisher(&data_writer, options.clone(), dt, rx).map_err(|e| Return { + code: 3, + description: e.0, + })?; + } else { + let data_reader = + init_subscriber(&participant, options.clone(), dt).map_err(|e| Return { + code: 2, + description: e.0, + })?; + run_subscriber(&data_reader, options.clone(), dt, rx).map_err(|e| Return { + code: 3, + description: e.0, + })?; + } + + println!("Done."); + + Ok(()) +} diff --git a/unsupported_test_manifest/dust_dds-0.16.0.txt b/unsupported_test_manifest/dust_dds-0.16.0.txt new file mode 100644 index 0000000..bac9989 --- /dev/null +++ b/unsupported_test_manifest/dust_dds-0.16.0.txt @@ -0,0 +1,289 @@ +xtypes_v2_array_test_suite_int32[10]_int32[20] +xtypes_v2_array_test_suite_int32[20]_int32[10] +xtypes_v2_array_test_suite_int32[10]_uint32[10] +xtypes_v2_array_test_suite_int32[10][2]_int32[20] +xtypes_v2_array_test_suite_string10[10]_string20[10] +xtypes_v2_array_test_suite_enum1[10]_enum2[10] +xtypes_v2_array_test_suite_appendable_enum +xtypes_v2_array_test_suite_SFinal[10]_S[20]_SFinalAlt[10]_S[20] +xtypes_v2_array_test_suite_SAppendable[10]_S[20]_SAppendableAlt[10]_S[20] +xtypes_v2_array_test_suite_SMutable[10]_S[20]_SMutableAlt[10]_S[20] +xtypes_v2_extensibility_test_suite_ext_final_struct_2 +xtypes_v2_extensibility_test_suite_ext_appendable_struct_2 +xtypes_v2_extensibility_test_suite_ext_appendable_struct_3 +xtypes_v2_extensibility_test_suite_ext_appendable_struct_4 +xtypes_v2_extensibility_test_suite_ext_appendable_struct_5 +xtypes_v2_extensibility_test_suite_ext_mutable_struct_1 +xtypes_v2_extensibility_test_suite_ext_mutable_struct_2 +xtypes_v2_extensibility_test_suite_ext_mutable_struct_3 +xtypes_v2_extensibility_test_suite_ext_mutable_struct_4 +xtypes_v2_extensibility_test_suite_ext_mutable_struct_5 +xtypes_v2_extensibility_test_suite_ext_mutable_struct_6 +xtypes_v2_extensibility_test_suite_ext_autoid_1 +xtypes_v2_primitive_test_suite_struct_uint8_uint16 +xtypes_v2_primitive_test_suite_struct_uint8_uint32 +xtypes_v2_primitive_test_suite_struct_uint8_uint64 +xtypes_v2_primitive_test_suite_struct_uint8_int8 +xtypes_v2_primitive_test_suite_struct_uint8_int16 +xtypes_v2_primitive_test_suite_struct_uint8_int32 +xtypes_v2_primitive_test_suite_struct_uint8_int64 +xtypes_v2_primitive_test_suite_struct_uint8_float32 +xtypes_v2_primitive_test_suite_struct_uint8_float64 +xtypes_v2_primitive_test_suite_struct_uint8_float128 +xtypes_v2_primitive_test_suite_struct_uint8_byte +xtypes_v2_primitive_test_suite_struct_uint8_char8 +xtypes_v2_primitive_test_suite_struct_uint16_uint8 +xtypes_v2_primitive_test_suite_struct_uint16_uint32 +xtypes_v2_primitive_test_suite_struct_uint16_uint64 +xtypes_v2_primitive_test_suite_struct_uint16_int8 +xtypes_v2_primitive_test_suite_struct_uint16_int16 +xtypes_v2_primitive_test_suite_struct_uint16_int32 +xtypes_v2_primitive_test_suite_struct_uint16_int64 +xtypes_v2_primitive_test_suite_struct_uint16_float32 +xtypes_v2_primitive_test_suite_struct_uint16_float64 +xtypes_v2_primitive_test_suite_struct_uint16_float128 +xtypes_v2_primitive_test_suite_struct_uint16_byte +xtypes_v2_primitive_test_suite_struct_uint16_char8 +xtypes_v2_primitive_test_suite_struct_uint32_uint8 +xtypes_v2_primitive_test_suite_struct_uint32_uint16 +xtypes_v2_primitive_test_suite_struct_uint32_uint64 +xtypes_v2_primitive_test_suite_struct_uint32_int8 +xtypes_v2_primitive_test_suite_struct_uint32_int16 +xtypes_v2_primitive_test_suite_struct_uint32_int32 +xtypes_v2_primitive_test_suite_struct_uint32_int64 +xtypes_v2_primitive_test_suite_struct_uint32_float32 +xtypes_v2_primitive_test_suite_struct_uint32_float64 +xtypes_v2_primitive_test_suite_struct_uint32_float128 +xtypes_v2_primitive_test_suite_struct_uint32_byte +xtypes_v2_primitive_test_suite_struct_uint32_char8 +xtypes_v2_primitive_test_suite_struct_uint64_uint8 +xtypes_v2_primitive_test_suite_struct_uint64_uint16 +xtypes_v2_primitive_test_suite_struct_uint64_uint32 +xtypes_v2_primitive_test_suite_struct_uint64_int8 +xtypes_v2_primitive_test_suite_struct_uint64_int16 +xtypes_v2_primitive_test_suite_struct_uint64_uint32 +xtypes_v2_primitive_test_suite_struct_uint64_int8 +xtypes_v2_primitive_test_suite_struct_uint64_int16 +xtypes_v2_primitive_test_suite_struct_uint64_int32 +xtypes_v2_primitive_test_suite_struct_uint64_int64 +xtypes_v2_primitive_test_suite_struct_uint64_float32 +xtypes_v2_primitive_test_suite_struct_uint64_float64 +xtypes_v2_primitive_test_suite_struct_uint64_float128 +xtypes_v2_primitive_test_suite_struct_uint64_byte +xtypes_v2_primitive_test_suite_struct_uint64_char8 +xtypes_v2_primitive_test_suite_struct_int8_uint8 +xtypes_v2_primitive_test_suite_struct_int8_uint16 +xtypes_v2_primitive_test_suite_struct_int8_uint32 +xtypes_v2_primitive_test_suite_struct_int8_uint64 +xtypes_v2_primitive_test_suite_struct_int8_int16 +xtypes_v2_primitive_test_suite_struct_int8_int32 +xtypes_v2_primitive_test_suite_struct_int8_int64 +xtypes_v2_primitive_test_suite_struct_int8_float32 +xtypes_v2_primitive_test_suite_struct_int8_float64 +xtypes_v2_primitive_test_suite_struct_int8_float128 +xtypes_v2_primitive_test_suite_struct_int8_byte +xtypes_v2_primitive_test_suite_struct_int8_char8 +xtypes_v2_primitive_test_suite_struct_int16_uint8 +xtypes_v2_primitive_test_suite_struct_int16_uint16 +xtypes_v2_primitive_test_suite_struct_int16_uint32 +xtypes_v2_primitive_test_suite_struct_int16_uint64 +xtypes_v2_primitive_test_suite_struct_int16_int8 +xtypes_v2_primitive_test_suite_struct_int16_int32 +xtypes_v2_primitive_test_suite_struct_int16_int64 +xtypes_v2_primitive_test_suite_struct_int16_float32 +xtypes_v2_primitive_test_suite_struct_int16_float64 +xtypes_v2_primitive_test_suite_struct_int16_float128 +xtypes_v2_primitive_test_suite_struct_int16_byte +xtypes_v2_primitive_test_suite_struct_int16_char8 +xtypes_v2_primitive_test_suite_struct_int32_uint8 +xtypes_v2_primitive_test_suite_struct_int32_uint16 +xtypes_v2_primitive_test_suite_struct_int32_uint32 +xtypes_v2_primitive_test_suite_struct_int32_uint64 +xtypes_v2_primitive_test_suite_struct_int32_int8 +xtypes_v2_primitive_test_suite_struct_int32_int16 +xtypes_v2_primitive_test_suite_struct_int32_int64 +xtypes_v2_primitive_test_suite_struct_int32_float32 +xtypes_v2_primitive_test_suite_struct_int32_float64 +xtypes_v2_primitive_test_suite_struct_int32_float128 +xtypes_v2_primitive_test_suite_struct_int32_byte +xtypes_v2_primitive_test_suite_struct_int32_char8 +xtypes_v2_primitive_test_suite_struct_int64_uint8 +xtypes_v2_primitive_test_suite_struct_int64_uint16 +xtypes_v2_primitive_test_suite_struct_int64_uint32 +xtypes_v2_primitive_test_suite_struct_int64_uint64 +xtypes_v2_primitive_test_suite_struct_int64_int8 +xtypes_v2_primitive_test_suite_struct_int64_int16 +xtypes_v2_primitive_test_suite_struct_int64_int32 +xtypes_v2_primitive_test_suite_struct_int64_float32 +xtypes_v2_primitive_test_suite_struct_int64_float64 +xtypes_v2_primitive_test_suite_struct_int64_float128 +xtypes_v2_primitive_test_suite_struct_int64_byte +xtypes_v2_primitive_test_suite_struct_int64_char8 +xtypes_v2_primitive_test_suite_struct_float32_uint8 +xtypes_v2_primitive_test_suite_struct_float32_uint16 +xtypes_v2_primitive_test_suite_struct_float32_uint32 +xtypes_v2_primitive_test_suite_struct_float32_uint64 +xtypes_v2_primitive_test_suite_struct_float32_int8 +xtypes_v2_primitive_test_suite_struct_float32_int16 +xtypes_v2_primitive_test_suite_struct_float32_int32 +xtypes_v2_primitive_test_suite_struct_float32_int64 +xtypes_v2_primitive_test_suite_struct_float32_float64 +xtypes_v2_primitive_test_suite_struct_float32_float128 +xtypes_v2_primitive_test_suite_struct_float32_byte +xtypes_v2_primitive_test_suite_struct_float32_char8 +xtypes_v2_primitive_test_suite_struct_float64_uint8 +xtypes_v2_primitive_test_suite_struct_float64_uint16 +xtypes_v2_primitive_test_suite_struct_float64_uint32 +xtypes_v2_primitive_test_suite_struct_float64_uint64 +xtypes_v2_primitive_test_suite_struct_float64_int8 +xtypes_v2_primitive_test_suite_struct_float64_int16 +xtypes_v2_primitive_test_suite_struct_float64_int32 +xtypes_v2_primitive_test_suite_struct_float64_int64 +xtypes_v2_primitive_test_suite_struct_float64_float32 +xtypes_v2_primitive_test_suite_struct_float64_float128 +xtypes_v2_primitive_test_suite_struct_float64_byte +xtypes_v2_primitive_test_suite_struct_float64_char8 +xtypes_v2_primitive_test_suite_struct_float128_uint8 +xtypes_v2_primitive_test_suite_struct_float128_uint16 +xtypes_v2_primitive_test_suite_struct_float128_uint32 +xtypes_v2_primitive_test_suite_struct_float128_uint64 +xtypes_v2_primitive_test_suite_struct_float128_int8 +xtypes_v2_primitive_test_suite_struct_float128_int16 +xtypes_v2_primitive_test_suite_struct_float128_int32 +xtypes_v2_primitive_test_suite_struct_float128_int64 +xtypes_v2_primitive_test_suite_struct_float128_float32 +xtypes_v2_primitive_test_suite_struct_float128_float64 +xtypes_v2_primitive_test_suite_struct_float128_float128 +xtypes_v2_primitive_test_suite_struct_float128_byte +xtypes_v2_primitive_test_suite_struct_float128_char8 +xtypes_v2_primitive_test_suite_struct_byte_uint8 +xtypes_v2_primitive_test_suite_struct_byte_uint16 +xtypes_v2_primitive_test_suite_struct_byte_uint32 +xtypes_v2_primitive_test_suite_struct_byte_uint64 +xtypes_v2_primitive_test_suite_struct_byte_int8 +xtypes_v2_primitive_test_suite_struct_byte_int16 +xtypes_v2_primitive_test_suite_struct_byte_int32 +xtypes_v2_primitive_test_suite_struct_byte_int64 +xtypes_v2_primitive_test_suite_struct_byte_float32 +xtypes_v2_primitive_test_suite_struct_byte_float64 +xtypes_v2_primitive_test_suite_struct_byte_float128 +xtypes_v2_primitive_test_suite_struct_byte_char8 +xtypes_v2_primitive_test_suite_struct_char8_uint8 +xtypes_v2_primitive_test_suite_struct_char8_uint16 +xtypes_v2_primitive_test_suite_struct_char8_uint32 +xtypes_v2_primitive_test_suite_struct_char8_uint64 +xtypes_v2_primitive_test_suite_struct_char8_int8 +xtypes_v2_primitive_test_suite_struct_char8_int16 +xtypes_v2_primitive_test_suite_struct_char8_int32 +xtypes_v2_primitive_test_suite_struct_char8_int64 +xtypes_v2_primitive_test_suite_struct_char8_float32 +xtypes_v2_primitive_test_suite_struct_char8_float64 +xtypes_v2_primitive_test_suite_struct_char8_float128 +xtypes_v2_primitive_test_suite_struct_char8_byte +xtypes_v2_sequence_test_suite_seq(int32)_seq(int32,10) +xtypes_v2_sequence_test_suite_seq(int32)_seq(int32,10)_check_bounds +xtypes_v2_sequence_test_suite_seq(int32,20)_seq(int32,10) +xtypes_v2_sequence_test_suite_seq(int32,20)_seq(int32,10)_check_bounds +xtypes_v2_sequence_test_suite_seq(int32,10)_seq(int32,20) +xtypes_v2_sequence_test_suite_seq(int32,10)_seq(int32,20)_check_bounds +xtypes_v2_sequence_test_suite_seq(str10,10)_seq(str20,10) +xtypes_v2_sequence_test_suite_seq(str20,10)_seq(str10,10) +xtypes_v2_sequence_test_suite_seq(str20,10)_seq(str10,10)_check +xtypes_v2_sequence_test_suite_seq(enum1)_seq(enum2) +xtypes_v2_sequence_test_suite_seq(SFinal,10)_seq(SFinalAlt,10) +xtypes_v2_sequence_test_suite_seq(SAppendable,10)_seq(SAppendableAlt,10) +xtypes_v2_sequence_test_suite_seq(SMutable,10)_seq(SMutableAlt,10) +xtypes_v2_string_test_suite_string_string10 +xtypes_v2_string_test_suite_string_string10_check +xtypes_v2_string_test_suite_string10_string20_check +xtypes_v2_string_test_suite_string20_string10_check +xtypes_v2_string_test_suite_wstring_wstring +xtypes_v2_string_test_suite_wstring_wstring10 +xtypes_v2_string_test_suite_wstring_wstring10_check +xtypes_v2_string_test_suite_wstring10_wstring20_check +xtypes_v2_string_test_suite_wstring20_wstring10_check +xtypes_v2_struct_test_suite_primitives_struct_mutable +xtypes_v2_struct_test_suite_struct_final_appendable +xtypes_v2_struct_test_suite_struct_final_mutable +xtypes_v2_struct_test_suite_struct_appendable_final +xtypes_v2_struct_test_suite_struct_appendable_mutable +xtypes_v2_struct_test_suite_struct_mutable_final +xtypes_v2_struct_test_suite_struct_mutable_appendable +xtypes_v2_struct_test_suite_struct_different_ids_ok +xtypes_v2_struct_test_suite_struct_different_ids +xtypes_v2_struct_test_suite_struct_different_names_ok +xtypes_v2_struct_test_suite_struct_different_names +xtypes_v2_struct_test_suite_struct_no_common_ids +xtypes_v2_struct_test_suite_struct_members_assignable_1 +xtypes_v2_struct_test_suite_struct_mustUnderstand_1 +xtypes_v2_struct_test_suite_struct_mustUnderstand_2 +xtypes_v2_struct_test_suite_struct_key_1 +xtypes_v2_struct_test_suite_struct_key_2 +xtypes_v2_struct_test_suite_struct_key_string_1 +xtypes_v2_struct_test_suite_struct_key_string_3 +xtypes_v2_struct_test_suite_struct_key_enum_1 +xtypes_v2_struct_test_suite_struct_key_enum_2 +xtypes_v2_struct_test_suite_struct_key_seq_1 +xtypes_v2_struct_test_suite_struct_key_seq_2 +xtypes_v2_struct_test_suite_struct_key_struct_1 +xtypes_v2_struct_test_suite_struct_key_struct_2 +xtypes_v2_struct_test_suite_struct_key_union_1 +xtypes_v2_struct_test_suite_struct_key_union_2 +xtypes_v2_type_consistency_test_suite_tc_force_type_validation_1 +xtypes_v2_type_consistency_test_suite_tc_ignore_member_names_1 +xtypes_v2_type_consistency_test_suite_tc_ignore_member_names_2 +xtypes_v2_type_consistency_test_suite_tc_ignore_member_names_3 +xtypes_v2_type_consistency_test_suite_tc_ignore_seq_bounds_1 +xtypes_v2_type_consistency_test_suite_tc_ignore_seq_bounds_2 +xtypes_v2_type_consistency_test_suite_tc_ignore_seq_bounds_3 +xtypes_v2_type_consistency_test_suite_tc_ignore_seq_bounds_4 +xtypes_v2_type_consistency_test_suite_tc_ignore_seq_bounds_5 +xtypes_v2_type_consistency_test_suite_tc_ignore_seq_bounds_6 +xtypes_v2_type_consistency_test_suite_tc_ignore_seq_bounds_7 +xtypes_v2_type_consistency_test_suite_tc_ignore_str_bounds_1 +xtypes_v2_type_consistency_test_suite_tc_ignore_str_bounds_2 +xtypes_v2_type_consistency_test_suite_tc_ignore_str_bounds_3 +xtypes_v2_type_consistency_test_suite_tc_ignore_str_bounds_4 +xtypes_v2_type_consistency_test_suite_tc_ignore_str_bounds_5 +xtypes_v2_type_consistency_test_suite_tc_ignore_str_bounds_6 +xtypes_v2_type_consistency_test_suite_tc_ignore_str_bounds_7 +xtypes_v2_type_consistency_test_suite_tc_prevent_type_widening_1 +xtypes_v2_type_consistency_test_suite_tc_prevent_type_widening_2 +xtypes_v2_type_consistency_test_suite_tc_prevent_type_widening_3 +xtypes_v2_type_consistency_test_suite_tc_prevent_type_widening_4 +xtypes_v2_type_consistency_test_suite_tc_prevent_type_widening_5 +xtypes_v2_type_consistency_test_suite_tc_prevent_type_widening_6 +xtypes_v2_type_consistency_test_suite_tc_prevent_type_widening_7 +xtypes_v2_type_consistency_test_suite_tc_prevent_type_widening_8 +xtypes_v2_type_consistency_test_suite_tc_prevent_type_widening_9 +xtypes_v2_union_test_suite_union_primitives_final +xtypes_v2_union_test_suite_union_primitives_appendable +xtypes_v2_union_test_suite_union_primitives_mutable +xtypes_v2_union_test_suite_union_final_appendable +xtypes_v2_union_test_suite_union_final_mutable +xtypes_v2_union_test_suite_union_appendable_mutable +xtypes_v2_union_test_suite_union_different_ids_1 +xtypes_v2_union_test_suite_union_different_ids_2 +xtypes_v2_union_test_suite_union_different_names_1 +xtypes_v2_union_test_suite_union_different_names_2 +xtypes_v2_union_test_suite_union_different_order_1 +xtypes_v2_union_test_suite_union_different_order_2 +xtypes_v2_union_test_suite_union_int16_int32 +xtypes_v2_union_test_suite_union_int16_int32_default +xtypes_v2_union_test_suite_union_int32_int32_default +xtypes_v2_union_test_suite_union_int32_default_int16 +xtypes_v2_union_test_suite_union_int32_default_int32 +xtypes_v2_union_test_suite_union_int32_default_int16_default +xtypes_v2_union_test_suite_union_int32_default_int32_default +xtypes_v2_union_test_suite_union_final_5_vs_6 +xtypes_v2_union_test_suite_union_final_6_vs_5 +xtypes_v2_union_test_suite_union_final_one_default_1 +xtypes_v2_union_test_suite_union_final_one_default_2 +xtypes_v2_union_test_suite_union_appendable_one_common_1 +xtypes_v2_union_test_suite_union_appendable_one_common_2 +xtypes_v2_union_test_suite_union_appendable_no_common_1 +xtypes_v2_union_test_suite_union_appendable_no_common_2 +xtypes_v2_union_test_suite_union_appendable_no_common_w_default +xtypes_v2_union_test_suite_union_mutable_one_common +xtypes_v2_union_test_suite_union_mutable_no_common +xtypes_v2_union_test_suite_union_mutable_no_common_w_default