IN THIS EDITION
External Tests from DMM – SATA SelfTest The ability to call any external program as a test step from within a DMM test sequence allows any new type of test to be added to the DMM test pallet. By using the Developers Toolbox (DTB) api you can send any command to any type of device. This example will illustrate how to run a SATA SMART Self Test as a DMM test step, logging the results to the DMM device log file. A C++ program to execute the SATA Self TestUsing Microsoft Visual Studio C++ and the STB Suite Developers Toolbox api we can send any command we need to any type of device. Since DMM is communicating with SATA devices via a SAS controller which implements SAT (SCSI->ATA Translation) such as the LSI 3800 or 3801 we must write our program to issue the SATA command imbedded into a SCSI command, according to the SAT standard. For this test we will run the default short SATA Self Test. To illustrate how easy it is to add a new test like this to DMM you will note that the sample source code is well under 200 lines. Our example project retrieves the address of the drive from the command line arguments passed by DMM. In addition DMM allows you to pass additional user defined command line arguments to your program. For example, you could modify this project to allow you to specify any of the different SATA Self Tests. DMM can also receive information passed back to it by the called external program. In the case of this example we will respond back to DMM with a text message saying whether the self test executed correctly or not. DMM runs the external programs as separate threads on each device under test, and so each separate device will get back only its own response string. The code to issue the self test command using the DTB User Defined SCSI command simply defines the proper command and issues it with one DTB function call as follows: SummaryThis quick example illustrates how simply and quickly completely new tests can be added to the DMM test pallet. From simple commands like this example uses, through highly complex tests, any new function is easily added to DMM via the DMM External Test test step. To request the complete Visual Studio project files for this example please contact Jeremy Wolfe at sales@scsitoolbox.com.
IntroductionTwo of the oldest disk tests in the STB Suite are the Confidence Test 1 and Confidence Test 2. These tests were first included in the original DOS version of the SCSI Toolbox in the early 1990s. The philosophy of these tests was to stress and test as many drive functions as possible in a relatively short time. The tradition of these tests is continued into the SATA world with the new pair of SATA confidence tests. This article will describe the second test, which is the more thorough of the two. These new tests issue native SATA task register commands and so it is necessary to have your disk drive connected to your test system via one of your motherboard SATA ports. What the test testsSATA Confidence #1 is accessed via the STB Suite Original Mode top menu ATA/SATA->Tests->Drive Confidence 1 (Quick Test) menu choice. This SATA Long Test runs the following test steps:
As the test progresses the various steps will be shown in blue as the step executes, and once the step is complete it will be displayed either in green if the step passed or in red if the step failed – here the test has executed the first three steps with no errors – Also note that the details of each test step are logged to the Test Status/Results window. All SMART information, SMART test logs, IDENTIFY information, and transfer rate performance metrics are recorded. Test Results OutputTest results may be viewed by scrolling the Test Status/Results window or by saving the log to a file. The saved log file will be a text file – here is an example: SummaryThis SATA Long Test runs the following test steps:
This test will take longer to complete than the quick test (Confidence Test #1), but it offers the advantage of executing any type of SMART Self Test and also offers the option of write testing and write performance measurement.
The Command Probability Sequencer (CPS) is a new API in VCPSSL v8.2.0 that allows you to define a set of commands that will be issued; each command has a specified probability it will be chosen for execution. This new API is quite complex and has many features – we will introduce the features by way of examples. As a first example, suppose you wanted to issue a lot of writes and reads, but every now and then issue a different command (like Log Sense command for example). And suppose you have a further requirement that this Log Sense command be issue about every 1000th I/O. The Command Probability Sequencer is perfect for implementing the above test scenario. Although the coding example below at first looks daunting, but for now focus on the following items: we are setting up three user-defined commands “Write”, “Read”, and “Log Sense” and we need to specify such information as whether data is going to/from the drive (the “nDataDir” field), and how much data needs to be transfer (the “nTransferLen” field). Here’s the code for our first example - focus on the lines of code in RED which have the “nDataDir” and “nTransferLength” parameters, and the actual definition of the commands.
const int c_nLenOfArray = 3; //Set up the “Read” command (Read opcode is 0x28) //Set up the “Log Sense” command (Log Sense opcode is 0x4D) //Now define the probabilities for each of the three commands VCSCSIAddDiskComProbSeqTest(arrOfCDB, In the example above our set of commands to issue is 3 (hence we set c_nLenOfArry to 3) and the number of commands to issue is 10000 (hence we set c_lNumberOfIOToIssue to 10000). Notice also in the call to API VCSCSIAddDiskComProbSeqTest we pass in two arrays: the first is the sequence of commands, and the second is the sequence containing the probabilities for these commands. NOTE: The sum of your probabilities must be exactly 1.0 (or 100%). Notice in our example the sum of the probabilities .4995, .4995, and .001 is exactly 1.0 Here is a BAM (Bus Analyzer Module) output from the above test: As you can see in the trace, there are Write, Log Sense, and Read commands. In the lower portion of the trace, on the I/O Statistics page, it shows the number and type of commands that went out. There were 5019 Read commands, 4966 Write commands, and 15 Log Sense commands (note that 5019 + 4966 + 15 = 10000, which is the number of commands we specified to CPS to issue). From this particular run, we see that the Read commands formed 5019/10000 = 50.19% of the commands, the Write commands formed 4966/10000 = 49.66% of the commands, and the Log Sense commands formed 15/10000 = 0.15%. These percentages are almost exactly the probabilities we specified to CPS.
SECOND EXAMPLE: Writing Every Even LBA With An Incrementing Pattern and Every Odd LBA with a Decrementing Pattern In this example we will cover two more features of the CPS – namely how to set the data pattern, and how to adjust your write and read (and other commands) automatically. To see why you would want to adjust the write command, suppose for the moment you did not adjust the command. Then every single time we issued the command we would be writing to the exact same location on the drive (in example 1, we would be writing to LBA 0 every single time). To allow adjusting the location the command writes to, we have introduced the “nGap” parameter. The nGap parameter tells CPS how much to adjust the location of the write command. For example, if nGap is 7 then successive writes would go to LBAs 0, 7, 14, 21, and so forth. In order to write every even LBA (i.e. the LBAs 0, 2, 4, 6, 8, 10, ….) we will need nGap to be exactly 2. So here’s how to see up the above type of test – focus on the lines of code in RED which have the “eTestPattern” and “nGap” parameters. const int c_nLenOfArray = 2; //Set up the “Write” command that writes to odd LBA, with Decrementing pattern //Now define the probabilities for these two commands. There’s no reason you have VCSCSIAddDiskComProbSeqTest(arrOfCDB,
Here is a BAM (Bus Analyzer Module) output from the above test: Notice in the BAM trace, the first Write command writes a decrementing pattern (to LBA 1), while the next three Write commands write an incrementing pattern (to LBA 0, 2, 4). Notice the “spacing” between the Write commands with incrementing pattern – they are exactly two blocks apart, which is exactly the nGap value we specified to CPS.
THIRD EXAMPLE: SENDING SPECIALIZE DATA TO THE DRIVE const int c_nLenOfArray = 3; //Do a Mode-Select (Mode-Select has opcode 0x15) //Set up the “Write” command (Write is opcode 0x2A) //Set up the “Read” command (Read opcode is 0x28) //Now define the probabilities for these two commands. There’s no reason you have VCSCSIAddDiskComProbSeqTest(arrOfCDB,
Here is a BAM (Bus Analyzer Module) output from the above test:
DEFINITIONS OF THE PARAMETERS FOR EACH COMMAND: Here is the data structure that you must fill out for each command you want to set up for CPS: struct _DMM_UserDefinedCDB
RETURN CODES AND POSSIBLE PROBLEMS WITH USING VCSCSIAddDiskComProbSeq API: This API returns TRUE to mean adding of the test to your sequence was done; Reasons for getting a return code of FALSE from API VCSCSIAddDiskComProbSeq:
Save this article for offline viewing here: CommandProbabilitySequencer.pdf
Here is a list of some recent customer training sessions that STB has conducted - live, interactive web sessions presented by STB programmers:
Contact Jeremy Wolfe at (720) 249-2641 today to schedule your own custom training session!
|
||||||||||||||||||||||||
|