Skip to content

Commit 670667f

Browse files
authored
Fix to pass by const ref and fix include guards (#9242)
* Fix to pass by const ref and fix include guards Fix Windows compile error in TestNPULatency.cpp. At same time replace by-value to by-const-ref, which had serious ripple effects. Also add missing SPDX license header. Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com> * Fix clang-tidy warning Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com> --------- Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>
1 parent e266719 commit 670667f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+185
-171
lines changed

src/runtime_src/core/tools/common/TestRunner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ signal_handler(int signal) {
4242
}
4343

4444
static void
45-
runTestInternal(std::shared_ptr<xrt_core::device> dev,
45+
runTestInternal(const std::shared_ptr<xrt_core::device>& dev,
4646
boost::property_tree::ptree& ptree,
4747
TestRunner* test,
4848
bool& is_thread_running,
@@ -70,7 +70,7 @@ TestRunner::TestRunner (const std::string & test_name,
7070
}
7171

7272
boost::property_tree::ptree
73-
TestRunner::startTest(std::shared_ptr<xrt_core::device> dev, const xrt_core::archive* archive)
73+
TestRunner::startTest(const std::shared_ptr<xrt_core::device>& dev, const xrt_core::archive* archive)
7474
{
7575
XBUtilities::BusyBar busy_bar("Running Test", std::cout);
7676
busy_bar.start(XBUtilities::is_escape_codes_disabled());

src/runtime_src/core/tools/common/TestRunner.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
33

4-
#ifndef __TestRunner_h_
5-
#define __TestRunner_h_
4+
#ifndef TestRunner_h_
5+
#define TestRunner_h_
66

77
// Local - Include Files
88
#include "core/common/query_requests.h"
@@ -27,21 +27,21 @@ namespace xrt_core { class archive; }
2727

2828
class TestRunner : public JSONConfigurable {
2929
public:
30-
virtual boost::property_tree::ptree run(std::shared_ptr<xrt_core::device> dev) = 0;
30+
virtual boost::property_tree::ptree run(const std::shared_ptr<xrt_core::device>&) = 0;
3131

3232
// Overloaded version with archive support for individual test implementations
3333
// We'll remove the default run implementation once all tests overload this version
3434
virtual boost::property_tree::ptree
35-
run(std::shared_ptr<xrt_core::device> dev,
35+
run(const std::shared_ptr<xrt_core::device>& dev,
3636
const xrt_core::archive* /*archive*/) {
3737
// Default implementation ignores archive and calls original run method
3838
return run(dev);
3939
}
4040

41-
boost::property_tree::ptree startTest(std::shared_ptr<xrt_core::device> dev,
41+
boost::property_tree::ptree startTest(const std::shared_ptr<xrt_core::device>&,
4242
const xrt_core::archive* archive = nullptr);
4343

44-
virtual void set_param(const std::string, const std::string) {}
44+
virtual void set_param(const std::string&, const std::string&) {}
4545
bool is_explicit() const { return m_explicit; };
4646
virtual bool getConfigHidden() const { return is_explicit(); };
4747
const void set_xclbin_path(std::string path) { m_xclbin = path; };

src/runtime_src/core/tools/common/tests/TestAIEReconfigOverhead.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ TestAIEReconfigOverhead::TestAIEReconfigOverhead()
1515
{}
1616

1717
boost::property_tree::ptree
18-
TestAIEReconfigOverhead::run(std::shared_ptr<xrt_core::device> dev)
18+
TestAIEReconfigOverhead::run(const std::shared_ptr<xrt_core::device>& dev)
1919
{
2020
boost::property_tree::ptree ptree = get_test_header();
2121
std::string recipe = xrt_core::device_query<xrt_core::query::runner>(dev, xrt_core::query::runner::type::aie_reconfig_overhead_recipe);

src/runtime_src/core/tools/common/tests/TestAIEReconfigOverhead.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
2+
// Copyright (C) 2024-2025 Advanced Micro Devices, Inc. All rights reserved.
33

4-
#ifndef __TestArrayReconfOverhead_h_
5-
#define __TestArrayReconfOverhead_h_
4+
#ifndef TestArrayReconfOverhead_h_
5+
#define TestArrayReconfOverhead_h_
66

77
#include "tools/common/TestRunner.h"
88
#include "xrt/xrt_device.h"
99

1010
class TestAIEReconfigOverhead : public TestRunner {
1111
public :
12-
boost::property_tree::ptree run(std::shared_ptr<xrt_core::device> dev);
12+
boost::property_tree::ptree run(const std::shared_ptr<xrt_core::device>&) override;
1313

1414
TestAIEReconfigOverhead();
1515
};

src/runtime_src/core/tools/common/tests/TestAiePl.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
1+
// SPDX-License-Identifier: Apache-2.0
2+
// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
23

34
// ------ I N C L U D E F I L E S -------------------------------------------
45
// Local - Include Files
@@ -33,7 +34,7 @@ TestAiePl::TestAiePl()
3334
"aie_control_config.json"){}
3435

3536
boost::property_tree::ptree
36-
TestAiePl::run(std::shared_ptr<xrt_core::device> dev)
37+
TestAiePl::run(const std::shared_ptr<xrt_core::device>& dev)
3738
{
3839
boost::property_tree::ptree ptree = get_test_header();
3940
ptree.put("xclbin", "pl_controller_aie.xclbin");
@@ -229,7 +230,7 @@ bool run_pl_controller_aie2(xrt::device device, xrt::uuid uuid, boost::property_
229230
}
230231

231232
void
232-
TestAiePl::runTest(std::shared_ptr<xrt_core::device> dev, boost::property_tree::ptree& ptree)
233+
TestAiePl::runTest(const std::shared_ptr<xrt_core::device>& dev, boost::property_tree::ptree& ptree)
233234
{
234235
xrt::device device(dev);
235236

src/runtime_src/core/tools/common/tests/TestAiePl.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
2+
// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
33

4-
#ifndef __TestAiePl_h_
5-
#define __TestAiePl_h_
4+
#ifndef TestAiePl_h_
5+
#define TestAiePl_h_
66

77
#include "tools/common/TestRunner.h"
88

99
class TestAiePl : public TestRunner {
1010
public:
11-
boost::property_tree::ptree run(std::shared_ptr<xrt_core::device> dev);
12-
void runTest(std::shared_ptr<xrt_core::device> dev, boost::property_tree::ptree& ptree);
11+
boost::property_tree::ptree run(const std::shared_ptr<xrt_core::device>&) override;
12+
void runTest(const std::shared_ptr<xrt_core::device>& dev, boost::property_tree::ptree& ptree);
1313

1414
public:
1515
TestAiePl();

src/runtime_src/core/tools/common/tests/TestAiePs.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
1+
// SPDX-License-Identifier: Apache-2.0
2+
// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
23

34
// ------ I N C L U D E F I L E S -------------------------------------------
45
// Local - Include Files
@@ -27,7 +28,7 @@ TestAiePs::TestAiePs()
2728
true){}
2829

2930
boost::property_tree::ptree
30-
TestAiePs::run(std::shared_ptr<xrt_core::device> dev)
31+
TestAiePs::run(const std::shared_ptr<xrt_core::device>& dev)
3132
{
3233
boost::property_tree::ptree ptree = get_test_header();
3334
ptree.put("xclbin_directory", "/lib/firmware/xilinx/ps_kernels/");
@@ -36,7 +37,7 @@ TestAiePs::run(std::shared_ptr<xrt_core::device> dev)
3637
}
3738

3839
void
39-
TestAiePs::runTest(std::shared_ptr<xrt_core::device> dev, boost::property_tree::ptree& ptree)
40+
TestAiePs::runTest(const std::shared_ptr<xrt_core::device>& dev, boost::property_tree::ptree& ptree)
4041
{
4142
xrt::device device(dev);
4243

src/runtime_src/core/tools/common/tests/TestAiePs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
2+
// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
33

4-
#ifndef __TestAiePs_h_
5-
#define __TestAiePs_h_
4+
#ifndef TestAiePs_h_
5+
#define TestAiePs_h_
66

77
#include "tools/common/TestRunner.h"
88

99
class TestAiePs : public TestRunner {
1010
public:
11-
boost::property_tree::ptree run(std::shared_ptr<xrt_core::device> dev);
12-
void runTest(std::shared_ptr<xrt_core::device> dev, boost::property_tree::ptree& ptree);
11+
boost::property_tree::ptree run(const std::shared_ptr<xrt_core::device>&) override;
12+
void runTest(const std::shared_ptr<xrt_core::device>& dev, boost::property_tree::ptree& ptree);
1313

1414
public:
1515
TestAiePs();

src/runtime_src/core/tools/common/tests/TestAuxConnection.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
1+
// SPDX-License-Identifier: Apache-2.0
2+
// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
23

34
// ------ I N C L U D E F I L E S -------------------------------------------
45
// Local - Include Files
@@ -16,7 +17,7 @@ TestAuxConnection::TestAuxConnection()
1617
"Check if auxiliary power is connected"){}
1718

1819
boost::property_tree::ptree
19-
TestAuxConnection::run(std::shared_ptr<xrt_core::device> dev)
20+
TestAuxConnection::run(const std::shared_ptr<xrt_core::device>& dev)
2021
{
2122
boost::property_tree::ptree ptree = get_test_header();
2223
const std::vector<std::string> auxPwrRequiredDevice = { "VCU1525", "U200", "U250", "U280" };

src/runtime_src/core/tools/common/tests/TestAuxConnection.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
2+
// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
33

4-
#ifndef __TestAuxConnection_h_
5-
#define __TestAuxConnection_h_
4+
#ifndef TestAuxConnection_h_
5+
#define TestAuxConnection_h_
66

77
#include "tools/common/TestRunner.h"
88

99
class TestAuxConnection : public TestRunner {
1010
public:
11-
boost::property_tree::ptree run(std::shared_ptr<xrt_core::device> dev);
11+
boost::property_tree::ptree run(const std::shared_ptr<xrt_core::device>&) override;
1212

1313
public:
1414
TestAuxConnection();

0 commit comments

Comments
 (0)