@@ -2155,4 +2155,166 @@ mod get_log_page {
21552155 . await
21562156 } ) ;
21572157 }
2158+
2159+ #[ test]
2160+ fn error_information_short ( ) {
2161+ setup ( ) ;
2162+
2163+ let ( mut mep, mut subsys) = new_device ( DeviceType :: P1p1tC1aN1a0a ) ;
2164+
2165+ #[ rustfmt:: skip]
2166+ const REQ : [ u8 ; 67 ] = [
2167+ 0x10 , 0x00 , 0x00 ,
2168+ 0x02 , 0x00 , 0x00 , 0x00 ,
2169+
2170+ // SQE DWORD 1
2171+ 0x00 , 0x00 , 0x00 , 0x00 ,
2172+ 0x00 , 0x00 , 0x00 , 0x00 ,
2173+ 0x00 , 0x00 , 0x00 , 0x00 ,
2174+ 0x00 , 0x00 , 0x00 , 0x00 ,
2175+ 0x00 , 0x00 , 0x00 , 0x00 ,
2176+
2177+ // DOFST
2178+ 0x00 , 0x00 , 0x00 , 0x00 ,
2179+ 0x40 , 0x00 , 0x00 , 0x00 ,
2180+
2181+ // Reserved
2182+ 0x00 , 0x00 , 0x00 , 0x00 ,
2183+ 0x00 , 0x00 , 0x00 , 0x00 ,
2184+
2185+ // SQE DWORD 10
2186+ 0x01 , 0x00 , 0x0f , 0x00 ,
2187+ 0x00 , 0x00 , 0x00 , 0x00 ,
2188+ 0x00 , 0x00 , 0x00 , 0x00 ,
2189+ 0x00 , 0x00 , 0x00 , 0x00 ,
2190+ 0x00 , 0x00 , 0x00 , 0x00 ,
2191+ // Missing DWORD 15
2192+
2193+ // MIC
2194+ 0x01 , 0xbd , 0xa2 , 0xa3
2195+ ] ;
2196+
2197+ let resp = ExpectedRespChannel :: new ( & RESP_INVALID_COMMAND_SIZE ) ;
2198+ smol:: block_on ( async {
2199+ mep. handle_async ( & mut subsys, & REQ , MsgIC ( true ) , resp, async |_| Ok ( ( ) ) )
2200+ . await
2201+ } ) ;
2202+ }
2203+
2204+ #[ test]
2205+ fn error_information_long ( ) {
2206+ setup ( ) ;
2207+
2208+ let ( mut mep, mut subsys) = new_device ( DeviceType :: P1p1tC1aN1a0a ) ;
2209+
2210+ #[ rustfmt:: skip]
2211+ const REQ : [ u8 ; 75 ] = [
2212+ 0x10 , 0x00 , 0x00 ,
2213+ 0x02 , 0x00 , 0x00 , 0x00 ,
2214+
2215+ // SQE DWORD 1
2216+ 0x00 , 0x00 , 0x00 , 0x00 ,
2217+ 0x00 , 0x00 , 0x00 , 0x00 ,
2218+ 0x00 , 0x00 , 0x00 , 0x00 ,
2219+ 0x00 , 0x00 , 0x00 , 0x00 ,
2220+ 0x00 , 0x00 , 0x00 , 0x00 ,
2221+
2222+ // DOFST
2223+ 0x00 , 0x00 , 0x00 , 0x00 ,
2224+ 0x40 , 0x00 , 0x00 , 0x00 ,
2225+
2226+ // Reserved
2227+ 0x00 , 0x00 , 0x00 , 0x00 ,
2228+ 0x00 , 0x00 , 0x00 , 0x00 ,
2229+
2230+ // SQE DWORD 10
2231+ 0x01 , 0x00 , 0x0f , 0x00 ,
2232+ 0x00 , 0x00 , 0x00 , 0x00 ,
2233+ 0x00 , 0x00 , 0x00 , 0x00 ,
2234+ 0x00 , 0x00 , 0x00 , 0x00 ,
2235+ 0x00 , 0x00 , 0x00 , 0x00 ,
2236+ 0x00 , 0x00 , 0x00 , 0x00 ,
2237+ 0x00 , 0x00 , 0x00 , 0x00 ,
2238+
2239+ // MIC
2240+ 0x6f , 0x7d , 0xfd , 0x6d
2241+ ] ;
2242+
2243+ let resp = ExpectedRespChannel :: new ( & RESP_INVALID_COMMAND_SIZE ) ;
2244+ smol:: block_on ( async {
2245+ mep. handle_async ( & mut subsys, & REQ , MsgIC ( true ) , resp, async |_| Ok ( ( ) ) )
2246+ . await
2247+ } ) ;
2248+ }
2249+
2250+ #[ test]
2251+ fn error_information ( ) {
2252+ setup ( ) ;
2253+
2254+ let ( mut mep, mut subsys) = new_device ( DeviceType :: P1p1tC1aN1a0a ) ;
2255+
2256+ #[ rustfmt:: skip]
2257+ const REQ : [ u8 ; 71 ] = [
2258+ 0x10 , 0x00 , 0x00 ,
2259+ 0x02 , 0x00 , 0x00 , 0x00 ,
2260+
2261+ // SQE DWORD 1
2262+ 0x00 , 0x00 , 0x00 , 0x00 ,
2263+ 0x00 , 0x00 , 0x00 , 0x00 ,
2264+ 0x00 , 0x00 , 0x00 , 0x00 ,
2265+ 0x00 , 0x00 , 0x00 , 0x00 ,
2266+ 0x00 , 0x00 , 0x00 , 0x00 ,
2267+
2268+ // DOFST
2269+ 0x00 , 0x00 , 0x00 , 0x00 ,
2270+ 0x40 , 0x00 , 0x00 , 0x00 ,
2271+
2272+ // Reserved
2273+ 0x00 , 0x00 , 0x00 , 0x00 ,
2274+ 0x00 , 0x00 , 0x00 , 0x00 ,
2275+
2276+ // SQE DWORD 10
2277+ 0x01 , 0x00 , 0x0f , 0x00 ,
2278+ 0x00 , 0x00 , 0x00 , 0x00 ,
2279+ 0x00 , 0x00 , 0x00 , 0x00 ,
2280+ 0x00 , 0x00 , 0x00 , 0x00 ,
2281+ 0x00 , 0x00 , 0x00 , 0x00 ,
2282+ 0x00 , 0x00 , 0x00 , 0x00 ,
2283+
2284+ // MIC
2285+ 0x44 , 0x77 , 0x3b , 0x9e
2286+ ] ;
2287+
2288+ #[ rustfmt:: skip]
2289+ const RESP : [ u8 ; 87 ] = [
2290+ 0x90 , 0x00 , 0x00 ,
2291+ 0x00 , 0x00 , 0x00 , 0x00 ,
2292+ 0x00 , 0x00 , 0x00 , 0x00 ,
2293+ 0x00 , 0x00 , 0x00 , 0x00 ,
2294+ 0x00 , 0x00 , 0x01 , 0x00 ,
2295+ 0x00 , 0x00 , 0x00 , 0x00 ,
2296+ 0x00 , 0x00 , 0x00 , 0x00 ,
2297+ 0x00 , 0x00 , 0x00 , 0x00 ,
2298+ 0x00 , 0x00 , 0x00 , 0x00 ,
2299+ 0x00 , 0x00 , 0x00 , 0x00 ,
2300+ 0x00 , 0x00 , 0x00 , 0x00 ,
2301+ 0x00 , 0x00 , 0x00 , 0x00 ,
2302+ 0x00 , 0x00 , 0x00 , 0x00 ,
2303+ 0x00 , 0x00 , 0x00 , 0x00 ,
2304+ 0x00 , 0x00 , 0x00 , 0x00 ,
2305+ 0x00 , 0x00 , 0x00 , 0x00 ,
2306+ 0x00 , 0x00 , 0x00 , 0x00 ,
2307+ 0x00 , 0x00 , 0x00 , 0x00 ,
2308+ 0x00 , 0x00 , 0x00 , 0x00 ,
2309+ 0x00 , 0x00 , 0x00 , 0x00 ,
2310+ 0x00 , 0x00 , 0x00 , 0x00 ,
2311+ 0xb6 , 0xce , 0x4e , 0x7f
2312+ ] ;
2313+
2314+ let resp = ExpectedRespChannel :: new ( & RESP ) ;
2315+ smol:: block_on ( async {
2316+ mep. handle_async ( & mut subsys, & REQ , MsgIC ( true ) , resp, async |_| Ok ( ( ) ) )
2317+ . await
2318+ } ) ;
2319+ }
21582320}
0 commit comments