Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use regexp for Flashy S356523 workaround
Summary: When tested on an affected device with the built ephemeral fbpkg, the workaround in D47928352 did not catch the issue. While the grep matches, it fails when used as a utils.runCommand ``` In [14]: await host.run_raw_cmd("grep mtd0:.*spi0.1 /proc/mtd") Out[14]: CommandResult(exit_status=0, stderr='', stdout='mtd0: 08000000 00010000 "spi0.1"\n', exit_signal=None) In [15]: await flashy.flashy_checks_and_remediations("flash1","grandteton","openbmc.image.grandteton:v2023.25.2",True) Command '/run/flashy/checks_and_remediations/common/05_ensure_flash_writable --imagepath /run/upgrade/image --device mtd:flash1' exited with non-zero exit code: CommandResult(exit_status=53, std err='2023/07/31 16:10:47 Starting: checks_and_remediations/common/05_ensure_flash_writable\n2023/07/31 16:10:47 Running command \'grep mtd0:.*spi0.1 /proc/mtd\' with 30s timeout\n2023/07/31 16:1 0:47 Command \'grep mtd0:.*spi0.1 /proc/mtd\' exited with code 1 after 6.668228ms\n2023/07/31 16:10:47 Running command \'fw_printenv bootargs\' with 30s timeout\n2023/07/31 16:10:47 stderr: Warn ing: Bad CRC, using default environment\n2023/07/31 16:10:47 stdout: bootargs=console=ttyS0,57600n8 root=/dev/ram rw vmalloc=384M\n2023/07/31 16:10:47 Command \'fw_printenv bootargs\' exited wit h code 0 after 17.899282ms\n2023/07/31 16:10:47 Running command \'fw_setenv _flashy_test 4d658221\' with 30s timeout\n2023/07/31 16:10:47 stderr: Warning: Bad CRC, using default environment\n202 3/07/31 16:10:47 Command \'fw_setenv _flashy_test 4d658221\' exited with code 0 after 30.450366ms\n2023/07/31 16:10:47 Running command \'fw_printenv _flashy_test\' with 30s timeout\n2023/07/31 1 6:10:47 stderr: Warning: Bad CRC, using default environment\n2023/07/31 16:10:47 stderr: ## Error: "_flashy_test" not defined\n2023/07/31 16:10:47 Command \'fw_printenv _flashy_test\' exited wit h code 1 after 19.637594ms\n2023/07/31 16:10:47 U-Boot environment is READ ONLY\n2023/07/31 16:10:47 Running command \'fw_setenv _flashy_test\' with 30s timeout\n2023/07/31 16:10:47 stderr: Warn ing: Bad CRC, using default environment\n2023/07/31 16:10:47 Command \'fw_setenv _flashy_test\' exited with code 0 after 30.213364ms\n2023/07/31 16:10:47 {Err:U-Boot environment is read only: fl ash chips swapped? Error code: exit status 1, stderr: Warning: Bad CRC, using default environment\n## Error: "_flashy_test" not defined\n\ngithub.com/facebook/openbmc/tools/flashy/checks_and_rem ediations/common.ensureFlashWritable\n\t/home/ciaranconcannon/local/openbmc/tools/flashy/checks_and_remediations/common/05_ensure_flash_writable.go:98\nmain.main\n\t/home/ciaranconcannon/local/o penbmc/tools/flashy/flashy.go:139\nruntime.main\n\t/data/users/ciaranconcannon/gopaths/goroot/src/runtime/proc.go:250\nruntime.goexit\n\t/data/users/ciaranconcannon/gopaths/goroot/src/runtime/as m_arm.s:824}\n{"message":"U-Boot environment is read only: flash chips swapped? Error code: exit status 1, stderr: Warning: Bad CRC, using default environment\\n## Error: \\"_flashy_test\\" not defined\\n"}\n', stdout='', exit_signal=None) FLASHY_ERROR_BAD_FLASH_CHIP: U-Boot environment is read only: flash chips swapped? Error code: exit status 1, stderr: Warning: Bad CRC, using default environment ## Error: "_flashy_test" not defined``` Test Plan: Confirmed that flashy checks and remediations runs without issue with ephemeral built fbpkg openmbc.utils.flashy:414c5ac ``` In [2]: from openbmc.lib.openbmc_host import OpenBMCHost In [3]: from openbmc.lib.helpers.flashy import Flashy In [4]: host = OpenBMCHost("provisioninghold73583-oob.pci2") In [5]: flashy = Flashy(host) In [6]: await flashy.flashy_fetch("openbmc.image.grandteton:v2023.25.2") In [7]: await flashy.flashy_install() In [8]: await flashy.flashy_checks_and_remediations("flash1","grandteton","openbmc.image.grandteton:v2023.25.2",True) In [9]: ``` --- Unit tests ``` $ go test . ok github.com/facebook/openbmc/tools/flashy/checks_and_remediations/common ``` Reviewed By: mchugh19 Differential Revision: D47945711 fbshipit-source-id: 3d3c05c77b3d6cf85b687784f1357fd1c54204f1
- Loading branch information