PDA

Voir la version complète : Request for enhancement to support automated tests


heyjoe
02/10/2008, 12h56
I have modified memtest+-2.0 to allow it to be used in an automatic testing environment.
The changes cause memtest to exit after a fixed number of passes, with an error flag (pass or fail) written to CMOS, and the number of failures written to another byte in CMOS.
I've configured GRUB to boot memtest once and then to boot into Linux to check the error flag.
The memtest changes are quite minor.
I propose adding 3 #defines to config.h, like this
/* NUMBER_OF_PASSES – number of passes before exit */
/* 0 means loop forever (the original memtest behaviour) */
#define NUMBER_OF_PASSES 0

/* CMOS_MEMTEST_ERROR_FLAG_ADDR – CMOS byte address for the error flag */
/* valid only if NUMBER_OF_PASSES not 0 */
/* May be left undefined */
#define CMOS_MEMTEST_ERROR_ FLAG_ADDR 1

/* CMOS_MEMTEST_ERROR_COUNT_ADDR – CMOS byte address for the error count */
/* valid only if NUMBER_OF_PASSES not 0 */
/* May be left undefined */
#define CMOS_MEMTEST_ERROR_ COUNT_ADDR 3
The code changes are in main.c
In function parse_command_line, (if NUMBER_OF_PASSES not 0), set the error flag, and zero the error count.
In function do_test, at the end of a pass, if we've completed NUMBER_OF_PASSES set/clear the error flag, copy the number of errors to CMOS, and do a warm start.
The CMOS bytes I've used are the bytes for RTC Alarm seconds and minutes.
Note that the error flag is set initially - this is so that if the user aborts memtest by hitting ESC, it'll be flagged as an error, but with an error count of zero.
For my automated testing, I actually set the error flag from Linux before rebooting into memtest. This is so that if memtest fails to boot or exits immediately, the error flag will still be set at the next Linux boot.
The default value for NUMBER_OF_PASSES is 0. With this value, memtest compiles as before (ie runs forever).
I hope this meets with your approval.
Regards
Joe Chestnutt

Doc TB
02/10/2008, 13h03
Hehe, I already wrote such a thing some years ago for DFI.

BTW, there is a problem with that kind of automated feature : when you store a value in CMOS, you can't be sure the BIOS will not use a CMOS checksum or an unknown CMOS map. And a cleared CMOS is not a good things for many users.

But the feature may be added as an "hidden" option, for power users.

Could you send me the complete diff file or post it here ?

heyjoe
03/10/2008, 16h20
I'll post a diff of the changes next week when I get back to the office.

As for the CMOS checksum, the 2 bytes I use aren't included in the checksum.- - I've used 2 of the RTC Alarm bytes.
The checksum (in 0x2E/0x2F) is the sum of bytes 0x10 to 0x2D.

Doc TB
04/10/2008, 13h50
Ok, but are you sure these bits are not deprecated ?

BTW, please post your diff here, I will add it in next rev