From b1745d2589369619bad6a0dcc796636d2ceddd0b Mon Sep 17 00:00:00 2001 From: romanodanilo <62891297+romanodanilo@users.noreply.github.com> Date: Tue, 6 Aug 2024 11:34:15 +0200 Subject: [PATCH 01/12] Fix report modules (#118) Signed-off-by: romanodanilo Signed-off-by: romanodanilo <62891297+romanodanilo@users.noreply.github.com> --- .../src/report_format_github_ci.cpp | 25 ++++++--------- .../src/ui/c_checker_widget.cpp | 7 +++- .../src/ui/c_checker_widget.h | 1 + .../src/ui/c_report_module_window.cpp | 14 +++++--- .../src/report_format_text.cpp | 32 +++++++++++++++++++ 5 files changed, 58 insertions(+), 21 deletions(-) diff --git a/src/report_modules/report_module_github_ci/src/report_format_github_ci.cpp b/src/report_modules/report_module_github_ci/src/report_format_github_ci.cpp index 82e9943e..7c0cc936 100644 --- a/src/report_modules/report_module_github_ci/src/report_format_github_ci.cpp +++ b/src/report_modules/report_module_github_ci/src/report_format_github_ci.cpp @@ -26,8 +26,8 @@ XERCES_CPP_NAMESPACE_USE static const std::map mapIssueLevelToString = {{eIssueLevel::INFO_LVL, "::notice::"}, - {eIssueLevel::WARNING_LVL, "::warning::"}, - {eIssueLevel::ERROR_LVL, "::error::"}}; + {eIssueLevel::WARNING_LVL, "::warning::"}, + {eIssueLevel::ERROR_LVL, "::error::"}}; // Main Programm int main(int argc, char *argv[]) @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) if (StringEndsWith(ToLower(strFilepath), ".xqar")) { - if (!std::filesystem::exists(strFilepath.c_str())) + if (!fs::exists(strFilepath.c_str())) { std::cerr << "Could not open file '" << strFilepath << "'!" << std::endl << "Abort generating report!" << std::endl; @@ -103,7 +103,8 @@ int main(int argc, char *argv[]) } // Exit with code 1 if an error was found to fail the GitHub pipeline - if(RunGithubCIReport(inputParams)) { + if (RunGithubCIReport(inputParams)) + { exit(1); } } @@ -123,7 +124,6 @@ void ShowHelp(const std::string &toolPath) std::cout << "\n\n"; } - bool RunGithubCIReport(const cParameterContainer &inputParams) { XMLPlatformUtils::Initialize(); @@ -140,7 +140,7 @@ bool RunGithubCIReport(const cParameterContainer &inputParams) // Add prefix with issue id const std::list checkerBundles = pResultContainer->GetCheckerBundles(); - for (auto checkerBundle: checkerBundles) + for (auto checkerBundle : checkerBundles) { checkerBundle->DoProcessing(AddPrefixForDescriptionIssueProcessor); } @@ -166,26 +166,23 @@ bool PrintResults(std::unique_ptr &pResultContainer) std::list bundles = pResultContainer->GetCheckerBundles(); // Loop over all checker bundles - for (auto & bundle : bundles) + for (auto &bundle : bundles) { const auto checkers = bundle->GetCheckers(); // Iterate over all checkers - for (auto & checker : checkers) + for (auto &checker : checkers) { // Get all issues from the current checker const auto issues = checker->GetIssues(); if (!issues.empty()) { - for (auto & issue : issues) + for (auto &issue : issues) { auto issue_level = mapIssueLevelToString.find(issue->GetIssueLevel()); if (issue_level != mapIssueLevelToString.end()) { - std::cout << issue_level->second - << checker->GetCheckerID() - << ": " - << issue->GetDescription() + std::cout << issue_level->second << checker->GetCheckerID() << ": " << issue->GetDescription() << std::endl; if (issue->GetIssueLevel() == eIssueLevel::ERROR_LVL) { @@ -199,7 +196,6 @@ bool PrintResults(std::unique_ptr &pResultContainer) return error_found; } - void AddPrefixForDescriptionIssueProcessor(cChecker *, cIssue *issueToProcess) { std::stringstream ssDescription; @@ -208,7 +204,6 @@ void AddPrefixForDescriptionIssueProcessor(cChecker *, cIssue *issueToProcess) issueToProcess->SetDescription(ssDescription.str()); } - void WriteDefaultConfig() { cConfiguration defaultConfig; diff --git a/src/report_modules/report_module_gui/src/ui/c_checker_widget.cpp b/src/report_modules/report_module_gui/src/ui/c_checker_widget.cpp index bc87e229..d7dd204a 100644 --- a/src/report_modules/report_module_gui/src/ui/c_checker_widget.cpp +++ b/src/report_modules/report_module_gui/src/ui/c_checker_widget.cpp @@ -159,11 +159,16 @@ cCheckerWidget::cCheckerWidget(QWidget *parent) : QWidget(parent) _currentResultContainer = nullptr; } -void cCheckerWidget::LoadResultContainer(cResultContainer *const container) +void cCheckerWidget::UpdateResultContainer(cResultContainer *const container) { _currentResultContainer = container; LoadAllItems(); +} + +void cCheckerWidget::LoadResultContainer(cResultContainer *const container) +{ + UpdateResultContainer(container); // Show XODR and highlight issues if (container->HasCheckerBundles()) diff --git a/src/report_modules/report_module_gui/src/ui/c_checker_widget.h b/src/report_modules/report_module_gui/src/ui/c_checker_widget.h index 76478aa0..5719f9fb 100644 --- a/src/report_modules/report_module_gui/src/ui/c_checker_widget.h +++ b/src/report_modules/report_module_gui/src/ui/c_checker_widget.h @@ -48,6 +48,7 @@ class cCheckerWidget : public QWidget cCheckerWidget(QWidget *parent = 0); void LoadResultContainer(cResultContainer *const container); + void UpdateResultContainer(cResultContainer *const container); protected: // Loads a list of cCheckerBundles to the widget view. diff --git a/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp b/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp index 76eb0542..eeec372d 100644 --- a/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp +++ b/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp @@ -50,7 +50,6 @@ void cReportModuleWindow::highlightRow(const cIssue *const issue, const int row) void cReportModuleWindow::loadFileContent(cResultContainer *const container) { - QString fileToOpen; textEditArea->setPlainText(""); if (container->HasXODRFileName()) @@ -635,23 +634,28 @@ void cReportModuleWindow::onIssueToggled(bool checked) { _repetitiveIssueEnabled = checked; FilterResultsOnCheckboxes(); - LoadResultContainer(_results); + if (_checkerWidget != nullptr) + _checkerWidget->UpdateResultContainer(_results); } void cReportModuleWindow::onInfoToggled(bool checked) { _infoLevelEnabled = checked; FilterResultsOnCheckboxes(); - LoadResultContainer(_results); + if (_checkerWidget != nullptr) + _checkerWidget->UpdateResultContainer(_results); } void cReportModuleWindow::onWarningToggled(bool checked) { _warningLevelEnabled = checked; FilterResultsOnCheckboxes(); - LoadResultContainer(_results); + if (_checkerWidget != nullptr) + _checkerWidget->UpdateResultContainer(_results); } void cReportModuleWindow::onErrorToggled(bool checked) { _errorLevelEnabled = checked; FilterResultsOnCheckboxes(); - LoadResultContainer(_results); + + if (_checkerWidget != nullptr) + _checkerWidget->UpdateResultContainer(_results); } diff --git a/src/report_modules/report_module_text/src/report_format_text.cpp b/src/report_modules/report_module_text/src/report_format_text.cpp index d51a68ba..29165c00 100644 --- a/src/report_modules/report_module_text/src/report_format_text.cpp +++ b/src/report_modules/report_module_text/src/report_format_text.cpp @@ -419,6 +419,38 @@ void WriteResults(const char *file, cResultContainer *ptrResultContainer) ss << "\n" << BASIC_SEPARATOR_LINE << "\n"; + ss << BASIC_SEPARATOR_LINE << "\n"; + + ss << "Note" + << "\n\n"; + ss << "Rule UID format:" + << "\n"; + ss << " ::x.y.z:rule_set.for_rules.rule_name" + << "\n\n"; + ss << "where " + << "\n"; + ss << " Emanating Entity: a domain name for the entity (organization or company) that declares the rule UID" + << "\n"; + ss << " Standard: a short string that represents the standard or the domain to which the rule is applied" + << "\n"; + ss << " Definition Setting: the version of the standard or the domain to which the rule appears or is " + "applied for the first time" + << "\n"; + ss << " Rule Full Name: the full name of the rule, as dot separated, snake lower case string. " + << "\n"; + ss << " The full name of a rule is composed by the rule set, a categorization for the rule, " + << "\n"; + ss << " and the rule name, a unique string inside the categorization. " + << "\n"; + ss << " The rule set can be nested (meaning that can be defined as an " + << "\n"; + ss << " arbitrary sequence of dot separated names, while the name is the snake " + << "\n"; + ss << " case string after the last dot of the full name)" + << "\n"; + + ss << "\n" << BASIC_SEPARATOR_LINE << "\n"; + outFile << ss.rdbuf(); outFile.close(); } From 7302a1876f87c2b3af5b3fe21efd0dd887d4c9ff Mon Sep 17 00:00:00 2001 From: romanodanilo <62891297+romanodanilo@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:48:26 +0200 Subject: [PATCH 02/12] Add InputFile as unique source of input (#119) Signed-off-by: romanodanilo Signed-off-by: romanodanilo <62891297+romanodanilo@users.noreply.github.com> --- demo_pipeline/configuration_generator.py | 6 +- demo_pipeline/templates/otx_template.xml | 2 +- demo_pipeline/templates/xodr_template.xml | 2 +- demo_pipeline/templates/xosc_template.xml | 2 +- doc/manual/file_formats.md | 6 +- examples/checker_bundle_example/src/main.cpp | 1 - examples/viewer_example/resources/Result.xqar | 355 ++++++++++-------- .../common/config_format/c_configuration.h | 5 +- .../common/result_format/c_checker_bundle.h | 29 +- include/common/result_format/c_issue.h | 8 +- .../common/result_format/c_result_container.h | 18 +- runtime/tests/test_data/3steps_config.xml | 12 +- .../test_data/DemoCheckerBundle_config.xml | 10 +- .../src/result_format/c_checker_bundle.cpp | 39 +- src/common/src/result_format/c_issue.cpp | 8 +- .../src/result_format/c_result_container.cpp | 46 +-- .../src/ui/c_checker_widget.cpp | 28 +- .../src/ui/c_checker_widget.h | 8 +- .../src/ui/c_report_module_window.cpp | 23 +- .../src/ui/c_report_module_window.h | 2 +- .../src/report_format_text.cpp | 7 +- src/result_pooling/src/result_pooling.cpp | 37 +- src/runtime/src/c_configuration_validator.cpp | 21 +- src/runtime/src/c_configuration_validator.h | 7 +- src/runtime/src/runtime.cpp | 34 +- src/runtime/src/runtime.h | 4 +- src/runtime/src/ui/c_global_param_dialog.cpp | 34 +- src/runtime/src/ui/c_global_param_dialog.h | 3 +- src/runtime/src/ui/c_process_view.cpp | 29 +- src/runtime/src/ui/c_process_view.h | 2 - src/runtime/src/ui/c_runtime_window.cpp | 57 ++- src/runtime/src/ui/c_runtime_window.h | 14 +- .../files/DemoCheckerBundle_config.xml | 8 +- .../files/TextReport_config.xml | 11 +- .../result_pooling/files/RoadVerifier.xqar | 55 +-- .../result_pooling/files/ScenarioChecker.xqar | 12 +- .../files/XodrSchemaChecker.xqar | 13 +- .../files/XodrStatisticChecker.xqar | 169 +++++---- .../files/XoscSchemaChecker.xqar | 13 +- .../files/two_bundles_config.xml | 2 +- .../files/DemoCheckerBundle_config.xml | 10 +- .../files/XodrSchemaChecker_config.xml | 12 +- .../files/XoscSchemaChecker_config.xml | 12 +- 43 files changed, 533 insertions(+), 643 deletions(-) diff --git a/demo_pipeline/configuration_generator.py b/demo_pipeline/configuration_generator.py index 4db2248c..be1d162b 100644 --- a/demo_pipeline/configuration_generator.py +++ b/demo_pipeline/configuration_generator.py @@ -46,7 +46,7 @@ def main(): print("XOSC selected") update_param_value( XOSC_TEMPLATE_PATH, - "XoscFile", + "InputFile", full_input_path, os.path.join(GENERATED_CONFIG_PATH, "config.xml"), ) @@ -54,7 +54,7 @@ def main(): print("XODR selected") update_param_value( XODR_TEMPLATE_PATH, - "XodrFile", + "InputFile", full_input_path, os.path.join(GENERATED_CONFIG_PATH, "config.xml"), ) @@ -62,7 +62,7 @@ def main(): print("OTX selected") update_param_value( OTX_TEMPLATE_PATH, - "OtxFile", + "InputFile", full_input_path, os.path.join(GENERATED_CONFIG_PATH, "config.xml"), ) diff --git a/demo_pipeline/templates/otx_template.xml b/demo_pipeline/templates/otx_template.xml index c25a8f31..95a77c27 100644 --- a/demo_pipeline/templates/otx_template.xml +++ b/demo_pipeline/templates/otx_template.xml @@ -1,7 +1,7 @@ - + diff --git a/demo_pipeline/templates/xodr_template.xml b/demo_pipeline/templates/xodr_template.xml index c4b790e6..1dc57a93 100644 --- a/demo_pipeline/templates/xodr_template.xml +++ b/demo_pipeline/templates/xodr_template.xml @@ -1,7 +1,7 @@ - + diff --git a/demo_pipeline/templates/xosc_template.xml b/demo_pipeline/templates/xosc_template.xml index 07171311..c4e45cff 100644 --- a/demo_pipeline/templates/xosc_template.xml +++ b/demo_pipeline/templates/xosc_template.xml @@ -1,7 +1,7 @@ - + diff --git a/doc/manual/file_formats.md b/doc/manual/file_formats.md index 187bd7b2..e23a3088 100644 --- a/doc/manual/file_formats.md +++ b/doc/manual/file_formats.md @@ -20,7 +20,7 @@ all CheckerBundles finish execution. ```xml - + @@ -76,7 +76,7 @@ one called SyntaxChecker and one SemanticChecker. ```xml - + @@ -87,7 +87,7 @@ one called SyntaxChecker and one SemanticChecker. - + diff --git a/examples/checker_bundle_example/src/main.cpp b/examples/checker_bundle_example/src/main.cpp index b5c9ce5d..9d660dad 100644 --- a/examples/checker_bundle_example/src/main.cpp +++ b/examples/checker_bundle_example/src/main.cpp @@ -72,7 +72,6 @@ int main(int argc, char *argv[]) } // We simply use the global parameters from the configuration - // This should be XoscFile or XodrFile inputParams.Overwrite(configuration.GetParams()); // We search for parameters applied to our configuration. diff --git a/examples/viewer_example/resources/Result.xqar b/examples/viewer_example/resources/Result.xqar index 99bd2df5..34ad2c94 100644 --- a/examples/viewer_example/resources/Result.xqar +++ b/examples/viewer_example/resources/Result.xqar @@ -1,188 +1,239 @@ - + - - - - - - - + + + + + + + - - - + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - - + + - - + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - + + + + diff --git a/include/common/config_format/c_configuration.h b/include/common/config_format/c_configuration.h index dba1ec21..d7176112 100644 --- a/include/common/config_format/c_configuration.h +++ b/include/common/config_format/c_configuration.h @@ -24,10 +24,7 @@ class cConfigurationReportModule; class cConfigurationCheckerBundle; // name of the global parameter xodr file -const std::string PARAM_XODR_FILE = "XodrFile"; - -// name of the global parameter xosc file -const std::string PARAM_XOSC_FILE = "XoscFile"; +const std::string PARAM_INPUT_FILE = "InputFile"; // This class stores all settings of a configuration file (used to parameterize the framework). The // configuration can be parsed and written. diff --git a/include/common/result_format/c_checker_bundle.h b/include/common/result_format/c_checker_bundle.h index 5a1ababd..750fafb1 100644 --- a/include/common/result_format/c_checker_bundle.h +++ b/include/common/result_format/c_checker_bundle.h @@ -84,17 +84,12 @@ class cCheckerBundle void SetSummary(const std::string &strSummary); // Sets the file name - void SetXODRFileName(const std::string &strFileName); + void SetInputFileName(const std::string &strFileName); - /* Sets the file path to an XODR file which is checked. - * \param strXodrFilePath : The file path can be an absolute or relative path. + /* Sets the file path to an input file which is checked. + * \param strInputFilePath : The file path can be an absolute or relative path. */ - void SetXODRFilePath(const std::string &strXodrFilePath); - - /* Sets the file path to an XOSC file which is checked. - * \param strXoscFilePath : The file path can be an absolute or relative path. - */ - void SetXOSCFilePath(const std::string &strXoscFilePath); + void SetInputFilePath(const std::string &strInputFilePath); // Sets the file name void SetDescription(const std::string &strDescription); @@ -108,21 +103,13 @@ class cCheckerBundle // Gets the summary std::string GetSummary() const; - /* Gets the file name of the stored XODR file - *\param bRemoveExtension : True if no extension should be returned - */ - std::string GetXODRFileName(const bool bRemoveExtension = true) const; - - /* Gets the file name of the stored XOSC file + /* Gets the file name of the stored input file *\param bRemoveExtension : True if no extension should be returned */ - std::string GetXOSCFileName(const bool bRemoveExtension = true) const; - - // Returns the file path an XODR file which is relative or absolute to the result file itself - std::string GetXODRFilePath() const; + std::string GetInputFileName(const bool bRemoveExtension = true) const; - // Returns the file path an XODR file which is relative or absolute to the result file itself - std::string GetXOSCFilePath() const; + // Returns the file path an input file which is relative or absolute to the result file itself + std::string GetInputFilePath() const; // Gets the file name std::string GetDescription() const; diff --git a/include/common/result_format/c_issue.h b/include/common/result_format/c_issue.h index b22e9fe2..3dd455bb 100644 --- a/include/common/result_format/c_issue.h +++ b/include/common/result_format/c_issue.h @@ -144,11 +144,11 @@ class cIssue : public IResult // Returns the checker this issue belongs to cChecker *GetChecker() const; - // Returns the xodr file name - std::string GetXODRFilename() const; + // Returns the input file name + std::string GetInputFilename() const; - // Returns the xodr file path - std::string GetXODRFilepath() const; + // Returns the input file path + std::string GetInputFilepath() const; // Returns the next free ID unsigned long long NextFreeId() const; diff --git a/include/common/result_format/c_result_container.h b/include/common/result_format/c_result_container.h index 1cd97e44..a10baa17 100644 --- a/include/common/result_format/c_result_container.h +++ b/include/common/result_format/c_result_container.h @@ -101,23 +101,17 @@ class cResultContainer // Returns an issue by its id cIssue *GetIssueById(unsigned long long id) const; - // Returns true if a xodr filename is available - bool HasXODRFileName() const; - - // Returns true if a xosc filename is available - bool HasXOSCFilePath() const; + // Returns true if a input filename is available + bool HasInputFileName() const; /* - Returns the xodr filename of the first checkerbundle. Empty string if no file name is present. + Returns the input filename of the first checkerbundle. Empty string if no file name is present. \param bRemoveExtension : True if no extension should be returned */ - std::string GetXODRFileName(const bool bRemoveExtension = true) const; - - // Returns the xodr path of the first checkerbundle. Empty string if no file name is present. - std::string GetXODRFilePath() const; + std::string GetInputFileName(const bool bRemoveExtension = true) const; - // Returns the xosc path of the first checkerbundle. Empty string if no file name is present. - std::string GetXOSCFilePath() const; + // Returns the input path of the first checkerbundle. Empty string if no file name is present. + std::string GetInputFilePath() const; // Processes every issue on every checkerbundle, checker and does a defined processing void DoProcessing(void (*funcIteratorPtr)(cCheckerBundle *, cChecker *, cIssue *)); diff --git a/runtime/tests/test_data/3steps_config.xml b/runtime/tests/test_data/3steps_config.xml index 74c0f058..74c932d3 100644 --- a/runtime/tests/test_data/3steps_config.xml +++ b/runtime/tests/test_data/3steps_config.xml @@ -1,16 +1,16 @@ - + - + - - + + - - + + diff --git a/runtime/tests/test_data/DemoCheckerBundle_config.xml b/runtime/tests/test_data/DemoCheckerBundle_config.xml index 25f92817..fc533a59 100644 --- a/runtime/tests/test_data/DemoCheckerBundle_config.xml +++ b/runtime/tests/test_data/DemoCheckerBundle_config.xml @@ -1,18 +1,18 @@ - + - + - - + + diff --git a/src/common/src/result_format/c_checker_bundle.cpp b/src/common/src/result_format/c_checker_bundle.cpp index b5ea1840..5d356cde 100644 --- a/src/common/src/result_format/c_checker_bundle.cpp +++ b/src/common/src/result_format/c_checker_bundle.cpp @@ -202,21 +202,15 @@ void cCheckerBundle::SetSummary(const std::string &strSummary) } // Sets the file name -void cCheckerBundle::SetXODRFileName(const std::string &strFileName) +void cCheckerBundle::SetInputFileName(const std::string &strFileName) { m_FileName = strFileName; } // Sets the file name -void cCheckerBundle::SetXODRFilePath(const std::string &strXodrFilePath) +void cCheckerBundle::SetInputFilePath(const std::string &strInputFilePath) { - SetParam("XodrFile", strXodrFilePath); -} - -// Sets the file name -void cCheckerBundle::SetXOSCFilePath(const std::string &strXoscFilePath) -{ - SetParam("XoscFile", strXoscFilePath); + SetParam("InputFile", strInputFilePath); } // Sets the file name @@ -242,34 +236,19 @@ std::string cCheckerBundle::GetSummary() const } // Gets the file name -std::string cCheckerBundle::GetXODRFileName(const bool bRemoveExtension) const +std::string cCheckerBundle::GetInputFileName(const bool bRemoveExtension) const { - std::string xodrPath = GetParam("XodrFile"); + std::string inputPath = GetParam("InputFile"); - GetFileName(&xodrPath, bRemoveExtension); + GetFileName(&inputPath, bRemoveExtension); - return xodrPath; -} - -std::string cCheckerBundle::GetXOSCFileName(const bool bRemoveExtension) const -{ - std::string xoscPath = GetParam("XoscFile"); - - GetFileName(&xoscPath, bRemoveExtension); - - return xoscPath; -} - -// Gets the file path -std::string cCheckerBundle::GetXODRFilePath() const -{ - return GetParam("XodrFile"); + return inputPath; } // Gets the file path -std::string cCheckerBundle::GetXOSCFilePath() const +std::string cCheckerBundle::GetInputFilePath() const { - return GetParam("XoscFile"); + return GetParam("InputFile"); } std::string cCheckerBundle::GetBundleName() const diff --git a/src/common/src/result_format/c_issue.cpp b/src/common/src/result_format/c_issue.cpp index 59abe0bb..528a6169 100644 --- a/src/common/src/result_format/c_issue.cpp +++ b/src/common/src/result_format/c_issue.cpp @@ -310,7 +310,7 @@ std::string cIssue::GetIssueLevelStr() const } // Returns the xodr file name -std::string cIssue::GetXODRFilename() const +std::string cIssue::GetInputFilename() const { cChecker *checker = GetChecker(); @@ -320,7 +320,7 @@ std::string cIssue::GetXODRFilename() const if (nullptr != bundle) { - return bundle->GetXODRFileName(); + return bundle->GetInputFileName(); } return ""; } @@ -328,7 +328,7 @@ std::string cIssue::GetXODRFilename() const } // Returns the xodr file path -std::string cIssue::GetXODRFilepath() const +std::string cIssue::GetInputFilepath() const { cChecker *checker = GetChecker(); @@ -338,7 +338,7 @@ std::string cIssue::GetXODRFilepath() const if (nullptr != bundle) { - return bundle->GetXODRFilePath(); + return bundle->GetInputFilePath(); } return ""; } diff --git a/src/common/src/result_format/c_result_container.cpp b/src/common/src/result_format/c_result_container.cpp index 692dbbd5..2ae11ad7 100644 --- a/src/common/src/result_format/c_result_container.cpp +++ b/src/common/src/result_format/c_result_container.cpp @@ -345,55 +345,35 @@ cIssue *cResultContainer::GetIssueById(unsigned long long id) const return nullptr; } -// Returns true if a xodr filename is available -bool cResultContainer::HasXODRFileName() const +// Returns true if a input filename is available +bool cResultContainer::HasInputFileName() const { - return !GetXODRFileName().empty(); + return !GetInputFileName().empty(); } -// Returns true if a xosc filename is available -bool cResultContainer::HasXOSCFilePath() const -{ - return !GetXOSCFilePath().empty(); -} - -// Returns the xodr filename. Empty string if no file name is present. -std::string cResultContainer::GetXODRFileName(const bool bRemoveExtension) const -{ - for (const auto &itCheckerBundle : m_Bundles) - { - std::string xodrFilename = itCheckerBundle->GetXODRFileName(bRemoveExtension); - - if (!xodrFilename.empty()) - return xodrFilename; - } - - return ""; -} - -// Returns the xodr path of the first checkerbundle. Empty string if no file name is present. -std::string cResultContainer::GetXODRFilePath() const +// Returns the input filename. Empty string if no file name is present. +std::string cResultContainer::GetInputFileName(const bool bRemoveExtension) const { for (const auto &itCheckerBundle : m_Bundles) { - std::string xodrFilepath = itCheckerBundle->GetXODRFilePath(); + std::string inputFilename = itCheckerBundle->GetInputFileName(bRemoveExtension); - if (!xodrFilepath.empty()) - return xodrFilepath; + if (!inputFilename.empty()) + return inputFilename; } return ""; } -// Returns the xodr path of the first checkerbundle. Empty std::string if no file name is present. -std::string cResultContainer::GetXOSCFilePath() const +// Returns the input path of the first checkerbundle. Empty string if no file name is present. +std::string cResultContainer::GetInputFilePath() const { for (const auto &itCheckerBundle : m_Bundles) { - std::string xoscFilepath = itCheckerBundle->GetXOSCFilePath(); + std::string inputFilepath = itCheckerBundle->GetInputFilePath(); - if (!xoscFilepath.empty()) - return xoscFilepath; + if (!inputFilepath.empty()) + return inputFilepath; } return ""; diff --git a/src/report_modules/report_module_gui/src/ui/c_checker_widget.cpp b/src/report_modules/report_module_gui/src/ui/c_checker_widget.cpp index d7dd204a..d72fc2f0 100644 --- a/src/report_modules/report_module_gui/src/ui/c_checker_widget.cpp +++ b/src/report_modules/report_module_gui/src/ui/c_checker_widget.cpp @@ -610,8 +610,7 @@ void cCheckerWidget::ShowIssue(cIssue *const itemToShow, const cLocationsContain { if (nullptr != itemToShow) { - bool hasXODRPath = false; - bool hasXOSCPath = false; + bool hasInputPath = false; cChecker *checker = itemToShow->GetChecker(); ShowDetails(itemToShow); @@ -623,11 +622,8 @@ void cCheckerWidget::ShowIssue(cIssue *const itemToShow, const cLocationsContain cCheckerBundle *checkerBundle = checker->GetCheckerBundle(); SelectCheckerBundle(checkerBundle); - if (checkerBundle->GetXODRFilePath() != "") - hasXODRPath = true; - - if (checkerBundle->GetXOSCFilePath() != "") - hasXOSCPath = true; + if (checkerBundle->GetInputFilePath() != "") + hasInputPath = true; } // Evaluate extended information groups for more sophisticated reports @@ -642,13 +638,9 @@ void cCheckerWidget::ShowIssue(cIssue *const itemToShow, const cLocationsContain int row = fileLocation->GetRow(); - // If issue referes to an OpenDRIVE, show it! - if (hasXODRPath) - ShowXODRIssue(itemToShow, row); - - // If issue referes to an OpenSCENARIO, show it! - if (hasXOSCPath) - ShowXOSCIssue(itemToShow, row); + // If issue referes to a file, show it! + if (hasInputPath) + ShowInputIssue(itemToShow, row); } // Show InertialLocations in Viewer @@ -664,12 +656,8 @@ void cCheckerWidget::ShowIssue(cIssue *const itemToShow, const cLocationsContain // xodr or xosc file, it should have a FileLocation // If issue referes to an OpenDRIVE, show it! - if (hasXODRPath) - ShowXODRIssue(itemToShow, -1); - - // If issue referes to an OpenSCENARIO, show it! - if (hasXOSCPath) - ShowXOSCIssue(itemToShow, -1); + if (hasInputPath) + ShowInputIssue(itemToShow, -1); } } } diff --git a/src/report_modules/report_module_gui/src/ui/c_checker_widget.h b/src/report_modules/report_module_gui/src/ui/c_checker_widget.h index 5719f9fb..b0dc6e0d 100644 --- a/src/report_modules/report_module_gui/src/ui/c_checker_widget.h +++ b/src/report_modules/report_module_gui/src/ui/c_checker_widget.h @@ -123,13 +123,7 @@ class cCheckerWidget : public QWidget * Invoked if an issue will be showed. * \param row: Row which should be displayed. -1 for no specific row. */ - void ShowXODRIssue(const cIssue *const issue, const int row) const; - - /* - * Invoked if an issue will be showed. - * \param row: Row which should be displayed. -1 for no specific row. - */ - void ShowXOSCIssue(const cIssue *const issue, const int row) const; + void ShowInputIssue(const cIssue *const issue, const int row) const; /* * Invoked if an issue should be showed in 3DViewer. diff --git a/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp b/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp index eeec372d..032a5194 100644 --- a/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp +++ b/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp @@ -52,13 +52,9 @@ void cReportModuleWindow::loadFileContent(cResultContainer *const container) { QString fileToOpen; textEditArea->setPlainText(""); - if (container->HasXODRFileName()) + if (container->HasInputFileName()) { - fileToOpen = container->GetXODRFilePath().c_str(); - } - else if (container->HasXOSCFilePath()) - { - fileToOpen = container->GetXOSCFilePath().c_str(); + fileToOpen = container->GetInputFilePath().c_str(); } else { @@ -166,8 +162,7 @@ cReportModuleWindow::cReportModuleWindow(cResultContainer *resultContainer, cons setWindowTitle(this->_reportModuleName); connect(_checkerWidget, &cCheckerWidget::Load, this, &cReportModuleWindow::loadFileContent); - connect(_checkerWidget, &cCheckerWidget::ShowXODRIssue, this, &cReportModuleWindow::highlightRow); - connect(_checkerWidget, &cCheckerWidget::ShowXOSCIssue, this, &cReportModuleWindow::highlightRow); + connect(_checkerWidget, &cCheckerWidget::ShowInputIssue, this, &cReportModuleWindow::highlightRow); connect(_checkerWidget, &cCheckerWidget::ShowIssueIn3DViewer, this, &cReportModuleWindow::ShowIssueInViewer); // Create Menu entries for all viewers in plugin @@ -366,8 +361,7 @@ void cReportModuleWindow::LoadResultContainer(cResultContainer *const container) for (std::list::const_iterator itBundle = bundles.cbegin(); itBundle != bundles.cend(); itBundle++) { - ValidateInputFile(*itBundle, &fileReplacementMap, "XodrFile", "OpenDRIVE", "OpenDRIVE (*.xodr)"); - ValidateInputFile(*itBundle, &fileReplacementMap, "XoscFile", "OpenSCENARIO", "OpenSCENARIO (*.xosc)"); + ValidateInputFile(*itBundle, &fileReplacementMap, "InputFile", "Input file"); } if (_checkerWidget != nullptr) @@ -375,8 +369,7 @@ void cReportModuleWindow::LoadResultContainer(cResultContainer *const container) } void cReportModuleWindow::ValidateInputFile(cCheckerBundle *const bundle, QMap *fileReplacementMap, - const std::string ¶meter, const std::string &fileName, - const std::string &filter) const + const std::string ¶meter, const std::string &fileName) const { std::string filePath = bundle->GetParam(parameter); @@ -401,7 +394,7 @@ void cReportModuleWindow::ValidateInputFile(cCheckerBundle *const bundle, QMapHasXODRFileName() || _results->HasXOSCFilePath())) + if (_results != nullptr && _results->HasInputFileName()) { setCursor(Qt::WaitCursor); QApplication::processEvents(); @@ -483,7 +476,7 @@ void cReportModuleWindow::StartViewer(Viewer *viewer) } // Initilialize with xosc and xodr file - result = viewer->Initialize_f(_results->GetXOSCFilePath().c_str(), _results->GetXODRFilePath().c_str()); + result = viewer->Initialize_f(_results->GetInputFilePath().c_str(), _results->GetInputFilePath().c_str()); if (!result) { diff --git a/src/report_modules/report_module_gui/src/ui/c_report_module_window.h b/src/report_modules/report_module_gui/src/ui/c_report_module_window.h index e8e982bc..8d3ef34b 100644 --- a/src/report_modules/report_module_gui/src/ui/c_report_module_window.h +++ b/src/report_modules/report_module_gui/src/ui/c_report_module_window.h @@ -113,7 +113,7 @@ class cReportModuleWindow : public QMainWindow // Checks if the OpenDRIVE or OpenSCENARIO could be loaded void ValidateInputFile(cCheckerBundle *const bundle, QMap *fileReplacementMap, - const std::string ¶meter, const std::string &fileName, const std::string &filter) const; + const std::string ¶meter, const std::string &fileName) const; QFont getCodeFont(); void LoadResultFromFilepath(const QString &filePath); diff --git a/src/report_modules/report_module_text/src/report_format_text.cpp b/src/report_modules/report_module_text/src/report_format_text.cpp index 29165c00..c81d5a3f 100644 --- a/src/report_modules/report_module_text/src/report_format_text.cpp +++ b/src/report_modules/report_module_text/src/report_format_text.cpp @@ -271,11 +271,8 @@ void WriteResults(const char *file, cResultContainer *ptrResultContainer) ss << BASIC_SEPARATOR_LINE; ss << std::endl; - if ((*bundles.begin())->GetXODRFileName().size() > 0) - ss << "XodrFile: " << (*bundles.begin())->GetXODRFileName(false) << std::endl; - - if ((*bundles.begin())->GetXOSCFileName().size() > 0) - ss << "XoscFile: " << (*bundles.begin())->GetXOSCFileName(false) << std::endl; + if ((*bundles.begin())->GetInputFileName().size() > 0) + ss << "InputFile: " << (*bundles.begin())->GetInputFileName(false) << std::endl; ss << std::endl; diff --git a/src/result_pooling/src/result_pooling.cpp b/src/result_pooling/src/result_pooling.cpp index 7797c469..60bc764a 100644 --- a/src/result_pooling/src/result_pooling.cpp +++ b/src/result_pooling/src/result_pooling.cpp @@ -374,20 +374,14 @@ static void AddFileLocationsToIssues() std::list checkerBundles = pResultContainer->GetCheckerBundles(); for (const auto &itCheckerBundle : checkerBundles) { - cXPathEvaluator xodrXPathEvaluator; - cXPathEvaluator xoscXPathEvaluator; + cXPathEvaluator inputXPathEvaluator; - std::string xodrFilePath = itCheckerBundle->GetXODRFilePath(); - std::string xoscFilePath = itCheckerBundle->GetXOSCFilePath(); + std::string inputFilePath = itCheckerBundle->GetInputFilePath(); // Init xml files on xpath evaluators - bool successXodrContent = false; - if (!xodrFilePath.empty()) - successXodrContent = xodrXPathEvaluator.SetXmlContent(QString::fromStdString(xodrFilePath)); - - bool successXoscContent = false; - if (!xoscFilePath.empty()) - successXoscContent = xoscXPathEvaluator.SetXmlContent(QString::fromStdString(xoscFilePath)); + bool successInputContent = false; + if (!inputFilePath.empty()) + successInputContent = inputXPathEvaluator.SetXmlContent(QString::fromStdString(inputFilePath)); // Evaluate XPath for every issue and set calculated file location std::list issues = itCheckerBundle->GetIssues(); @@ -408,23 +402,12 @@ static void AddFileLocationsToIssues() QVector rows; bool successGetRows = false; - if (xpathQt.startsWith("/OpenSCENARIO/") && successXoscContent) - { - successGetRows = xoscXPathEvaluator.GetAffectedRowsOfXPath(xpathQt, rows); - if (successGetRows) - { - for (int i = 0; i < rows.size(); ++i) - location->AddExtendedInformation(new cFileLocation(rows.at(i), 0)); - } - } - else if (xpathQt.startsWith("/OpenDRIVE/") && successXodrContent) + + successGetRows = inputXPathEvaluator.GetAffectedRowsOfXPath(xpathQt, rows); + if (successGetRows) { - successGetRows = xodrXPathEvaluator.GetAffectedRowsOfXPath(xpathQt, rows); - if (successGetRows) - { - for (int i = 0; i < rows.size(); ++i) - location->AddExtendedInformation(new cFileLocation(rows.at(i), 0)); - } + for (int i = 0; i < rows.size(); ++i) + location->AddExtendedInformation(new cFileLocation(rows.at(i), 0)); } if (!successGetRows) diff --git a/src/runtime/src/c_configuration_validator.cpp b/src/runtime/src/c_configuration_validator.cpp index 0115025a..d96cde15 100644 --- a/src/runtime/src/c_configuration_validator.cpp +++ b/src/runtime/src/c_configuration_validator.cpp @@ -19,10 +19,7 @@ bool cConfigurationValidator::ValidateConfiguration(cConfiguration *const config if (!success) return false; - success = CheckParameterNotEmptyAndCorrectExtension(configuration, PARAM_XODR_FILE, "xodr", message); - if (!success) - return false; - success = CheckParameterNotEmptyAndCorrectExtension(configuration, PARAM_XOSC_FILE, "xosc", message); + success = CheckParameterNotEmpty(configuration, PARAM_INPUT_FILE, message); if (!success) return false; @@ -31,19 +28,17 @@ bool cConfigurationValidator::ValidateConfiguration(cConfiguration *const config bool cConfigurationValidator::CheckNecessaryParametersExist(cConfiguration *const configuration, std::string &message) { - if (!configuration->HasParam(PARAM_XODR_FILE) && !configuration->HasParam(PARAM_XOSC_FILE)) + if (!configuration->HasParam(PARAM_INPUT_FILE)) { - message = "Configuration needs a parameter '" + PARAM_XODR_FILE + "' or '" + PARAM_XOSC_FILE + "' for running."; + message = "Configuration needs a parameter '" + PARAM_INPUT_FILE + "' for running."; return false; } return true; } -bool cConfigurationValidator::CheckParameterNotEmptyAndCorrectExtension(cConfiguration *const configuration, - const std::string ¶mName, - const std::string &extension, - std::string &message) +bool cConfigurationValidator::CheckParameterNotEmpty(cConfiguration *const configuration, const std::string ¶mName, + std::string &message) { if (configuration->HasParam(paramName)) { @@ -54,12 +49,6 @@ bool cConfigurationValidator::CheckParameterNotEmptyAndCorrectExtension(cConfigu message = "Parameter '" + paramName + "' is empty. Please specify a value."; return false; } - - if (!StringEndsWith(ToLower(paramValue), "." + extension)) - { - message = "Parameter '" + paramName + "' needs to be a path to a valid " + extension + " file."; - return false; - } } return true; diff --git a/src/runtime/src/c_configuration_validator.h b/src/runtime/src/c_configuration_validator.h index 18428269..478ddd53 100644 --- a/src/runtime/src/c_configuration_validator.h +++ b/src/runtime/src/c_configuration_validator.h @@ -24,10 +24,9 @@ class cConfigurationValidator // Check if at least one of the necessary parameters exists static bool CheckNecessaryParametersExist(cConfiguration *const configuration, std::string &message); - // Check if parameter is valid (is not empty and has the expected file extension) - static bool CheckParameterNotEmptyAndCorrectExtension(cConfiguration *const configuration, - const std::string ¶mName, const std::string &extension, - std::string &message); + // Check if parameter is valid (is not empty) + static bool CheckParameterNotEmpty(cConfiguration *const configuration, const std::string ¶mName, + std::string &message); }; #endif diff --git a/src/runtime/src/runtime.cpp b/src/runtime/src/runtime.cpp index 1490a33d..a7c46606 100644 --- a/src/runtime/src/runtime.cpp +++ b/src/runtime/src/runtime.cpp @@ -18,8 +18,7 @@ int main(int argc, char *argv[]) std::string strToolpath = argv[0]; std::string strConfigurationFilepath = ""; - std::string strXODRFilepath = ""; - std::string strXOSCFilePath = ""; + std::string strInputFilepath = ""; std::cout << std::endl << std::endl; @@ -33,20 +32,12 @@ int main(int argc, char *argv[]) std::cout << "Configuration: " << strConfigurationFilepath << std::endl; } } - else if (strcmp(argv[i], "-xodr") == 0) + else if (strcmp(argv[i], "-input") == 0) { if (argc >= i + 1) { - strXODRFilepath = argv[i + 1]; - std::cout << "XODR: " << strXODRFilepath << std::endl; - } - } - else if (strcmp(argv[i], "-xosc") == 0) - { - if (argc >= i + 1) - { - strXOSCFilePath = argv[i + 1]; - std::cout << "XOSC: " << strXOSCFilePath << std::endl; + strInputFilepath = argv[i + 1]; + std::cout << "Input: " << strInputFilepath << std::endl; } } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) @@ -61,7 +52,7 @@ int main(int argc, char *argv[]) strConfigurationFilepath = argv[1]; QApplication app(argc, argv); - RunConfigGUI(strConfigurationFilepath, strXODRFilepath, strXOSCFilePath, app); + RunConfigGUI(strConfigurationFilepath, strInputFilepath, app); return 0; } @@ -73,21 +64,18 @@ void ShowHelp(const std::string &toolPath) GetFileName(&applicationNameWithoutExt, true); std::cout << "\nUsage of " << applicationNameWithoutExt << ":" << std::endl; - std::cout << "\nOpen the application with DefaultXodrConfiguration.xml: \n" + std::cout << "\nOpen the application with DefaultConfiguration.xml: \n" << applicationName << " myConfiguration.xml" << std::endl; - std::cout << "\nOpen the application with myConfiguration.xml and a given xodr which is under " + std::cout << "\nOpen the application with myConfiguration.xml and a given input file which is under " "test. \n" - << applicationName << " -config myConfiguration.xml -xodr myTrack.xodr " << std::endl; - std::cout << "\nOpen the application with myConfiguration.xml and a given xosc which is under " - "test. \n" - << applicationName << " -config myConfiguration.xml -xosc myTrack.xosc " << std::endl; + << applicationName << " -config myConfiguration.xml -input myTrack.xodr " << std::endl; std::cout << "\n\n"; } -void RunConfigGUI(const std::string &strConfigurationFilepath, const std::string &strXODRFilepath, - const std::string &strXOSCFilePath, const QApplication &app) +void RunConfigGUI(const std::string &strConfigurationFilepath, const std::string &strInputFilepath, + const QApplication &app) { - cRuntimeWindow mainWindow(strConfigurationFilepath, strXODRFilepath, strXOSCFilePath); + cRuntimeWindow mainWindow(strConfigurationFilepath, strInputFilepath); mainWindow.show(); app.processEvents(); diff --git a/src/runtime/src/runtime.h b/src/runtime/src/runtime.h index 95b42153..bcfe818e 100644 --- a/src/runtime/src/runtime.h +++ b/src/runtime/src/runtime.h @@ -28,5 +28,5 @@ void ShowHelp(const std::string &applicationName); /** * Runs the config gui */ -void RunConfigGUI(const std::string &strConfigurationFilepath, const std::string &strXODRFilepath, - const std::string &strXOSCFilePath, const QApplication &app); +void RunConfigGUI(const std::string &strConfigurationFilepath, const std::string &strInputFilepath, + const QApplication &app); diff --git a/src/runtime/src/ui/c_global_param_dialog.cpp b/src/runtime/src/ui/c_global_param_dialog.cpp index efa271a4..d975c061 100644 --- a/src/runtime/src/ui/c_global_param_dialog.cpp +++ b/src/runtime/src/ui/c_global_param_dialog.cpp @@ -31,7 +31,7 @@ void cGlobalParamDialog::InitUIElements(const QString &initalParamName, const QS QStringList items; // Add default parameters - items << QString::fromStdString(PARAM_XODR_FILE) << QString::fromStdString(PARAM_XOSC_FILE); + items << QString::fromStdString(PARAM_INPUT_FILE); // Add parameters, which are in current config std::vector params = currentConfig->GetParams().GetParams(); @@ -63,10 +63,8 @@ void cGlobalParamDialog::SwitchCall(const QString ¶mName) { RemoveFileOpenButton(); - if (paramName.toLower() == QString::fromStdString(PARAM_XODR_FILE).toLower()) - AddFileOpenButton(SLOT(OpenXODRFile())); - else if (paramName.toLower() == QString::fromStdString(PARAM_XOSC_FILE).toLower()) - AddFileOpenButton(SLOT(OpenXOSCFile())); + if (paramName.toLower() == QString::fromStdString(PARAM_INPUT_FILE).toLower()) + AddFileOpenButton(SLOT(OpenInputFile())); } void cGlobalParamDialog::AddFileOpenButton(const char *slot) @@ -93,34 +91,12 @@ void cGlobalParamDialog::SaveAndClose() _paramName = _paramNameComboBox->currentText(); _paramValue = _paramValueEdit->text(); - if (_paramName.toLower() == QString::fromStdString(PARAM_XOSC_FILE).toLower()) - { - std::string xoscFilePath = _paramValue.toStdString(); - std::string xodrFilePath = ""; - - // When we could retrieve a path, set it - if (GetXodrFilePathFromXosc(xoscFilePath, xodrFilePath)) - _processView->SetGlobalParamXodrFile(xodrFilePath); - } - else if (_paramName.toLower() == QString::fromStdString(PARAM_XODR_FILE).toLower()) - { - // TODO: warn xodr not matching - } - accept(); } -void cGlobalParamDialog::OpenXODRFile() -{ - QString filePath = QFileDialog::getOpenFileName(this, tr("Open File"), "", tr("OpenDRIVE (*.xodr)")); - - if (!filePath.isEmpty()) - _paramValueEdit->setText(filePath); -} - -void cGlobalParamDialog::OpenXOSCFile() +void cGlobalParamDialog::OpenInputFile() { - QString filePath = QFileDialog::getOpenFileName(this, tr("Open File"), "", tr("OpenSCENARIO (*.xosc)")); + QString filePath = QFileDialog::getOpenFileName(this, tr("Open File"), "", ""); if (!filePath.isEmpty()) _paramValueEdit->setText(filePath); diff --git a/src/runtime/src/ui/c_global_param_dialog.h b/src/runtime/src/ui/c_global_param_dialog.h index 74781c8b..10888dfc 100644 --- a/src/runtime/src/ui/c_global_param_dialog.h +++ b/src/runtime/src/ui/c_global_param_dialog.h @@ -38,8 +38,7 @@ class cGlobalParamDialog : public cParamDialog public slots: void SwitchCall(const QString ¶mName); void SaveAndClose(); - void OpenXODRFile(); - void OpenXOSCFile(); + void OpenInputFile(); }; #endif diff --git a/src/runtime/src/ui/c_process_view.cpp b/src/runtime/src/ui/c_process_view.cpp index 79a394b9..7129b532 100644 --- a/src/runtime/src/ui/c_process_view.cpp +++ b/src/runtime/src/ui/c_process_view.cpp @@ -446,7 +446,7 @@ void cProcessView::AddGlobalParam() cConfiguration currentConfig; GetConfigurationFromView(¤tConfig); - cGlobalParamDialog newDlg("XodrFile", "", true, this, ¤tConfig); + cGlobalParamDialog newDlg("InputFile", "", true, this, ¤tConfig); if (newDlg.exec() == QDialog::Accepted) { @@ -476,33 +476,6 @@ void cProcessView::AddGlobalParam() } } -void cProcessView::SetGlobalParamXodrFile(const std::string &xodrFilePath) -{ - std::string paramName = PARAM_XODR_FILE; - std::string paramValue = xodrFilePath; - - QTreeWidgetItem *existingItem = HasParamItem(invisibleRootItem(), paramName); - if (existingItem) - { - QMessageBox::StandardButton reply = - QMessageBox::question(this, "Overwrite Parameter", - "\nShould be the parameter '" + QString::fromStdString(paramName) + - "' overwritten with:\n\n" + QString::fromStdString(paramValue), - QMessageBox::Yes | QMessageBox::No); - - if (reply == QMessageBox::Yes) - { - SetParamDataOnItem(existingItem, paramName, paramValue); - emit ChangeConfiguration(); - } - } - else - { - AddParamItemToRoot(paramName, paramValue, true); - emit ChangeConfiguration(); - } -} - void cProcessView::EditParam() { if (selectedItems().count() > 0) diff --git a/src/runtime/src/ui/c_process_view.h b/src/runtime/src/ui/c_process_view.h index 31e32ca0..14f2b9bf 100644 --- a/src/runtime/src/ui/c_process_view.h +++ b/src/runtime/src/ui/c_process_view.h @@ -93,8 +93,6 @@ class cProcessView : public QTreeWidget void GetConfigurationFromView(cConfiguration *newConfiguration); - void SetGlobalParamXodrFile(const std::string &xodrFilePath); - private: // Add checker bundle item to invisible root item void AddCheckerBundleItemToRoot(cConfigurationCheckerBundle *const checkerBundle, const bool expand = false); diff --git a/src/runtime/src/ui/c_runtime_window.cpp b/src/runtime/src/ui/c_runtime_window.cpp index 5fe8e492..dd918bee 100644 --- a/src/runtime/src/ui/c_runtime_window.cpp +++ b/src/runtime/src/ui/c_runtime_window.cpp @@ -22,11 +22,10 @@ #include "../c_configuration_validator.h" #include "c_process_view.h" -const QString cRuntimeWindow::DEFAULT_XODR_CONFIG = "DefaultXodrConfiguration.xml"; -const QString cRuntimeWindow::DEFAULT_XOSC_CONFIG = "DefaultXoscConfiguration.xml"; +const QString cRuntimeWindow::DEFAULT_CONFIG = "DefaultConfiguration.xml"; -cRuntimeWindow::cRuntimeWindow(const std::string &strConfigurationFilepath, const std::string &xodrFile, - const std::string &xoscFile, QWidget *parent) +cRuntimeWindow::cRuntimeWindow(const std::string &strConfigurationFilepath, const std::string &inputFile, + QWidget *parent) : QMainWindow(parent) { @@ -119,10 +118,10 @@ cRuntimeWindow::cRuntimeWindow(const std::string &strConfigurationFilepath, cons else { // Standardkonfiguration laden - QString defaultXODRConfigPath = GetApplicationDir() + "/" + DEFAULT_XODR_CONFIG; - if (CheckIfFileExists(defaultXODRConfigPath.toStdString())) + QString defaultConfigPath = GetApplicationDir() + "/" + DEFAULT_CONFIG; + if (CheckIfFileExists(defaultConfigPath.toStdString())) { - LoadConfiguration(&_currentConfiguration, defaultXODRConfigPath); + LoadConfiguration(&_currentConfiguration, defaultConfigPath); } // Neue Konfiguration erstellen else @@ -131,16 +130,10 @@ cRuntimeWindow::cRuntimeWindow(const std::string &strConfigurationFilepath, cons } } - // Apply Xodr and Xosc settings from command line - if (!xodrFile.empty()) + // Apply input file settings from command line + if (!inputFile.empty()) { - _currentConfiguration.SetParam(PARAM_XODR_FILE, xodrFile); - OnChangeConfiguration(); - } - - if (!xoscFile.empty()) - { - _currentConfiguration.SetParam(PARAM_XOSC_FILE, xoscFile); + _currentConfiguration.SetParam(PARAM_INPUT_FILE, inputFile); OnChangeConfiguration(); } @@ -157,11 +150,11 @@ const QString cRuntimeWindow::GetWorkingDir() return QString::fromStdString(fs::current_path().string()); } - -bool cRuntimeWindow::ValidateAndWrite(cConfiguration& configuration, const std::string& filePath){ +bool cRuntimeWindow::ValidateAndWrite(cConfiguration &configuration, const std::string &filePath) +{ std::string message = ""; - if (!cConfigurationValidator::ValidateConfiguration(&configuration, - message)) { + if (!cConfigurationValidator::ValidateConfiguration(&configuration, message)) + { std::stringstream ssDetails; ssDetails << "Configuration is invalid." << std::endl << std::endl; @@ -170,8 +163,7 @@ bool cRuntimeWindow::ValidateAndWrite(cConfiguration& configuration, const std:: ssDetails << std::endl << std::endl; ssDetails << "Please fix it before saving configuration file"; - QMessageBox::warning(this, tr("Error"), tr(ssDetails.str().c_str()), - QMessageBox::Ok); + QMessageBox::warning(this, tr("Error"), tr(ssDetails.str().c_str()), QMessageBox::Ok); return false; } configuration.WriteConfigurationToFile(filePath); @@ -196,8 +188,7 @@ bool cRuntimeWindow::SaveConfigurationFile() QFileInfo fileInfo(_currentConfigurationPath); // If we opened a default configuration the user cannot overwrite this - if (fileInfo.fileName().toLower() == DEFAULT_XODR_CONFIG.toLower() || - fileInfo.fileName().toLower() == DEFAULT_XOSC_CONFIG.toLower()) + if (fileInfo.fileName().toLower() == DEFAULT_CONFIG.toLower()) { // Open Dialog return SaveAsConfigurationFile(); @@ -213,8 +204,10 @@ bool cRuntimeWindow::SaveConfigurationFile() { UpdateConfiguration(); bool validation_result = false; - validation_result = ValidateAndWrite(_currentConfiguration, _currentConfigurationPath.toLocal8Bit().data()); - if (!validation_result){ + validation_result = + ValidateAndWrite(_currentConfiguration, _currentConfigurationPath.toLocal8Bit().data()); + if (!validation_result) + { return false; } _configurationChanged = false; @@ -235,7 +228,6 @@ bool cRuntimeWindow::SaveConfigurationFile() return SaveAsConfigurationFile(); } - bool cRuntimeWindow::SaveAsConfigurationFile() { QString filePath = @@ -245,8 +237,7 @@ bool cRuntimeWindow::SaveAsConfigurationFile() { QFileInfo fileInfo(filePath); - if (fileInfo.fileName().toLower() == DEFAULT_XODR_CONFIG.toLower() || - fileInfo.fileName().toLower() == DEFAULT_XOSC_CONFIG.toLower()) + if (fileInfo.fileName().toLower() == DEFAULT_CONFIG.toLower()) { QMessageBox::information( this, "Save Configuration", @@ -263,7 +254,8 @@ bool cRuntimeWindow::SaveAsConfigurationFile() _currentConfigurationPath = filePath; bool validation_result = false; validation_result = ValidateAndWrite(_currentConfiguration, filePath.toLocal8Bit().data()); - if (!validation_result){ + if (!validation_result) + { return false; } @@ -327,8 +319,7 @@ void cRuntimeWindow::CreateNewConfiguration(cConfiguration *const configuration) _currentConfigurationPath = ""; configuration->Clear(); - configuration->SetParam(PARAM_XODR_FILE, ""); - configuration->SetParam(PARAM_XOSC_FILE, ""); + configuration->SetParam(PARAM_INPUT_FILE, ""); OnChangeConfiguration(); } @@ -347,7 +338,6 @@ void cRuntimeWindow::NewConfiguration() ShowConfiguration(&_currentConfiguration); } - void cRuntimeWindow::OnChangeConfiguration() { _configurationChanged = true; @@ -355,7 +345,6 @@ void cRuntimeWindow::OnChangeConfiguration() SetupWindowTitle(); } - int cRuntimeWindow::ExecuteProcessAndAddConfiguration(const QString &processPath) { QProcess process; diff --git a/src/runtime/src/ui/c_runtime_window.h b/src/runtime/src/ui/c_runtime_window.h index 5a72254e..53287dc5 100644 --- a/src/runtime/src/ui/c_runtime_window.h +++ b/src/runtime/src/ui/c_runtime_window.h @@ -31,8 +31,7 @@ class cRuntimeWindow : public QMainWindow bool _configurationChanged{false}; public: - cRuntimeWindow(const std::string &configurationFilePath, const std::string &xodrFile, const std::string &xoscFile, - QWidget *parent = 0); + cRuntimeWindow(const std::string &configurationFilePath, const std::string &inputFile, QWidget *parent = 0); /* * Loads a configuration from file to datastructure @@ -49,7 +48,6 @@ class cRuntimeWindow : public QMainWindow // Updates the internal configuration void UpdateConfiguration(); - private slots: // Open result file void OpenConfigurationFile(); @@ -57,7 +55,7 @@ class cRuntimeWindow : public QMainWindow // SaveAs configuration file bool SaveAsConfigurationFile(); - bool ValidateAndWrite(cConfiguration& , const std::string&); + bool ValidateAndWrite(cConfiguration &, const std::string &); // Save configuration file bool SaveConfigurationFile(); @@ -82,11 +80,8 @@ class cRuntimeWindow : public QMainWindow void Log(QString log); private: - // Filename of the default xodr configuration - static const QString DEFAULT_XODR_CONFIG; - - // Filename of the default xosc configuration - static const QString DEFAULT_XOSC_CONFIG; + // Filename of the default configuration + static const QString DEFAULT_CONFIG; /** * Get application directory @@ -102,7 +97,6 @@ class cRuntimeWindow : public QMainWindow */ const QString GetWorkingDir(); - // Changes the window title of the application void SetupWindowTitle(); diff --git a/test/function/examples/example_checker_bundle/files/DemoCheckerBundle_config.xml b/test/function/examples/example_checker_bundle/files/DemoCheckerBundle_config.xml index 379a1940..fc533a59 100644 --- a/test/function/examples/example_checker_bundle/files/DemoCheckerBundle_config.xml +++ b/test/function/examples/example_checker_bundle/files/DemoCheckerBundle_config.xml @@ -1,4 +1,4 @@ - + - + - - + + diff --git a/test/function/report_modules/report_module_text/files/TextReport_config.xml b/test/function/report_modules/report_module_text/files/TextReport_config.xml index 7482e052..273680c2 100644 --- a/test/function/report_modules/report_module_text/files/TextReport_config.xml +++ b/test/function/report_modules/report_module_text/files/TextReport_config.xml @@ -1,18 +1,19 @@ - + - + - - + + diff --git a/test/function/result_pooling/files/RoadVerifier.xqar b/test/function/result_pooling/files/RoadVerifier.xqar index c2dfc704..141dadd3 100644 --- a/test/function/result_pooling/files/RoadVerifier.xqar +++ b/test/function/result_pooling/files/RoadVerifier.xqar @@ -1,30 +1,43 @@ - + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + - - + + diff --git a/test/function/result_pooling/files/ScenarioChecker.xqar b/test/function/result_pooling/files/ScenarioChecker.xqar index d25dbe63..a9056879 100644 --- a/test/function/result_pooling/files/ScenarioChecker.xqar +++ b/test/function/result_pooling/files/ScenarioChecker.xqar @@ -1,11 +1,13 @@ - + - - - + + + - + diff --git a/test/function/result_pooling/files/XodrSchemaChecker.xqar b/test/function/result_pooling/files/XodrSchemaChecker.xqar index b3d4be61..1e57c3b3 100644 --- a/test/function/result_pooling/files/XodrSchemaChecker.xqar +++ b/test/function/result_pooling/files/XodrSchemaChecker.xqar @@ -1,10 +1,13 @@ - + - - - - + + + + diff --git a/test/function/result_pooling/files/XodrStatisticChecker.xqar b/test/function/result_pooling/files/XodrStatisticChecker.xqar index 71e46de0..67a3ec85 100644 --- a/test/function/result_pooling/files/XodrStatisticChecker.xqar +++ b/test/function/result_pooling/files/XodrStatisticChecker.xqar @@ -1,92 +1,113 @@ - + - - - - + + + + - - + + - - + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - - - + + + + - - - - + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - + + + + diff --git a/test/function/result_pooling/files/XoscSchemaChecker.xqar b/test/function/result_pooling/files/XoscSchemaChecker.xqar index f9cb897d..a98c21e0 100644 --- a/test/function/result_pooling/files/XoscSchemaChecker.xqar +++ b/test/function/result_pooling/files/XoscSchemaChecker.xqar @@ -1,11 +1,14 @@ - + - - - + + + - + diff --git a/test/function/result_pooling/files/two_bundles_config.xml b/test/function/result_pooling/files/two_bundles_config.xml index c86be460..0295d036 100644 --- a/test/function/result_pooling/files/two_bundles_config.xml +++ b/test/function/result_pooling/files/two_bundles_config.xml @@ -1,7 +1,7 @@ - + diff --git a/test/function/runtime/files/DemoCheckerBundle_config.xml b/test/function/runtime/files/DemoCheckerBundle_config.xml index 25f92817..fc533a59 100644 --- a/test/function/runtime/files/DemoCheckerBundle_config.xml +++ b/test/function/runtime/files/DemoCheckerBundle_config.xml @@ -1,18 +1,18 @@ - + - + - - + + diff --git a/test/function/runtime/files/XodrSchemaChecker_config.xml b/test/function/runtime/files/XodrSchemaChecker_config.xml index a0e39dbe..98824132 100644 --- a/test/function/runtime/files/XodrSchemaChecker_config.xml +++ b/test/function/runtime/files/XodrSchemaChecker_config.xml @@ -1,19 +1,19 @@ - + - + - - - + + + diff --git a/test/function/runtime/files/XoscSchemaChecker_config.xml b/test/function/runtime/files/XoscSchemaChecker_config.xml index c5d5050e..e7f96f90 100644 --- a/test/function/runtime/files/XoscSchemaChecker_config.xml +++ b/test/function/runtime/files/XoscSchemaChecker_config.xml @@ -1,19 +1,19 @@ - + - + - - - + + + From 8b009e716331f3f200118c291f7f2045d760eeae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Abrah=C3=A3o?= Date: Mon, 19 Aug 2024 16:06:48 +0200 Subject: [PATCH 03/12] Update runtime requirements to remove exact dependencies version match (#122) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick Abrahão --- runtime/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/requirements.txt b/runtime/requirements.txt index 15559a0c..19f48381 100644 --- a/runtime/requirements.txt +++ b/runtime/requirements.txt @@ -1,2 +1,2 @@ -lxml==5.0.0 -pytest==8.2.1 +lxml>=5.0.0 +pytest>=8.2.1 From d5b3a03a46f6e0d2a3e9fe8784722bf7b7307bec Mon Sep 17 00:00:00 2001 From: romanodanilo <62891297+romanodanilo@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:28:11 +0200 Subject: [PATCH 04/12] Fix result pooling file locations (#120) Signed-off-by: romanodanilo Signed-off-by: romanodanilo <62891297+romanodanilo@users.noreply.github.com> --- demo_pipeline/templates/otx_template.xml | 4 +++- demo_pipeline/templates/xodr_template.xml | 1 + demo_pipeline/templates/xosc_template.xml | 1 - .../report_module_gui/src/ui/c_report_module_window.cpp | 4 ++-- src/result_pooling/src/result_pooling.cpp | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/demo_pipeline/templates/otx_template.xml b/demo_pipeline/templates/otx_template.xml index 95a77c27..a3100f27 100644 --- a/demo_pipeline/templates/otx_template.xml +++ b/demo_pipeline/templates/otx_template.xml @@ -5,8 +5,10 @@ - + + + diff --git a/demo_pipeline/templates/xodr_template.xml b/demo_pipeline/templates/xodr_template.xml index 1dc57a93..230926f2 100644 --- a/demo_pipeline/templates/xodr_template.xml +++ b/demo_pipeline/templates/xodr_template.xml @@ -7,6 +7,7 @@ + diff --git a/demo_pipeline/templates/xosc_template.xml b/demo_pipeline/templates/xosc_template.xml index c4e45cff..e14b76d0 100644 --- a/demo_pipeline/templates/xosc_template.xml +++ b/demo_pipeline/templates/xosc_template.xml @@ -10,7 +10,6 @@ - diff --git a/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp b/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp index 032a5194..ea4ff802 100644 --- a/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp +++ b/src/report_modules/report_module_gui/src/ui/c_report_module_window.cpp @@ -37,12 +37,12 @@ void cReportModuleWindow::highlightRow(const cIssue *const issue, const int row) if (highlighter) { - highlighter->setLineToHighlight(row); + highlighter->setLineToHighlight(row - 1); textEditArea->update(); // Move cursor to the highlighted row and center it QTextCursor cursor = textEditArea->textCursor(); cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, row); + cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, row - 1); textEditArea->setTextCursor(cursor); textEditArea->centerCursor(); } diff --git a/src/result_pooling/src/result_pooling.cpp b/src/result_pooling/src/result_pooling.cpp index 60bc764a..073a09a4 100644 --- a/src/result_pooling/src/result_pooling.cpp +++ b/src/result_pooling/src/result_pooling.cpp @@ -44,6 +44,7 @@ int main(int argc, char *argv[]) { XMLPlatformUtils::Initialize(); + QCoreApplication app(argc, argv); std::vector args(argv, argv + argc); std::string strToolpath = args[0]; From b6859578968ef8ff868512e4df01496fa8c5ac1d Mon Sep 17 00:00:00 2001 From: romanodanilo <62891297+romanodanilo@users.noreply.github.com> Date: Tue, 20 Aug 2024 11:24:19 +0200 Subject: [PATCH 05/12] Remove cmake warning related to xerces_root (#123) Signed-off-by: romanodanilo Signed-off-by: romanodanilo <62891297+romanodanilo@users.noreply.github.com> --- .github/workflows/build-on-change-linux-bare.yaml | 2 +- INSTALL.md | 3 +-- docker/Dockerfile.linux | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-on-change-linux-bare.yaml b/.github/workflows/build-on-change-linux-bare.yaml index 0430faf1..3cdd4e2c 100644 --- a/.github/workflows/build-on-change-linux-bare.yaml +++ b/.github/workflows/build-on-change-linux-bare.yaml @@ -70,7 +70,7 @@ jobs: echo Building framework... cmake -G "Unix Makefiles" -B./build -S . \ -DCMAKE_INSTALL_PREFIX="/home/$(whoami)/qc-build" \ - -DENABLE_FUNCTIONAL_TESTS=$TEST_ENABLED -DXERCES_ROOT="/usr" \ + -DENABLE_FUNCTIONAL_TESTS=$TEST_ENABLED \ -DQt5_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5/" \ -DQt5XmlPatterns_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5XmlPatterns/" cmake --build ./build --target install --config Release -j4 diff --git a/INSTALL.md b/INSTALL.md index e351f4c6..efd076ca 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -74,8 +74,7 @@ $ cmake -G "Visual Studio 16 2019" -A "x64" -T "v142" -B../build -S. ^ -DENABLE_FUNCTIONAL_TESTS=ON ^ -DGTest_ROOT="" ^ -DASAM_OPENDRIVE_XSD_DIR="" ^ - -DASAM_OPENSCENARIO_XSD_DIR="" ^ - -DXERCES_ROOT="" ^ + -DASAM_OPENSCENARIO_XSD_DIR="" ^ -DQt5_ROOT="" $ cmake --build ../build --target ALL_BUILD --config Release $ ctest --test-dir ../build -C Release diff --git a/docker/Dockerfile.linux b/docker/Dockerfile.linux index 45ae8198..71d191d2 100644 --- a/docker/Dockerfile.linux +++ b/docker/Dockerfile.linux @@ -43,7 +43,7 @@ RUN echo "Building framework..." && \ cd /app/framework && \ cmake -G "Unix Makefiles" -B./build -S . \ -DCMAKE_INSTALL_PREFIX="/home/$(whoami)/qc-build" \ - -DENABLE_FUNCTIONAL_TESTS=ON -DXERCES_ROOT="/usr" \ + -DENABLE_FUNCTIONAL_TESTS=ON \ -DQt5_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5/" \ -DQt5XmlPatterns_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5XmlPatterns/" && \ cmake --build ./build --target install --config Release -j4 && \ From 1d59db90dd4bffa80c8b2227576879c90bc30ab0 Mon Sep 17 00:00:00 2001 From: Hoang Tung Dinh Date: Tue, 20 Aug 2024 14:15:40 +0200 Subject: [PATCH 06/12] Update documentation (#124) Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com> --- INSTALL.md | 70 +++++------- README.md | 3 +- .../README.md => doc/manual/demo_pipeline.md | 10 +- doc/manual/manifest_file.md | 100 ++++++++++++++++++ doc/manual/readme.md | 4 +- doc/manual/runtime_module.md | 31 ++++++ doc/manual/using_the_framework.md | 23 +--- doc/manual/writing_user_defined_modules.md | 83 +++++++++------ runtime/README.md | 45 -------- 9 files changed, 217 insertions(+), 152 deletions(-) rename demo_pipeline/README.md => doc/manual/demo_pipeline.md (94%) create mode 100644 doc/manual/manifest_file.md create mode 100644 doc/manual/runtime_module.md delete mode 100644 runtime/README.md diff --git a/INSTALL.md b/INSTALL.md index efd076ca..5207a135 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -8,7 +8,7 @@ with this file, You can obtain one at https://mozilla.org/MPL/2.0/. # How-to Build and Install -The ASAM Quality Checker Framework runs on Linux and Windows. The framework consists of both C++ and Python components. +The ASAM Quality Checker Framework runs on Linux and Windows. The framework consists of both C++ and Python modules. ## Toolchain @@ -17,7 +17,7 @@ The ASAM Quality Checker Framework runs on Linux and Windows. The framework cons - CMake 3.16 or newer - Python 3.10 or newer (otherwise, Conda can be used to install Python 3.10 or newer) -## 3rd Party Dependencies for C++ Components +## 3rd Party Dependencies for C++ Modules - Xerces-C++ - Qt 5 @@ -44,7 +44,7 @@ apt update && apt install -y \ git ``` -## Build C++ components +## Build and install C++ modules - Use CMakeLists.txt within the main directory as source directory - Do not forget to set `CMAKE_INSTALL_PREFIX` @@ -100,16 +100,15 @@ With the following CMake values: | ---- | ----- | ----------- | ------- | | ENABLE_FUNCTIONAL_TESTS | ON/OFF | choose whether the tests were created in the building process of the libraries or not | dependency to a valid gtest package needed (see ) | -## Setup Virtual Environment for Python Components +## Setup Virtual Environment for Python Modules -Virtual environment for Python components can be setup with both [virtualenv](https://docs.python.org/3/library/venv.html) (if Python 3.10 or newer is available on your computer) and [Conda](https://docs.anaconda.com/miniconda/) (if Python 3.10 or newer is not available on your computer). +We recommend installing Python modules in a virtual environment. Virtual environment for Python modules can be setup with both [virtualenv](https://docs.python.org/3/library/venv.html) (if Python 3.10 or newer is available on your computer) and [Conda](https://docs.anaconda.com/miniconda/) (if Python 3.10 or newer is not available on your computer). Using Virtualenv: ```bash python3 -m venv runtime-venv source runtime-venv/bin/activate -python3 -m pip install --no-cache-dir -r runtime/requirements.txt ``` Using Conda: @@ -117,73 +116,56 @@ Using Conda: ```bash conda create -y -n runtime-venv python=3.10 conda activate runtime-venv -python3 -m pip install --no-cache-dir -r runtime/requirements.txt ``` -## Install ASAM Checker Bundles +## Install Python Modules + +Python modules can be installed using `pip`. + +```bash +pip install asam-qc-runtime @ git+https://github.com/asam-ev/qc-framework#subdirectory=runtime +``` -Standard ASAM Checker Bundles are implemented in Python. It is recommended to use virtual environment to setup standard ASAM Checker Bundles. Both [virtualenv](https://docs.python.org/3/library/venv.html) and [Conda](https://docs.anaconda.com/miniconda/) can be used to setup the virtual environment. +## Install ASAM Checker Bundles -### Using virtualenv +Standard ASAM Checker Bundles are implemented in Python and can be installed using `pip`. #### ASAM OpenDrive Checker Bundle ```bash -git clone --single-branch --branch develop https://github.com/asam-ev/qc-opendrive.git -python3 -m venv opendrive-venv -source opendrive-venv/bin/activate -python3 -m pip install --no-cache-dir -r qc-opendrive/requirements.txt +pip install asam-qc-opendrive@git+https://github.com/asam-ev/qc-opendrive ``` -#### ASAM OpenScenario XML Checker Bundle +To test the installation: ```bash -git clone --single-branch --branch develop https://github.com/asam-ev/qc-openscenarioxml.git -python3 -m venv openscenario-venv -source openscenario-venv/bin/activate -python3 -m pip install --no-cache-dir -r qc-openscenarioxml/requirements.txt +qc_opendrive --help ``` -#### ASAM OTX Checker Bundle +#### ASAM OpenScenario XML Checker Bundle ```bash -git clone --single-branch --branch develop https://github.com/asam-ev/qc-otx.git -python3 -m venv otx-venv -source otx-venv/bin/activate -python3 -m pip install --no-cache-dir -r qc-otx/requirements.txt +pip install asam-qc-openscenarioxml@git+https://github.com/asam-ev/qc-openscenarioxml ``` -### Using Conda - -#### ASAM OpenDrive Checker Bundle +To test the installation: ```bash -git clone --single-branch --branch develop https://github.com/asam-ev/qc-opendrive.git -conda create -y -n opendrive-venv python=3.10 -conda activate opendrive-venv -python3 -m pip install --no-cache-dir -r qc-opendrive/requirements.txt +qc_openscenario --help ``` -#### ASAM OpenScenario XML Checker Bundle +#### ASAM OTX Checker Bundle ```bash -git clone --single-branch --branch develop https://github.com/asam-ev/qc-openscenarioxml.git -conda create -y -n openscenario-venv python=3.10 -conda activate openscenario-venv -python3 -m pip install --no-cache-dir -r qc-openscenarioxml/requirements.txt +pip install asam-qc-otx@git+https://github.com/asam-ev/qc-otx ``` -#### ASAM OTX Checker Bundle +To test the installation: ```bash -git clone --single-branch --branch develop https://github.com/asam-ev/qc-otx.git -conda create -y -n otx-venv python=3.10 -conda activate otx-venv -python3 -m pip install --no-cache-dir -r qc-otx/requirements.txt +qc_otx --help ``` ## Register ASAM Checker Bundles -Both standard ASAM Checker Bundles and custom Checker Bundles must be registered with the framework before they can be used. - -**_Placeholder explaining how to register checker bundles with the framework using the manifest file_**. +Both standard ASAM Checker Bundles and custom Checker Bundles must be registered with the framework before they can be used. [The registration is done using manifest files](doc/manual/manifest_file.md). diff --git a/README.md b/README.md index 02ba1c09..0dcd74bf 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,6 @@ The following features are provided: - Modular framework specification that allow users to create their own checkers to support the use cases described above -- Configuration GUI to select and parameterize checker rules - Runtime to call the checker rule sets and merge all results - Text report module to generate a human readable result file - Report GUI to explore the results in the source code of the input file @@ -76,7 +75,7 @@ An architecture overview and documentation is provided in the ## Using Docker-based demo pipeline -A [Docker-based demo pipeline](demo_pipeline/README.md) is provided to help users try out the latest development +A [Docker-based demo pipeline](doc/manual/demo_pipeline.md) is provided to help users try out the latest development of the framework, as well as the [OpenDrive](https://github.com/asam-ev/qc-opendrive/tree/develop) and [OpenScenario XML](https://github.com/asam-ev/qc-openscenarioxml/tree/develop) checker bundles. diff --git a/demo_pipeline/README.md b/doc/manual/demo_pipeline.md similarity index 94% rename from demo_pipeline/README.md rename to doc/manual/demo_pipeline.md index 30d00371..da8c1431 100644 --- a/demo_pipeline/README.md +++ b/doc/manual/demo_pipeline.md @@ -127,10 +127,10 @@ The docker image will automatically: - Create the specific config according to [config schema](../doc/schema/config_format.xsd). - Execute the runtime with specific checker, result pooling and text result application. -Currently the demo_pipeline will clone and execute: +Currently the demo_pipeline will install and execute: -- [OpenDRIVE checker @ develop branch](https://github.com/asam-ev/qc-opendrive/tree/develop) -- [OpenSCENARIO XML checker @ develop branch](https://github.com/asam-ev/qc-openscenarioxml/tree/develop) +- [ASAM OpenDRIVE checker](https://github.com/asam-ev/qc-opendrive) +- [ASAM OpenSCENARIO XML checker](https://github.com/asam-ev/qc-openscenarioxml) After the execution, in the specified output folder you will find: @@ -139,8 +139,8 @@ After the execution, in the specified output folder you will find: - TextReport `Report.txt` text file. Some OpenDrive and OpenScenario XML test files are available to try out. -- [OpenDrive test files](https://github.com/asam-ev/qc-opendrive/tree/develop/tests/data) -- [OpenScenario XML test files](https://github.com/asam-ev/qc-openscenarioxml/tree/develop/tests/data) +- [OpenDrive test files](https://github.com/asam-ev/qc-opendrive/tree/main/tests/data) +- [OpenScenario XML test files](https://github.com/asam-ev/qc-openscenarioxml/tree/main/tests/data) ### Update to the latest version diff --git a/doc/manual/manifest_file.md b/doc/manual/manifest_file.md new file mode 100644 index 00000000..cee32cee --- /dev/null +++ b/doc/manual/manifest_file.md @@ -0,0 +1,100 @@ +# Manifest File + +Manifest files represent the system used by Checker Bundles and Report Modules to register themselves with a framework installation. Manifest files depend on the operating system of the user. Manifest files are the way to tell the framework how to invoke Checker Bundles and Report Modules. + +There are two types of manifest files in the framework: **Framework manifest files** and **Module manifest files**. + +## Framework Manifest File + +A framework manifest file is a JSON file containing a list of module manifest file paths. +The [runtime module](runtime_module.md) uses the framework manifest file to discover +and execute Checker Bundles and Report Modules. + +The framework manifest file must follow the JSON format as in the example below. + +**manifest.json** +```json +{ + "manifest_file_path": [ + "/home/user/qc-opendrive/manifest.json", + "/home/user/qc-openscenarioxml/manifest.json", + "/home/user/qc-otx/manifest.json", + "/home/user/qc-osi/manifest.json" + "/home/user/text-report/manifest.json", + "/home/user/report-gui/manifest.json", + ] +} +``` + +## Module Manifest File + +Each Checker Bundle or Report Module needs to provide a manifest file for the framework. +Below are an example manifest files for a Checker Bundle and a Report Module + +**Example manifest file for a Checker Bundle** + +```json +{ + "module": [ + { + "name": "qc-opendrive", + "exec_type": "executable", + "module_type": "checker_bundle", + "exec_command": "/home/user/.venv/bin/python -m qc_opendrive.main -c $ASAM_QC_FRAMEWORK_CONFIG_FILE -o $ASAM_QC_FRAMEWORK_OUTPUT_DIR" + } + ] +} +``` + +**Example manifest file for a Report Module** + +```json +{ + "module": [ + { + "name": "TextReport", + "exec_type": "executable", + "module_type": "report_module", + "exec_command": "cd /home/user/qc-framework/bin && TextReport $ASAM_QC_FRAMEWORK_RESULT_FILE $ASAM_QC_FRAMEWORK_OUTPUT_DIR" + } + ] +} +``` + +Note that, it is possible to specify the manifest of multiple modules in one file. For example: + +```json +{ + "module": [ + { + "name": "qc-opendrive", + "exec_type": "executable", + "module_type": "checker_bundle", + "exec_command": "/home/user/.venv/bin/python -m qc_opendrive.main -c $ASAM_QC_FRAMEWORK_CONFIG_FILE -o $ASAM_QC_FRAMEWORK_OUTPUT_DIR" + }, + { + "name": "TextReport", + "exec_type": "executable", + "module_type": "report_module", + "exec_command": "cd /home/user/qc-framework/bin && TextReport $ASAM_QC_FRAMEWORK_RESULT_FILE $ASAM_QC_FRAMEWORK_OUTPUT_DIR" + } + ] +} +``` + +The manifest of each module must contain the following information. + +* `name`: The name of the module. This name will be used in the [configuration file](file_formats.md). +* `exec_type`: The type of module execution. Currently, only `executable` is supported as `exec_type`. The `executable` type supports the execution of any command in the `exec_command`. +* `module_type`: The type of the module. It must be either a `checker_bundle` or a `report_module`. +* `exec_command`: The command to be executed when the corresponding Checker Bundle or Report Module is invoked by the framework. + +## Register a Checker Bundle or Report Module to the Framework + +To register a Checker Bundle or Report Module with the framework: +* First, a module manifest file must be provided. +* Second, the path to the module manifest file must be included in the framework manifest file. +* Last, the framework manifest file can be provided to the [runtime module](runtime_module.md) when triggering a framework execution. + ```bash + qc_runtime --config=$PATH_TO_CONFIG_FILE --manifest=$PATH_TO_MANIFEST_FILE + ``` diff --git a/doc/manual/readme.md b/doc/manual/readme.md index ae780ff1..fd068b22 100644 --- a/doc/manual/readme.md +++ b/doc/manual/readme.md @@ -15,6 +15,7 @@ with this file, You can obtain one at https://mozilla.org/MPL/2.0/. - [OpenDrive Checker](https://github.com/asam-ev/qc-opendrive) - [OpenScenario XML Checker](https://github.com/asam-ev/qc-openscenarioxml) - [OTX Checker](https://github.com/asam-ev/qc-otx) +- [Manifest Files for Registering Modules with the Framework](manifest_file.md) - [Checker Libraries containing checks from one domain](checker_library.md) - [Writing User Defined Checker Bundles or Report Modules](writing_user_defined_modules.md) @@ -23,6 +24,3 @@ with this file, You can obtain one at https://mozilla.org/MPL/2.0/. - [C++ Base Library for Writing Own Modules](cpp_base_library.md) - [Viewer Interface for Remote Controlling a 3D Viewer from the GUI](viewer_interface.md) - -This documentation covers the generic part of the framework. You can probably -find more CheckerBundles in the ``bin`` directory, which can be used. diff --git a/doc/manual/runtime_module.md b/doc/manual/runtime_module.md new file mode 100644 index 00000000..73083e23 --- /dev/null +++ b/doc/manual/runtime_module.md @@ -0,0 +1,31 @@ +# Runtime module + +The runtime module is responsible of executing the qc-framework modules specified in an input configuration file. + +Input configuration file need to respect the [config xsd schema](../doc/schema/config_format.xsd) + +The runtime module execute the following steps: + +1. Validate input xml file given the schema +2. For each checker bundle specified in configuration, execute its process +3. Execute result pooling for collect results from all checker bundle executed in step 2 +4. For each report module specified in configuration, execute its process + +## Installation & Usage + +The runtime module can be installed using pip. + +```bash +pip install asam-qc-runtime@git+https://github.com/asam-ev/qc-framework/#subdirectory=runtime +``` + +Then, it can be executed as follows. + +```bash +qc_runtime --config=$PATH_TO_CONFIG_FILE --manifest=$PATH_TO_MANIFEST_FILE +``` + +where + +- `$PATH_TO_CONFIG_FILE` points to an xml file following the [config xsd schema](../doc/schema/config_format.xsd) +- `$PATH_TO_MANIFEST_FILE` points to the [manifest file](manifest_file.md) of the framework. diff --git a/doc/manual/using_the_framework.md b/doc/manual/using_the_framework.md index 92ba4156..42a2baca 100644 --- a/doc/manual/using_the_framework.md +++ b/doc/manual/using_the_framework.md @@ -16,19 +16,13 @@ Example configuration files for running the official Checker Bundles for ASAM Op ## Run the Checker Bundles -The Checker Bundles can be run using the [runtime component](../../runtime/README.md). +The Checker Bundles can be run using the [runtime module](runtime_module.md). ```bash -source runtime-venv/bin/activate -python3 runtime/runtime/runtime.py \ - --config "PATH_TO_YOUR_CONFIG_FILE" \ - --install_dir "qc-build/bin" \ - --schema_dir "doc/schema" +qc_runtime --config "PATH_TO_CONFIG_FILE" --manifest "PATH_TO_MANIFEST_FILE" ``` -**_Note: The above runtime execution will change after Manifest file is supported. E.g., schema_dir, install_dir will be removed._** - -The output of the runtime components are the `.xqar` [result files](file_formats.md) and any other output files from the specified report modules in the configuration file, such as `.txt` files for the text report module. If the ReportGUI is specified, the Report GUI will open. +The output of the runtime modules are the `.xqar` [result files](file_formats.md) and any other output files from the specified report modules in the configuration file, such as `.txt` files for the text report module. If the ReportGUI is specified, the Report GUI will open. ## Reporting @@ -63,15 +57,6 @@ documentation](viewer_interface.md) for details. ## Add Self Implemented CheckerBundles and ReportModules -You can add your own CheckerBundles and ReportModules to the framework. -Just add the executables to the folder where the framework executables are installed. -This will make the executables available to the runtime component. -In our example above, the folder is `qc-build/bin`. - -**_Note: The above instruction will change after the Manifest file is supported._** - -Executables for Checker Bundles written in any programming languages can be created using -bash script, even for intepreted languages like Python. - +You can create and add your own CheckerBundles and ReportModules to the framework. Requirements for your own CheckerBundle can be found in the [User defined modules](writing_user_defined_modules.md) documentation. diff --git a/doc/manual/writing_user_defined_modules.md b/doc/manual/writing_user_defined_modules.md index 37d2ac47..f318a1d7 100644 --- a/doc/manual/writing_user_defined_modules.md +++ b/doc/manual/writing_user_defined_modules.md @@ -1,5 +1,6 @@ + +# Using the C++ Base Library + +It is recommended to use the Python Base Library if possible as it contains the most advanced development. The C++ Base Library is complete in terms of functionality, but it is not as easy to use as the Python Base Library. + +## Installation + +To install the base library it is necessary to clone the qc-framework repository + +``` +git clone https://github.com/asam-ev/qc-framework.git +``` + +And create a folder in the `examples` directory. E.g. `tutorial_example` + +For executing the examples below, you need a `tutorial_example/src/main.cpp` file and `tutorial_example/CMakeLists.txt` that links your main logic with the base library as follows: + +``` +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) # CMake policy CMP0095 + +set(TUTORIAL_EXAMPLE TutorialExample) +project(${TUTORIAL_EXAMPLE}) + +set(CMAKE_INSTALL_RPATH $ORIGIN/../lib) + +add_executable(${TUTORIAL_EXAMPLE} + src/main.cpp +) + +target_link_libraries(${TUTORIAL_EXAMPLE} PRIVATE qc4openx-common $<$:stdc++fs>) +install(TARGETS ${TUTORIAL_EXAMPLE} DESTINATION examples/tutorial_example/bin) +qc4openx_install_qt(examples/tutorial_example/bin ${TUTORIAL_EXAMPLE}.exe) + +file( + COPY "${CMAKE_CURRENT_SOURCE_DIR}/src" + DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/tutorial_example + ) + +set_target_properties(${TUTORIAL_EXAMPLE} PROPERTIES FOLDER examples/checker_bundles) +``` + +Then in the main `examples/CMakeLists.txt` you can add the new folder created + +``` +add_subdirectory(tutorial_example) +``` + +Then from the `qc-framework` folder you can build the new tutorial with the command: + +``` +cmake -G "Unix Makefiles" -B./build -S . -DCMAKE_INSTALL_PREFIX="/home/$USER/qc-build" \ + -DENABLE_FUNCTIONAL_TESTS=ON \ + -DQt5_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5/" \ + -DQt5XmlPatterns_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5XmlPatterns/" + +cmake --build ./build --target install --config Release -j4 + +cmake --install ./build +``` + +After these commands you will find your executable in `/home/$USER/qc-build/examples/tutorial_example/bin/TutorialExample` + +## Examples + +#### Creating a checker bundle, checker, issue and write results + + +```cpp + #include "common/result_format/c_issue.h" + + #define CHECKER_BUNDLE_NAME "TutorialBundle" + + // Define a result container which contains our results. + cResultContainer pResultContainer; + + // Lets go on with the checker bundle. A bundle contains 0 or more checks. + cCheckerBundle *pExampleCheckerBundle = new cCheckerBundle(CHECKER_BUNDLE_NAME); + + // Add the checkerBundle to our results. You can do it later as well. + pResultContainer.AddCheckerBundle(pExampleCheckerBundle); + + // Create a checker with a factory in the checker bundle + cChecker *pTutorialChecker = pExampleCheckerBundle->CreateChecker("utorialChecker", "This is a description"); + // Lets add now an issue + pTutorialChecker->AddIssue(new cIssue("This is an information from the demo usecase", INFO_LVL)); + + // And now just write the report. + pResultContainer.WriteResults("tutorial_result.xqar"); + pResultContainer.Clear(); +``` + +#### Add information to checker and issues + +**Create a test checker with an inertial location** + +```cpp + cChecker *pExampleInertialChecker = + pExampleCheckerBundle->CreateChecker("exampleInertialChecker", "This is a description of inertial checker"); + std::list listLoc; + listLoc.push_back(new cLocationsContainer("inertial position", new cInertialLocation(1.0, 2.0, 3.0))); + pExampleInertialChecker->AddIssue(new cIssue("This is an information from the demo usecase", INFO_LVL, listLoc)); +``` + +**Create a test checker with RuleUID and metadata** + +```cpp + cChecker *pExampleRuleUIDChecker = + pExampleCheckerBundle->CreateChecker("exampleRuleUIDChecker", "This is a description of ruleUID checker"); + pExampleRuleUIDChecker->AddRule(new cRule("test.com::qwerty.qwerty")); + pExampleRuleUIDChecker->AddMetadata( + new cMetadata("run date", "2024/06/06", "Date in which the checker was executed")); + pExampleRuleUIDChecker->AddMetadata( + new cMetadata("reference project", "project01", "Name of the project that created the checker")); + +``` + +**Create a test checker with Issue and RuleUID** +```cpp + cChecker *pExampleIssueRuleChecker = pExampleCheckerBundle->CreateChecker( + "exampleIssueRuleChecker", "This is a description of checker with issue and the involved ruleUID"); + + pExampleIssueRuleChecker->AddIssue( + new cIssue("This is an information from the demo usecase", ERROR_LVL, "test.com::qwerty.qwerty")); +``` + +**Create a test checker with domain specific info** +```cpp + cChecker *pExampleDomainChecker = pExampleCheckerBundle->CreateChecker( + "exampleDomainChecker", "This is a description of example domain info checker"); + std::list listDomainSpecificInfo; + + std::string xmlString = + ""; + + listDomainSpecificInfo.push_back(new cDomainSpecificInfo(getRootFromString(xmlString), "domain info test")); + pExampleDomainChecker->AddIssue( + new cIssue("This is an information from the demo usecase", INFO_LVL, listDomainSpecificInfo)); +``` From 91d16ca21205ba4dff62321cfe76167bd3083e6f Mon Sep 17 00:00:00 2001 From: Hoang Tung Dinh Date: Wed, 21 Aug 2024 09:48:34 +0200 Subject: [PATCH 09/12] Include result pooling concept in manifest file documentation (#128) Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com> --- doc/manual/manifest_file.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/manual/manifest_file.md b/doc/manual/manifest_file.md index 84f6cc66..5f5c3154 100644 --- a/doc/manual/manifest_file.md +++ b/doc/manual/manifest_file.md @@ -82,12 +82,30 @@ Note that, it is possible to specify the manifest of multiple modules in one fil } ``` +The manifest file is also used internally by the framework to specify the [Result Pooling](https://github.com/asam-ev/qc-framework/blob/main/doc/manual/architecture.md#workflow-asam-quality-checker-framework) module. The Result Pooling module is provided by the framework. Standard users are not expected to implement a result pooling module. + +```json +{ + "module": [ + { + "name": "ResultPooling", + "exec_type": "executable", + "module_type": "result_pooling", + "exec_command": "/home/user/qc-framework/bin/ResultPooling $ASAM_QC_FRAMEWORK_WORKING_DIR $ASAM_QC_FRAMEWORK_CONFIG_FILE" + } + ] +} +``` + The manifest of each module must contain the following information. * `name`: The name of the module. This name will be used in the [configuration file](file_formats.md). -* `exec_type`: The type of module execution. Currently, only `executable` is supported as `exec_type`. The `executable` type supports the execution of any command in the `exec_command`. -* `module_type`: The type of the module. It must be either a `checker_bundle` or a `report_module`. -* `exec_command`: The command to be executed when the corresponding Checker Bundle or Report Module is invoked by the framework. The `exec_command` have access to the environment variables defined by the framework (see the next section: Framework Environment Variables). The `exec_command` must accept the configuration file defined in `ASAM_QC_FRAMEWORK_CONFIG_FILE` and output any files to the directory defined in `ASAM_QC_FRAMEWORK_WORKING_DIR`. +* `exec_type`: The type of module execution. Currently, only `executable` is supported as `exec_type`. This type supports the execution of any command in the `exec_command`. +* `module_type`: The type of the module. It must have one of the following value. + * `checker_bundle` + * `report_module` + * `result_pooling` +* `exec_command`: The command to be executed when the corresponding Checker Bundle or Report Module is invoked by the framework. The command has access to the environment variables defined by the framework (see the next section: Framework Environment Variables). The `exec_command` must accept the configuration file defined in `ASAM_QC_FRAMEWORK_CONFIG_FILE` and output any files to the directory defined in `ASAM_QC_FRAMEWORK_WORKING_DIR`. ## Framework Environment Variables From c0098bfbe7614076cee440cfb7babcaa94458780 Mon Sep 17 00:00:00 2001 From: Hoang Tung Dinh Date: Wed, 21 Aug 2024 15:37:12 +0200 Subject: [PATCH 10/12] Remove an outdated requirement (#129) Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com> --- doc/manual/architecture.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/manual/architecture.md b/doc/manual/architecture.md index e8ccfcb9..58341d66 100644 --- a/doc/manual/architecture.md +++ b/doc/manual/architecture.md @@ -141,7 +141,6 @@ flowchart LR - Checker Bundle - Runs probably only on certain platforms, because a third party product is not available for all platforms - - Must be able to print out to the command line which Checkers are included - Result Pooling - Summarizes all results (overview and detailed view possible) - Gives each incident a unique Id → assignment results in different report From 7195f81196ca6688343e4966e6d664978da6edeb Mon Sep 17 00:00:00 2001 From: romanodanilo <62891297+romanodanilo@users.noreply.github.com> Date: Thu, 22 Aug 2024 09:28:18 +0200 Subject: [PATCH 11/12] Support downloading build artifacts in actions (#127) Signed-off-by: romanodanilo Signed-off-by: romanodanilo <62891297+romanodanilo@users.noreply.github.com> --- .../workflows/build-on-change-linux-bare.yaml | 24 ++++++++++++++++--- .../workflows/build-on-change-windows.yaml | 17 +++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-on-change-linux-bare.yaml b/.github/workflows/build-on-change-linux-bare.yaml index 3cdd4e2c..5c6cad9f 100644 --- a/.github/workflows/build-on-change-linux-bare.yaml +++ b/.github/workflows/build-on-change-linux-bare.yaml @@ -31,9 +31,12 @@ on: - runtime/** - docker/** + workflow_dispatch: # Allows manual triggering of the workflow + jobs: build-linux: - runs-on: ubuntu-22.04 + runs-on: ubuntu-20.04 + env: TEST_ENABLED: ${{ github.event_name == 'pull_request' && 'ON' || 'OFF' }} steps: @@ -78,6 +81,21 @@ jobs: echo Done. shell: bash + - name: Prepare build artifacts + run: | + sudo chmod -R +x ./build/src/ + shell: bash + + - name: Archive release binaries + shell: bash + run: mkdir artifacts && cp ./build/src/result_pooling/ResultPooling ./build/src/report_modules/report_module_text/TextReport ./build/src/report_modules/report_module_github_ci/GithubCIReport ./build/src/report_modules/report_module_gui/ReportGUI artifacts/ + + - name: Upload release artifact + uses: actions/upload-artifact@v4 + with: + name: qc-framework-executables-ubuntu + path: artifacts + - name: Unit test execution if: github.event_name == 'pull_request' run: | @@ -92,7 +110,7 @@ jobs: if: github.event_name == 'pull_request' && (success() || failure()) uses: actions/upload-artifact@v4 with: - name: unit-test-report + name: unit-test-report-ubuntu path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log - name: Runtime test execution @@ -109,5 +127,5 @@ jobs: if: github.event_name == 'pull_request' && (success() || failure()) uses: actions/upload-artifact@v4 with: - name: runtime-test-report + name: runtime-test-report-ubuntu path: ${{ github.workspace }}/runtime/runtime_test.log diff --git a/.github/workflows/build-on-change-windows.yaml b/.github/workflows/build-on-change-windows.yaml index 8e686d05..738b0516 100644 --- a/.github/workflows/build-on-change-windows.yaml +++ b/.github/workflows/build-on-change-windows.yaml @@ -31,6 +31,8 @@ on: - runtime/** - docker/** + workflow_dispatch: # Allows manual triggering of the workflow + jobs: build-windows: runs-on: windows-2019 @@ -114,6 +116,21 @@ jobs: Write-Output "All installations and setups are complete!" shell: pwsh + - name: Archive release binaries + run: | + mkdir artifacts + copy .\build\src\result_pooling\Release\ResultPooling.exe .\artifacts\ + copy .\build\src\report_modules\report_module_text\Release\TextReport.exe .\artifacts\ + copy .\build\src\report_modules\report_module_github_ci\Release\GithubCIReport.exe .\artifacts\ + copy .\build\src\report_modules\report_module_gui\Release\ReportGUI.exe .\artifacts\ + shell: cmd + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: qc-framework-executables-windows + path: artifacts + - name: Unit test execution if: github.event_name == 'pull_request' run: | From 2eb7f3bb36af889c11d606994b36c4c3e9177baa Mon Sep 17 00:00:00 2001 From: Hoang Tung Dinh Date: Thu, 22 Aug 2024 09:34:31 +0200 Subject: [PATCH 12/12] Update demo pipeline with the new package distribution system (#131) Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com> --- demo_pipeline/otxBundle | 4 +- demo_pipeline/xodrBundle | 4 +- demo_pipeline/xoscBundle | 4 +- doc/manual/demo_pipeline.md | 6 +-- docker/Dockerfile.linux | 77 ++++++++++--------------------------- 5 files changed, 25 insertions(+), 70 deletions(-) diff --git a/demo_pipeline/otxBundle b/demo_pipeline/otxBundle index 14d92309..c9fee913 100644 --- a/demo_pipeline/otxBundle +++ b/demo_pipeline/otxBundle @@ -6,7 +6,5 @@ # with this file, You can obtain one at https://mozilla.org/MPL/2.0/. readonly CONFIG_FILE=$1 -source /app/otx-venv/bin/activate -cd /app/qc-otx -python main.py -c $CONFIG_FILE +qc_otx -c $CONFIG_FILE cp *.xqar /app/framework/bin/ diff --git a/demo_pipeline/xodrBundle b/demo_pipeline/xodrBundle index 8376b70f..953f6a43 100644 --- a/demo_pipeline/xodrBundle +++ b/demo_pipeline/xodrBundle @@ -6,7 +6,5 @@ # with this file, You can obtain one at https://mozilla.org/MPL/2.0/. readonly CONFIG_FILE=$1 -source /app/opendrive-venv/bin/activate -cd /app/qc-opendrive -python main.py -c $CONFIG_FILE +qc_opendrive -c $CONFIG_FILE cp *.xqar /app/framework/bin/ diff --git a/demo_pipeline/xoscBundle b/demo_pipeline/xoscBundle index 44f896ea..602477b4 100644 --- a/demo_pipeline/xoscBundle +++ b/demo_pipeline/xoscBundle @@ -6,7 +6,5 @@ # with this file, You can obtain one at https://mozilla.org/MPL/2.0/. readonly CONFIG_FILE=$1 -source /app/openscenario-venv/bin/activate -cd /app/qc-openscenarioxml -python main.py -c $CONFIG_FILE +qc_openscenario -c $CONFIG_FILE cp *.xqar /app/framework/bin/ diff --git a/doc/manual/demo_pipeline.md b/doc/manual/demo_pipeline.md index da8c1431..3008241e 100644 --- a/doc/manual/demo_pipeline.md +++ b/doc/manual/demo_pipeline.md @@ -154,11 +154,9 @@ docker pull ghcr.io/asam-ev/qc-framework:demo-pipeline-latest ### Local build instructions -The image can only be built on Linux. To build the Docker image locally, you can execute: - -``` -cd .. +The image can only be built on Linux. To build the Docker image locally, you can execute the following command from the root folder of the repository. +```bash DOCKER_BUILDKIT=1 \ docker build \ -f docker/Dockerfile.linux \ diff --git a/docker/Dockerfile.linux b/docker/Dockerfile.linux index 71d191d2..0579e9e1 100644 --- a/docker/Dockerfile.linux +++ b/docker/Dockerfile.linux @@ -19,7 +19,7 @@ RUN echo "Installing Dependencies..." && \ libqt5xmlpatterns5-dev \ libxerces-c-dev \ pkg-config \ - python3.10-venv \ + python3-pip \ git && \ echo "Dependencies installed." @@ -51,44 +51,22 @@ RUN echo "Building framework..." && \ echo "Done." -# Clone, configure venv, install by copying bash script to install dir - OpenSCENARIO -RUN git clone --single-branch --branch develop https://github.com/asam-ev/qc-openscenarioxml.git && \ - python3 -m venv openscenario-venv && \ - source openscenario-venv/bin/activate && \ - python3 -m pip install --no-cache-dir -r qc-openscenarioxml/requirements.txt && \ - chmod +x /app/demo_pipeline/xoscBundle && \ +# Copy bash script to install dir - OpenSCENARIO + OpenDRIVE + OTX +RUN chmod +x /app/demo_pipeline/xoscBundle && \ cp /app/demo_pipeline/xoscBundle /home/root/qc-build/bin/xoscBundle && \ - rm -rf /app/qc-openscenarioxml/.git - -# Clone, configure venv, install by copying bash script to install dir - OpenDRIVE -RUN git clone --single-branch --branch develop https://github.com/asam-ev/qc-opendrive.git && \ - python3 -m venv opendrive-venv && \ - source opendrive-venv/bin/activate && \ - python3 -m pip install --no-cache-dir -r qc-opendrive/requirements.txt && \ chmod +x /app/demo_pipeline/xodrBundle && \ cp /app/demo_pipeline/xodrBundle /home/root/qc-build/bin/xodrBundle && \ - rm -rf /app/qc-opendrive/.git - -# Clone, configure venv, install by copying bash script to install dir - OTX -RUN git clone --single-branch --branch develop https://github.com/asam-ev/qc-otx.git && \ - python3 -m venv otx-venv && \ - source otx-venv/bin/activate && \ - python3 -m pip install --no-cache-dir -r qc-otx/requirements.txt && \ chmod +x /app/demo_pipeline/otxBundle && \ - cp /app/demo_pipeline/otxBundle /home/root/qc-build/bin/otxBundle && \ - rm -rf /app/qc-otx/.git - -# Create and setup demo and runtime virtual envs -RUN python3 -m venv demo-pipeline-venv && \ - source demo-pipeline-venv/bin/activate && \ - python3 -m pip install --no-cache-dir -r /app/demo_pipeline/requirements.txt - -RUN python3 -m venv runtime-venv && \ - source runtime-venv/bin/activate && \ - python3 -m pip install --no-cache-dir -r /app/framework/runtime/requirements.txt - - -# Runtime stage + cp /app/demo_pipeline/otxBundle /home/root/qc-build/bin/otxBundle + +RUN python3 -m pip install --no-cache-dir -r /app/demo_pipeline/requirements.txt && \ + python3 -m pip install --no-cache-dir -r /app/framework/runtime/requirements.txt && \ + python3 -m pip install asam-qc-opendrive@git+https://github.com/asam-ev/qc-opendrive@develop && \ + python3 -m pip install asam-qc-openscenarioxml@git+https://github.com/asam-ev/qc-openscenarioxml@develop && \ + python3 -m pip install asam-qc-otx@git+https://github.com/asam-ev/qc-otx@develop + + +# Runtime test stage FROM ubuntu:22.04 as runtime_test # Dependancies installation currently required by ResultPooling and TextReport modules @@ -109,14 +87,15 @@ COPY --from=framework_builder /home/root/qc-build/bin /app/framework/bin COPY --from=framework_builder /app/framework/build/test /app/framework/test # @NOTE this is just because DemoCheckerBundle is not installed by default COPY --from=framework_builder /app/framework/build/examples/checker_bundle_example/DemoCheckerBundle /app/framework/bin/ -# Virtual envs -COPY --from=framework_builder /app/runtime-venv /app/runtime-venv WORKDIR /app/framework/runtime/ SHELL ["/bin/bash", "-c"] -CMD source /app/runtime-venv/bin/activate && python3 -m pytest -rA > runtime_test.log && cp /app/framework/runtime/runtime_test.log /out/runtime_test.log +COPY --from=framework_builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages +COPY --from=framework_builder /usr/local/bin /usr/local/bin + +CMD python3 -m pytest -rA > runtime_test.log && cp /app/framework/runtime/runtime_test.log /out/runtime_test.log # Runtime stage FROM framework_builder as unit_test @@ -137,13 +116,6 @@ RUN apt update && apt install -y \ RUN mkdir -p /app -# Virtual envs -COPY --from=framework_builder /app/runtime-venv /app/runtime-venv -COPY --from=framework_builder /app/demo-pipeline-venv /app/demo-pipeline-venv -COPY --from=framework_builder /app/opendrive-venv /app/opendrive-venv -COPY --from=framework_builder /app/openscenario-venv /app/openscenario-venv -COPY --from=framework_builder /app/otx-venv /app/otx-venv - # Framework components COPY --from=framework_builder /home/root/qc-build/bin /app/framework/bin COPY --from=framework_builder /app/demo_pipeline /app/demo_pipeline @@ -152,18 +124,9 @@ COPY --from=framework_builder /app/framework/runtime /app/framework/runtime # Framework schemas COPY --from=framework_builder /app/framework/doc/schema /app/framework/doc/schema -# OpenScenario XML checker bundle -COPY --from=framework_builder /app/qc-openscenarioxml/main.py /app/qc-openscenarioxml/main.py -COPY --from=framework_builder /app/qc-openscenarioxml/qc_openscenario /app/qc-openscenarioxml/qc_openscenario - -# OpenDrive XML checker bundle -COPY --from=framework_builder /app/qc-opendrive/main.py /app/qc-opendrive/main.py -COPY --from=framework_builder /app/qc-opendrive/qc_opendrive /app/qc-opendrive/qc_opendrive - -# OTX XML checker bundle -COPY --from=framework_builder /app/qc-otx/main.py /app/qc-otx/main.py -COPY --from=framework_builder /app/qc-otx/qc_otx /app/qc-otx/qc_otx +COPY --from=framework_builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages +COPY --from=framework_builder /usr/local/bin /usr/local/bin SHELL ["/bin/bash", "-c"] -CMD source /app/demo-pipeline-venv/bin/activate && /app/demo_pipeline/run_pipeline.sh +CMD /app/demo_pipeline/run_pipeline.sh