Skip to content

Commit 846780a

Browse files
committed
tmp
Signed-off-by: danbugs <[email protected]>
1 parent 832240d commit 846780a

File tree

3 files changed

+2
-150
lines changed

3 files changed

+2
-150
lines changed

src/hyperlight_host/src/mem/mgr.rs

-148
Original file line numberDiff line numberDiff line change
@@ -434,151 +434,3 @@ impl SandboxMemoryManager<HostSharedMemory> {
434434
Ok(vec_out)
435435
}
436436
}
437-
438-
// TODO(danbugs:297): bring back
439-
// #[cfg(test)]
440-
// mod tests {
441-
// #[cfg(all(target_os = "windows", inprocess))]
442-
// use serial_test::serial;
443-
//
444-
// #[test]
445-
// fn load_guest_binary_common() {
446-
// let guests = vec![
447-
// rust_guest_as_pathbuf("simpleguest"),
448-
// rust_guest_as_pathbuf("callbackguest"),
449-
// ];
450-
// for guest in guests {
451-
// let guest_bytes = bytes_for_path(guest).unwrap();
452-
// let exe_info = ExeInfo::from_buf(guest_bytes.as_slice()).unwrap();
453-
// let stack_size_override = 0x3000;
454-
// let heap_size_override = 0x10000;
455-
// let mut cfg = SandboxConfiguration::default();
456-
// cfg.set_stack_size(stack_size_override);
457-
// cfg.set_heap_size(heap_size_override);
458-
// let (layout, shared_mem, _, _) =
459-
// super::load_guest_binary_common(cfg, &exe_info, |_, _| Ok(RawPtr::from(100)))
460-
// .unwrap();
461-
// assert_eq!(
462-
// stack_size_override,
463-
// u64::try_from(layout.stack_size).unwrap()
464-
// );
465-
// assert_eq!(heap_size_override, u64::try_from(layout.heap_size).unwrap());
466-
// assert_eq!(layout.get_memory_size().unwrap(), shared_mem.mem_size());
467-
// }
468-
// }
469-
//
470-
// #[cfg(all(target_os = "windows", inprocess))]
471-
// #[test]
472-
// #[serial]
473-
// fn load_guest_binary_using_load_library() {
474-
// use hyperlight_testing::rust_guest_as_pathbuf;
475-
//
476-
// use crate::mem::mgr::SandboxMemoryManager;
477-
//
478-
// let cfg = SandboxConfiguration::default();
479-
// let guest_pe_path = rust_guest_as_pathbuf("simpleguest.exe");
480-
// let guest_pe_bytes = bytes_for_path(guest_pe_path.clone()).unwrap();
481-
// let mut pe_info = ExeInfo::from_buf(guest_pe_bytes.as_slice()).unwrap();
482-
// let _ = SandboxMemoryManager::load_guest_binary_using_load_library(
483-
// cfg,
484-
// guest_pe_path.to_str().unwrap(),
485-
// &mut pe_info,
486-
// )
487-
// .unwrap();
488-
//
489-
// let guest_elf_path = rust_guest_as_pathbuf("simpleguest");
490-
// let guest_elf_bytes = bytes_for_path(guest_elf_path.clone()).unwrap();
491-
// let mut elf_info = ExeInfo::from_buf(guest_elf_bytes.as_slice()).unwrap();
492-
//
493-
// let res = SandboxMemoryManager::load_guest_binary_using_load_library(
494-
// cfg,
495-
// guest_elf_path.to_str().unwrap(),
496-
// &mut elf_info,
497-
// );
498-
//
499-
// match res {
500-
// Ok(_) => {
501-
// panic!("loadlib with elf should fail");
502-
// }
503-
// Err(err) => {
504-
// assert!(err
505-
// .to_string()
506-
// .contains("LoadLibrary can only be used with PE files"));
507-
// }
508-
// }
509-
// }
510-
//
511-
// /// Don't write a host error, try to read it back, and verify we
512-
// /// successfully do the read but get no error back
513-
// #[test]
514-
// fn get_host_error_none() {
515-
// let cfg = SandboxConfiguration::default();
516-
// let layout = SandboxMemoryLayout::new(cfg, 0x10_000, 0x10_000, 0x10_000, 0x10_000).unwrap();
517-
// let mut eshm = ExclusiveSharedMemory::new(layout.get_memory_size().unwrap()).unwrap();
518-
// let mem_size = eshm.mem_size();
519-
// layout
520-
// .write(
521-
// &mut eshm,
522-
// SandboxMemoryLayout::BASE_ADDRESS,
523-
// mem_size,
524-
// false,
525-
// )
526-
// .unwrap();
527-
// let emgr = SandboxMemoryManager::new(
528-
// layout,
529-
// eshm,
530-
// false,
531-
// RawPtr::from(0),
532-
// Offset::from(0),
533-
// #[cfg(target_os = "windows")]
534-
// None,
535-
// );
536-
// let (hmgr, _) = emgr.build();
537-
// assert_eq!(None, hmgr.get_host_error().unwrap());
538-
// }
539-
//
540-
// /// write a host error to shared memory, then try to read it back out
541-
// #[test]
542-
// fn round_trip_host_error() {
543-
// let cfg = SandboxConfiguration::default();
544-
// let layout = SandboxMemoryLayout::new(cfg, 0x10_000, 0x10_000, 0x10_000, 0x10_000).unwrap();
545-
// let mem_size = layout.get_memory_size().unwrap();
546-
// // write a host error and then try to read it back
547-
// let mut eshm = ExclusiveSharedMemory::new(mem_size).unwrap();
548-
// layout
549-
// .write(
550-
// &mut eshm,
551-
// SandboxMemoryLayout::BASE_ADDRESS,
552-
// mem_size,
553-
// false,
554-
// )
555-
// .unwrap();
556-
// let emgr = SandboxMemoryManager::new(
557-
// layout,
558-
// eshm,
559-
// false,
560-
// RawPtr::from(0),
561-
// Offset::from(0),
562-
// #[cfg(target_os = "windows")]
563-
// None,
564-
// );
565-
// let (mut hmgr, _) = emgr.build();
566-
// let err = HyperlightHostError {
567-
// message: "test message".to_string(),
568-
// source: "rust test".to_string(),
569-
// };
570-
// let err_json_bytes = {
571-
// let str = to_string(&err).unwrap();
572-
// str.into_bytes()
573-
// };
574-
// let err_json_msg = "test error message".to_string().into_bytes();
575-
// hmgr.write_outb_error(&err_json_msg, &err_json_bytes)
576-
// .unwrap();
577-
//
578-
// let host_err_opt = hmgr
579-
// .get_host_error()
580-
// .expect("get_host_err should return an Ok");
581-
// assert!(host_err_opt.is_some());
582-
// assert_eq!(err, host_err_opt.unwrap());
583-
// }
584-
// }

src/hyperlight_host/src/mem/ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::Result;
2727
///
2828
/// Use this type to distinguish between an offset and a raw pointer
2929
#[derive(Debug, Clone, Eq, PartialEq)]
30-
// TODO(danbugs:297): we should probably rethink these APIs.
30+
// TODO(see #429): we should probably rethink these APIs.
3131
pub struct RawPtr(pub u64);
3232

3333
impl From<u64> for RawPtr {

src/hyperlight_host/src/mem/shared_mem.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ pub trait SharedMemory {
688688
/// Return a readonly reference to the host mapping backing this SharedMemory
689689
fn region(&self) -> &HostMapping;
690690

691-
// TODO(danbugs:297) consider how the three functions below fit into the bigger
691+
// TODO(see #430) consider how the three functions below fit into the bigger
692692
// picture w/ implementors of this trait having similar fxns.
693693
/// Return data as mut slice
694694
fn as_mut_slice(&mut self) -> &mut [u8] {

0 commit comments

Comments
 (0)