Test type・Semi-normal test with hardware control 

23/09/2020Test qualityy

Semi-normal test and abnormal test in the code that controls the hardware

Embedded software often has a hardware control function, and in some cases, it is often called a hardware control function by the name of a device driver. And when controlling the hardware, it is assumed that the hardware will return some kind of error response , and error handling will be incorporated into the software. Take, for example, the process of reading a hard disk drive (HDD).

 When the command Read-hdd (status, data) is called, the contents read from the hard disk drive are stored in the data area, and the status of success or failure of the read command is recorded in status. To do. If you simply write the flow of data read processing using this Read-hdd (status, data) with C language-like pseudo code, it will look like this.

① Read-hdd (status, data) / * Request read from the hard disk drive * /

② if (status == SUCCESS) then {data processing} / * If reading is successful, data is processed * /

③ elseif (ststus == ERROR-1) then {ERROR-1 processing} / * Correspondence of ERROR-1 * /

④ elseif (ststus == ERROE-2) then {ERROR-2 processing} / * Correspondence of ERROR-2 * /

⑤ elseif (ststus == ERROE-3) then {ERROR-3 processing} / * Correspondence of ERROR-3 * /

⑤ else {Undefined error handling} / * Response to undefined error * /

Processing when no error occurs is normal

With this pseudo code, ① and ② are normal codes because they are the processes when data can be read normally from the hard disk drive .

It is a semi-normal system that corresponds to the defined error code

③, ④, and ⑤ are semi-normal codes because they are the processes when a predefined error occurs in the hard disk drive . For example, the hard disk drive may not be turned on, the read data may be corrupted, a timeout may occur, and various other errors may occur. Since the value of the error code that indicates which of these errors has occurred is set in status, error handling is performed according to the value of that status. In many cases, the number of defined errors is not three, but more than ten, so this quasi-normal code has a larger amount of code than normal or abnormal code.

Processing when an undefined error code is returned is an abnormal test

And  is an abnormal code because it is a process when an abnormal state occurs in which a strange value other than the defined error code is recorded in status . If the hardware circuits that make up the hard disk drive are operating normally, status will not be set to anything other than the defined error code. However, it cannot be said that the value defined in status is never destroyed as a result of the hardware circuit malfunctioning due to noise. Also, since the command Read-hdd (status, data) itself is created as some kind of software, it is possible that there is a bug in it and an undefined value is set in status. The abnormal code in (6) corresponds to such an abnormal state.

The normal test when the code is configured like this is a test to confirm the operation of the software that the normal codes of ① and ② operate and the data can be read correctly. The semi-normal test is a test that confirms that when an error occurs in advance, such as (3), (4), and (5), the processing corresponding to the error operates as designed. And the abnormal test is a test to confirm the processing when an abnormal state that was not expected at the time of design occurs like ⑥.

Next : Test type・Functional testing of RAS
Back :  Test type・Semi-normal test in state transition
Return to :  Testing is the only way to guarantee software quality