-
Notifications
You must be signed in to change notification settings - Fork 894
Fix headless gui::dump_heatmap #10366
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
Open
naveenvenk17
wants to merge
6
commits into
The-OpenROAD-Project:master
Choose a base branch
from
naveenvenk17:worker7/fix-headless-dump-heatmap-5897
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8140a55
Fix headless GUI heatmap dumps
naveenvenk17 66f1357
Sync headless heatmap enumeration
naveenvenk17 e35b3b0
gui: fix headless heatmap test helper path
naveenvenk17 9e28662
gui: fix headless heatmap test data paths
naveenvenk17 56720db
gui: strengthen headless heatmap regression
naveenvenk17 ba6d2b9
gui: format heatmap sync test
naveenvenk17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,21 @@ | ||
| set(GUI_TESTS supported) | ||
|
|
||
| if (Qt5_FOUND AND BUILD_GUI) | ||
| list(APPEND GUI_TESTS dump_heatmap_headless) | ||
|
|
||
| add_executable(gui_heatmap_sync_test heatmap_sync_test.cpp) | ||
| target_link_libraries(gui_heatmap_sync_test | ||
| gui | ||
| odb | ||
| utl_lib | ||
| GTest::gtest | ||
| GTest::gtest_main | ||
| ) | ||
| gtest_discover_tests(gui_heatmap_sync_test) | ||
| endif() | ||
|
|
||
| or_integration_tests( | ||
| "gui" | ||
| TESTS | ||
| supported | ||
| ${GUI_TESTS} | ||
| ) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| set script_dir [file dirname [info script]] | ||
| set openroad_test_dir [file normalize [file join $script_dir .. .. .. test]] | ||
|
|
||
| source [file join $openroad_test_dir helpers.tcl] | ||
|
|
||
| if { ![gui::supported] } { | ||
| puts "Fail" | ||
| exit 1 | ||
| } | ||
|
|
||
| suppress_message ODB 128 | ||
| suppress_message ODB 130 | ||
| suppress_message ODB 131 | ||
| suppress_message ODB 132 | ||
| suppress_message ODB 133 | ||
| suppress_message ODB 227 | ||
|
|
||
| read_lef [file join $openroad_test_dir Nangate45 Nangate45.lef] | ||
| read_def [file join $openroad_test_dir gcd_nangate45.def] | ||
|
|
||
| set heatmap_file [make_result_file dump_heatmap_headless.csv] | ||
| gui::dump_heatmap Placement $heatmap_file | ||
|
|
||
| set heatmap [open $heatmap_file r] | ||
| set contents [read $heatmap] | ||
| close $heatmap | ||
|
|
||
| if { | ||
| [string first "value (%)" $contents] >= 0 | ||
| && [regexp -line {^[0-9.-]+,[0-9.-]+,[0-9.-]+,[0-9.-]+,} $contents] | ||
| } { | ||
| puts "Pass" | ||
| } else { | ||
| puts "Fail" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // SPDX-License-Identifier: BSD-3-Clause | ||
| // Copyright (c) 2026, The OpenROAD Authors | ||
|
|
||
| #include "gtest/gtest.h" | ||
| #include "gui/gui.h" | ||
| #include "gui/heatMap.h" | ||
| #include "odb/db.h" | ||
| #include "utl/Logger.h" | ||
|
|
||
| namespace gui { | ||
| namespace { | ||
|
|
||
| TEST(GuiHeatMapTest, HeadlessLookupSyncsSourcesToCurrentChip) | ||
| { | ||
| utl::Logger logger; | ||
| odb::dbDatabase* db = odb::dbDatabase::create(); | ||
| ASSERT_NE(db, nullptr); | ||
|
|
||
| Gui* gui = Gui::get(); | ||
| gui->init(db, nullptr, &logger); | ||
|
|
||
| HeatMapDataSource* placement = gui->getHeatMap("Placement"); | ||
| ASSERT_NE(placement, nullptr); | ||
| EXPECT_EQ(nullptr, placement->getChip()); | ||
|
|
||
| odb::dbTech* tech = odb::dbTech::create(db, "tech"); | ||
| ASSERT_NE(tech, nullptr); | ||
| odb::dbChip* chip = odb::dbChip::create(db, tech); | ||
| ASSERT_NE(chip, nullptr); | ||
| odb::dbBlock::create(chip, "top"); | ||
|
|
||
| EXPECT_EQ(chip, db->getChip()); | ||
| EXPECT_EQ(chip, gui->getHeatMap("Placement")->getChip()); | ||
|
|
||
| const auto& heat_maps = gui->getHeatMaps(); | ||
| ASSERT_FALSE(heat_maps.empty()); | ||
| for (auto* heat_map : heat_maps) { | ||
| EXPECT_EQ(chip, heat_map->getChip()); | ||
| } | ||
| } | ||
|
|
||
| } // namespace | ||
| } // namespace gui |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
syncHeatMapChipsmethod correctly handles the synchronization of heatmap data sources with the current database chip in headless mode. However, for better API consistency and to ensure that any code iterating over all heatmaps (viagetHeatMaps()) also sees the updated state, consider moving the implementation ofgetHeatMaps()from the header to the.cppfile and callingsyncHeatMapChips()there as well.