in enclave_build/src/yaml_generator.rs [172:240]
fn test_ramfs() {
let yaml_generator = YamlGenerator::new(
String::from("docker_image"),
String::from("path_to_init"),
String::from("path_to_nsm"),
String::from("path_to_cmd"),
String::from("path_to_env"),
);
let mut bootstrap_data = String::new();
let bootstrap_ramfs = yaml_generator.get_bootstrap_ramfs().unwrap();
let mut bootstrap_ramfs = File::open(bootstrap_ramfs.path()).unwrap();
bootstrap_ramfs.read_to_string(&mut bootstrap_data).unwrap();
assert_eq!(
bootstrap_data,
"---\
\nfiles:\
\n - path: dev\
\n directory: true\
\n mode: \"0755\"\
\n - path: init\
\n source: path_to_init\
\n mode: \"0755\"\
\n - path: nsm.ko\
\n source: path_to_nsm\
\n mode: \"0755\"\
\n\
"
);
let mut customer_data = String::new();
let customer_ramfs = yaml_generator.get_customer_ramfs().unwrap();
let mut customer_ramfs = File::open(customer_ramfs.path()).unwrap();
customer_ramfs.read_to_string(&mut customer_data).unwrap();
assert_eq!(
customer_data,
"---\
\nprefix: rootfs/\
\ninit:\
\n - docker_image\
\nfiles:\
\n - path: rootfs/dev\
\n directory: true\
\n mode: \"0755\"\
\n - path: rootfs/run\
\n directory: true\
\n mode: \"0755\"\
\n - path: rootfs/sys\
\n directory: true\
\n mode: \"0755\"\
\n - path: rootfs/var\
\n directory: true\
\n mode: \"0755\"\
\n - path: rootfs/proc\
\n directory: true\
\n mode: \"0755\"\
\n - path: rootfs/tmp\
\n directory: true\
\n mode: \"0755\"\
\n - path: cmd\
\n source: path_to_cmd\
\n mode: \"0644\"\
\n - path: env\
\n source: path_to_env\
\n mode: \"0644\"\
\n\
"
);
}