Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CR-1228185, CR-1228210 and CR-1228177 #8747

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/runtime_src/core/tools/common/SubCmdExamineInternal.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.

// ------ I N C L U D E F I L E S -------------------------------------------
// Local - Include Files
Expand Down Expand Up @@ -114,7 +114,7 @@ SubCmdExamineInternal::execute(const SubCmdOptions& _options) const
throw xrt_core::error("Please specify an output file to redirect the json to");

if (!options.m_output.empty() && std::filesystem::exists(options.m_output) && !XBU::getForce())
throw xrt_core::error((boost::format("The output file '%s' already exists. Please either remove it or execute this command again with the '--force' option to overwrite it") % options.m_output).str());
throw xrt_core::error((boost::format("The output file '%s' already exists. Please either remove it or execute this command again with the '--force' option to overwrite it") % options.m_output).str());

} catch (const xrt_core::error& e) {
// Catch only the exceptions that we have generated earlier
Expand Down
4 changes: 2 additions & 2 deletions src/runtime_src/core/tools/common/XBHelpMenus.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2020-2022 Xilinx, Inc
// Copyright (C) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
// Copyright (C) 2022-2025 Advanced Micro Devices, Inc. All rights reserved.

// ------ I N C L U D E F I L E S -------------------------------------------
// Local - Include Files
Expand Down Expand Up @@ -228,7 +228,7 @@ XBUtilities::collect_and_validate_reports( const ReportCollection &allReportsAva
// Examine each report name for a match
for (const auto & reportName : reportNamesToAdd) {
auto iter = std::find_if(allReportsAvailable.begin(), allReportsAvailable.end(),
[&reportName](const std::shared_ptr<Report>& obj) {return obj->getReportName() == reportName;});
[&reportName](const std::shared_ptr<Report>& obj) {return obj->getReportName() == boost::algorithm::to_lower_copy(reportName);});
if (iter != allReportsAvailable.end())
reportsToUse.push_back(*iter);
else {
Expand Down
30 changes: 17 additions & 13 deletions src/runtime_src/core/tools/common/XBUtilities.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2019-2022 Xilinx, Inc
// Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
// Copyright (C) 2022-2025 Advanced Micro Devices, Inc. All rights reserved.

// ------ I N C L U D E F I L E S -------------------------------------------
#include "XBUtilities.h"
Expand Down Expand Up @@ -214,20 +214,24 @@ bdf2index(const std::string& bdfstr, bool _inUserDomain)

std::reverse(std::begin(tokens), std::end(tokens));

//check if func was specified. func is optional
auto pos_of_func = tokens[0].find('.');
if (pos_of_func != std::string::npos) {
dev = static_cast<uint16_t>(std::stoi(std::string(tokens[0].substr(0, pos_of_func)), nullptr, radix));
func = static_cast<uint16_t>(std::stoi(std::string(tokens[0].substr(pos_of_func+1)), nullptr, radix));
}
else
dev = static_cast<uint16_t>(std::stoi(std::string(tokens[0]), nullptr, radix));
try {
//check if func was specified. func is optional
auto pos_of_func = tokens[0].find('.');
if (pos_of_func != std::string::npos) {
dev = static_cast<uint16_t>(std::stoi(std::string(tokens[0].substr(0, pos_of_func)), nullptr, radix));
func = static_cast<uint16_t>(std::stoi(std::string(tokens[0].substr(pos_of_func+1)), nullptr, radix));
}
else
dev = static_cast<uint16_t>(std::stoi(std::string(tokens[0]), nullptr, radix));

bus = static_cast<uint16_t>(std::stoi(std::string(tokens[1]), nullptr, radix));
bus = static_cast<uint16_t>(std::stoi(std::string(tokens[1]), nullptr, radix));

// domain is not mandatory if it is "0000"
if(tokens.size() > 2)
domain = static_cast<uint16_t>(std::stoi(std::string(tokens[2]), nullptr, radix));
// domain is not mandatory if it is "0000"
if(tokens.size() > 2)
domain = static_cast<uint16_t>(std::stoi(std::string(tokens[2]), nullptr, radix));
} catch (const std::invalid_argument&) {
throw std::runtime_error(boost::str(boost::format("Invalid BDF '%s'") % bdfstr) + XBUtilities::str_available_devs(_inUserDomain));
}

// Iterate through the available devices to find a BDF match
// This must not open any devices! Doing do would slow down the software
Expand Down
5 changes: 3 additions & 2 deletions src/runtime_src/core/tools/xbutil2/SubCmdValidate.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2019-2022 Xilinx, Inc
// Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
// Copyright (C) 2022-2025 Advanced Micro Devices, Inc. All rights reserved.

// ------ I N C L U D E F I L E S -------------------------------------------
// Local - Include Files
Expand Down Expand Up @@ -458,7 +458,8 @@ SubCmdValidate::handle_errors_and_validate_tests(const boost::program_options::v
throw xrt_core::error("Please specify an output file to redirect the json to");

if (!options.m_output.empty() && !XBU::getForce() && std::filesystem::exists(options.m_output))
throw xrt_core::error((boost::format("Output file already exists: '%s'") % options.m_output).str());
throw xrt_core::error((boost::format("The output file '%s' already exists. Please either remove it or execute this command again with the '--force' option to overwrite it") % options.m_output).str());


if (options.m_tests_to_run.empty())
throw xrt_core::error("No test given to validate against.");
Expand Down
Loading