@@ -111,6 +111,11 @@ mod tests {
111111
112112 use super :: * ;
113113
114+ #[ cfg( not( windows) ) ]
115+ const GDB_COMMAND : & str = "rust-gdb" ;
116+ #[ cfg( windows) ]
117+ const GDB_COMMAND : & str = "gdb" ;
118+
114119 fn write_cmds_file ( cmd_file_path : & str , cmd : & str ) -> io:: Result < ( ) > {
115120 let file = File :: create ( cmd_file_path) ?;
116121 let mut writer = BufWriter :: new ( file) ;
@@ -150,7 +155,7 @@ mod tests {
150155 // wait 3 seconds for the gdb to connect
151156 thread:: sleep ( Duration :: from_secs ( 3 ) ) ;
152157
153- let mut gdb = Command :: new ( "rust-gdb" )
158+ let mut gdb = Command :: new ( GDB_COMMAND )
154159 . arg ( "--nw" )
155160 . arg ( "--batch" )
156161 . arg ( "-x" )
@@ -235,7 +240,9 @@ mod tests {
235240 #[ serial]
236241 fn test_gdb_end_to_end ( ) {
237242 let out_dir = std:: env:: var ( "OUT_DIR" ) . expect ( "Failed to get out dir" ) ;
238- let manifest_dir = std:: env:: var ( "CARGO_MANIFEST_DIR" ) . expect ( "Failed to get manifest dir" ) ;
243+ let manifest_dir = std:: env:: var ( "CARGO_MANIFEST_DIR" )
244+ . expect ( "Failed to get manifest dir" )
245+ . replace ( '\\' , "/" ) ;
239246 let out_file_path = format ! ( "{out_dir}/gdb.output" ) ;
240247 let cmd_file_path = format ! ( "{out_dir}/gdb-commands.txt" ) ;
241248
@@ -262,6 +269,9 @@ mod tests {
262269 "
263270 ) ;
264271
272+ #[ cfg( windows) ]
273+ let cmd = format ! ( "set osabi none\n {}" , cmd) ;
274+
265275 let checker = |contents : String | contents. contains ( "Stopped at hyperlight_main breakpoint" ) ;
266276
267277 let result = run_guest_and_gdb ( & cmd_file_path, & out_file_path, & cmd, checker) ;
@@ -277,7 +287,10 @@ mod tests {
277287 #[ serial]
278288 fn test_gdb_sse_check ( ) {
279289 let out_dir = std:: env:: var ( "OUT_DIR" ) . expect ( "Failed to get out dir" ) ;
280- let manifest_dir = std:: env:: var ( "CARGO_MANIFEST_DIR" ) . expect ( "Failed to get manifest dir" ) ;
290+ let manifest_dir = std:: env:: var ( "CARGO_MANIFEST_DIR" )
291+ . expect ( "Failed to get manifest dir" )
292+ . replace ( '\\' , "/" ) ;
293+ println ! ( "manifest dir {manifest_dir}" ) ;
281294 let out_file_path = format ! ( "{out_dir}/gdb-sse.output" ) ;
282295 let cmd_file_path = format ! ( "{out_dir}/gdb-sse--commands.txt" ) ;
283296
@@ -308,6 +321,9 @@ mod tests {
308321 "
309322 ) ;
310323
324+ #[ cfg( windows) ]
325+ let cmd = format ! ( "set osabi none\n {}" , cmd) ;
326+
311327 let checker = |contents : String | contents. contains ( "$2 = [1.20000005, 0, 0, 0]" ) ;
312328 let result = run_guest_and_gdb ( & cmd_file_path, & out_file_path, & cmd, checker) ;
313329
0 commit comments