Refactor: Split firmware flash test in multiple tests for different fw types#283
Refactor: Split firmware flash test in multiple tests for different fw types#283kalyanalle wants to merge 1 commit intooneapi-src:masterfrom
Conversation
|
New tests have to follow similar changes done firmware tests in commit Better to rebase to latest master and apply the changes |
fab4416 to
90a3b13
Compare
|
New tests have to follow similar changes done firmware tests in commit Better to rebase to latest master and apply the changes done! , taken care. |
conformance_tests/sysman/test_sysman_firmware/src/test_sysman_firmware.cpp
Outdated
Show resolved
Hide resolved
conformance_tests/sysman/test_sysman_firmware/src/test_sysman_firmware.cpp
Outdated
Show resolved
Hide resolved
90a3b13 to
428f851
Compare
…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 <kalyan.alle@intel.com>
428f851 to
4c1357b
Compare
| uint32_t count = 0; | ||
| count = lzt::get_firmware_handle_count(device); | ||
| if (count > 0) { | ||
| is_firmware_supported = true; |
There was a problem hiding this comment.
After this LOG_INFO << "Firmware handles are available on this device! "; could be added
|
PR title could also be updated to refactor: Split firmware flash test in multiple tests for different fw types |
4c1357b to
a7e60a4
Compare
There was a problem hiding this comment.
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.
| 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()); |
There was a problem hiding this comment.
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.
| 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()); |
| 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, |
There was a problem hiding this comment.
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.
| 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, |
| 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()); |
There was a problem hiding this comment.
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.
| 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()); |
|
@kalyanalle can you share how the test names look like when the test is run ? |
|
And I see that commit msg is updated, this PR title also can be updated |
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.