Skip to content

Conversation

kalyanalle
Copy link
Contributor

@kalyanalle kalyanalle commented Aug 21, 2025

Related-To: VLCLJ-2532/VLCLJ-2533

Operational Constraint/Known Behavior:

The OptionROM code and OptionROM data firmware flashing tests both use the same firmware name (OptionROM.bin) as retrieved from get_firmware_properties.
It is the user's responsibility to ensure that the correct OptionROM.bin file is placed in the directory specified by the ZE_LZT_FIRMWARE_DIRECTORY environment variable.
The test does not distinguish between code and data; it uses the firmware handle's name as provided by the API.
If different images are required for code and data, the user must manage the file content accordingly.

@vishnu-khanth
Copy link
Contributor

New tests have to follow similar changes done firmware tests in commit
7027d05#diff-2ce519d2aec202571b08fdd2425714438d86a0cac9bcfce7f82a6ff70a97d6e5

Better to rebase to latest master and apply the changes

Copilot

This comment was marked as outdated.

@kalyanalle kalyanalle force-pushed the gfx_oprom_firmware_flash branch from fab4416 to 90a3b13 Compare August 25, 2025 08:17
@kalyanalle
Copy link
Contributor Author

New tests have to follow similar changes done firmware tests in commit
7027d05#diff-2ce519d2aec202571b08fdd2425714438d86a0cac9bcfce7f82a6ff70a97d6e5

Better to rebase to latest master and apply the changes

done! , taken care.

Copilot

This comment was marked as outdated.

…w types

OptionROM firmwares

Related-To: VLCLJ-2532

Removing GivenValidFirmwareHandleWhenFlashingOptionRomThenExpectFirmwareFlashingSuccess
and creating single parameterized test with two different params GFX and
OptionROM.

Signed-off-by: Alle, Kalyan <[email protected]>
@kalyanalle kalyanalle force-pushed the gfx_oprom_firmware_flash branch from 428f851 to 4c1357b Compare September 8, 2025 06:40
@kalyanalle kalyanalle requested a review from Copilot September 8, 2025 06:41
Copilot

This comment was marked as outdated.

uint32_t count = 0;
count = lzt::get_firmware_handle_count(device);
if (count > 0) {
is_firmware_supported = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this LOG_INFO << "Firmware handles are available on this device! "; could be added

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@vishnu-khanth
Copy link
Contributor

PR title could also be updated to

refactor: Split firmware flash test in multiple tests for different fw types

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the firmware flashing tests to support parameterized testing for specific firmware types (GFX and OptionROM). The changes replace a generic firmware flashing test with a more targeted approach that can test different firmware types individually.

Key changes:

  • Removed the generic firmware flashing test that attempted to flash all available firmware
  • Added parameterized test infrastructure to test specific firmware types (GFX and OptionROM)
  • Enhanced logging to provide better visibility into firmware name and path during testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +304 to +310
std::vector<char> testFwImage(
static_cast<size_t>(inFileStream.tellg()));
inFileStream.seekg(0, inFileStream.beg);
inFileStream.read(testFwImage.data(), testFwImage.size());
lzt::flash_firmware(firmware_handle,
static_cast<void *>(testFwImage.data()),
testFwImage.size());
Copy link
Preview

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name testFwImage uses inconsistent naming compared to the existing flash_firmware function which uses test_fw_image (snake_case). Consider using test_fw_image for consistency.

Suggested change
std::vector<char> testFwImage(
static_cast<size_t>(inFileStream.tellg()));
inFileStream.seekg(0, inFileStream.beg);
inFileStream.read(testFwImage.data(), testFwImage.size());
lzt::flash_firmware(firmware_handle,
static_cast<void *>(testFwImage.data()),
testFwImage.size());
std::vector<char> test_fw_image(
static_cast<size_t>(inFileStream.tellg()));
inFileStream.seekg(0, inFileStream.beg);
inFileStream.read(test_fw_image.data(), test_fw_image.size());
lzt::flash_firmware(firmware_handle,
static_cast<void *>(test_fw_image.data()),
test_fw_image.size());

Copilot uses AI. Check for mistakes.

Comment on lines +294 to +298
std::string fwName(reinterpret_cast<char *>(propFw.name));
std::string fwToLoad = fwDir + "/" + fwName + ".bin";
LOG_INFO << " Firmware Name: " << fwName;
LOG_INFO << " Firmware Path: " << fwToLoad;
std::ifstream inFileStream(fwToLoad,
Copy link
Preview

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable names fwName and fwToLoad use inconsistent camelCase naming compared to the existing flash_firmware function which uses fw_name and fw_to_load (snake_case). Consider using snake_case for consistency with the existing codebase.

Suggested change
std::string fwName(reinterpret_cast<char *>(propFw.name));
std::string fwToLoad = fwDir + "/" + fwName + ".bin";
LOG_INFO << " Firmware Name: " << fwName;
LOG_INFO << " Firmware Path: " << fwToLoad;
std::ifstream inFileStream(fwToLoad,
std::string fw_name(reinterpret_cast<char *>(propFw.name));
std::string fw_to_load = fwDir + "/" + fw_name + ".bin";
LOG_INFO << " Firmware Name: " << fw_name;
LOG_INFO << " Firmware Path: " << fw_to_load;
std::ifstream inFileStream(fw_to_load,

Copilot uses AI. Check for mistakes.

Comment on lines +298 to +307
std::ifstream inFileStream(fwToLoad,
std::ios::binary | std::ios::ate);
if (!inFileStream.is_open()) {
LOG_INFO << "Skipping test as firmware image not found";
GTEST_SKIP();
}
std::vector<char> testFwImage(
static_cast<size_t>(inFileStream.tellg()));
inFileStream.seekg(0, inFileStream.beg);
inFileStream.read(testFwImage.data(), testFwImage.size());
Copy link
Preview

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name inFileStream uses inconsistent camelCase naming compared to the existing flash_firmware function which uses in_filestream (snake_case). Consider using in_filestream for consistency.

Suggested change
std::ifstream inFileStream(fwToLoad,
std::ios::binary | std::ios::ate);
if (!inFileStream.is_open()) {
LOG_INFO << "Skipping test as firmware image not found";
GTEST_SKIP();
}
std::vector<char> testFwImage(
static_cast<size_t>(inFileStream.tellg()));
inFileStream.seekg(0, inFileStream.beg);
inFileStream.read(testFwImage.data(), testFwImage.size());
std::ifstream in_filestream(fwToLoad,
std::ios::binary | std::ios::ate);
if (!in_filestream.is_open()) {
LOG_INFO << "Skipping test as firmware image not found";
GTEST_SKIP();
}
std::vector<char> testFwImage(
static_cast<size_t>(in_filestream.tellg()));
in_filestream.seekg(0, in_filestream.beg);
in_filestream.read(testFwImage.data(), testFwImage.size());

Copilot uses AI. Check for mistakes.

@vishnu-khanth
Copy link
Contributor

@kalyanalle can you share how the test names look like when the test is run ?
Changes looks good to me

@vishnu-khanth
Copy link
Contributor

And I see that commit msg is updated, this PR title also can be updated

@kalyanalle kalyanalle changed the title Update: Adding tests for flashing GFX, OptionROM firmwares Refactor: Split firmware flash test in multiple tests for different fw types Sep 8, 2025
Copy link
Contributor

@vishnu-khanth vishnu-khanth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants