U-boot : compare read and expect value
Hi,
I'm newbie and I want to use scripts to test the board peripherals (I2C, SPI, LAN, PCIe, USB, ...) using u-boot.
My problem is how to compare the reading with the expected value? the reading is in an environment variable? If so which one? I searched the forums and docs without success.
Thanks & Best Regards,
Khalid
Dear Khalid Tourabi,
Quoted 6 lines · In message <[email protected]> you wrote:
I'm newbie and I want to use scripts to test the board peripherals (I2C, SPI, LAN, PCIe, USB, ...) using u-boot.
My problem is how to compare the reading with the expected value? the reading is in an environment variable? If so which one? I searched the forums and docs without success.
Have a look at the setexpr command...
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Ein weiser Herrscher kann in einem gro?en Land mehr Gutes bewirken als in einem kleinen - ein dummer Herrscher aber auch viel mehr Un- fug. Da weise Herrscher seltener sind als dumme, war ich schon immer gegen gro?e Reiche skeptisch. - Herbert Rosendorfer
Dear Khalid Tourabi,
please don't top post / full quote, and keep the mailing list on Cc:
Quoted 7 lines · In message <[email protected]> you wrote:
Thanks for your answer.
setexpr command allows set the result operation in an environment
variable.
But I want to set the result command (string) in an environment
variable to compare it with the expect value.
Build it from parts. Start with putting the expected value in an environment variable, so you can use setexpr to compareit against the actual value. Then use conditionals to react as needed. Use standard shell scripting methods.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de You can't have everything... where would you put it? - Steven Wright
Dear Wolfgang Denk
Quoted 3 lines
Dear Khalid Tourabi,
please don't top post / full quote, and keep the mailing list on Cc:
Ok sorry thanks.
Quoted 8 lines
Quoted 6 lines · In message<[email protected]> you wrote:
Thanks for your answer.
setexpr command allows set the result operation in an environment
variable.
But I want to set the result command (string) in an environment
variable to compare it with the expect value.
Quoted 9 lines
Build it from parts. Start with putting the expected value in an environment variable, so you can use setexpr to compareit against the actual value. Then use conditionals to react as needed. Use standard shell scripting methods.
Best regards,
Wolfgang Denk
I added setexpr command, but I don't understand how to use it for my need.
For example :
u-boot# set expct "FF7F7F7F7F7F7FC2"
u-boot# sspi 8 64 9F
FF7F7F7F7F7F7FC2
u-boot#This SPI command allows to read the NVRAM code ID, I want to compare with $expct unsuccessfully
u-boot# if test "sspi 8 64 9F" = $expct ; then echo Success; else
echo Error; fi;
Success
u-boot# set expct "FF7F7F7F7F7F7FC"
u-boot# if test "sspi 8 64 9F" = $expct ; then echo Success; else
echo Error; fi;
Success
$expct either equal to "FF7F7F7F7F7F7FC2" or "FF7F7F7F7F7F7FC" the result of if condition is the same.
Many Thanks for your help.
Khalid