@@ -30,6 +30,41 @@ const (
3030 testMTU = 9000
3131)
3232
33+ func TestServeCommandIssueATACommand (t * testing.T ) {
34+ // Request that the server identify its ATA device
35+ req := & aoe.Header {
36+ Version : aoe .Version ,
37+ Major : 1 ,
38+ Minor : 1 ,
39+ Command : aoe .CommandIssueATACommand ,
40+ Tag : [4 ]byte {0xde , 0xad , 0xbe , 0xef },
41+ Arg : & aoe.ATAArg {
42+ // Must be 1 for identify request
43+ SectorCount : 1 ,
44+ CmdStatus : aoe .ATACmdStatusIdentify ,
45+ },
46+ }
47+
48+ res := testRequest (t , req )
49+ arg , ok := res .Arg .(* aoe.ATAArg )
50+ if ! ok {
51+ t .Fatalf ("incorrect argument type for configuration request: %T" , res .Arg )
52+ }
53+
54+ if want , got := * req , * res ; ! headersEqual (got , want ) {
55+ t .Fatalf ("unexpected AoE header:\n - want: %+v\n - got: %+v" , want , got )
56+ }
57+
58+ // TODO(mdlayher): do deeper inspection of returned ATA identification data
59+ if want , got := aoe .ATACmdStatusReadyStatus , arg .CmdStatus ; want != got {
60+ t .Fatalf ("unexpected ATA CmdStatus:\n - want: %v\n - got: %v" , want , got )
61+ }
62+ // Expect 512 bytes (1 sector) of data
63+ if want , got := 512 , len (arg .Data ); want != got {
64+ t .Fatalf ("unexpected ATA data length:\n - want: %v\n - got: %v" , want , got )
65+ }
66+ }
67+
3368func TestServeCommandQueryConfigInformation (t * testing.T ) {
3469 // Request that the server send its current configuration
3570 req := & aoe.Header {
0 commit comments