mirror of
https://github.com/clearlinux/graphene.git
synced 2026-10-04 16:08:22 +00:00
[LibOS/regression] Add test for host root FS
Graphene supports a special "root FS" parameter in the manifest: "fs.root". This commit adds a test that uses this parameter.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int showdir(char* path) {
|
||||
struct dirent* de;
|
||||
|
||||
DIR* dir = opendir(path);
|
||||
if (!dir) {
|
||||
printf("Could not open directory `%s`\n", path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Contents of directory `%s`:\n", path);
|
||||
while ((de = readdir(dir)))
|
||||
printf(" %s\n", de->d_name);
|
||||
printf("\n");
|
||||
|
||||
closedir(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (showdir("/"))
|
||||
return 1;
|
||||
|
||||
if (showdir("/var/"))
|
||||
return 1;
|
||||
|
||||
puts("Test was successful");
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
loader.preload = file:../../src/libsysdb.so
|
||||
loader.env.LD_LIBRARY_PATH = /lib
|
||||
loader.debug_type = none
|
||||
loader.syscall_symbol = syscalldb
|
||||
|
||||
fs.root.type = chroot
|
||||
fs.root.path = /
|
||||
fs.root.uri = file:/
|
||||
|
||||
fs.mount.graphene_lib.type = chroot
|
||||
fs.mount.graphene_lib.path = /lib
|
||||
fs.mount.graphene_lib.uri = file:../../../../Runtime
|
||||
|
||||
sgx.trusted_files.ld = file:../../../../Runtime/ld-linux-x86-64.so.2
|
||||
sgx.trusted_files.libc = file:../../../../Runtime/libc.so.6
|
||||
sgx.trusted_files.libdl = file:../../../../Runtime/libdl.so.2
|
||||
@@ -251,6 +251,10 @@ class TC_30_Syscall(RegressionTestCase):
|
||||
|
||||
self.assertIn('Success!', stdout)
|
||||
|
||||
def test_022_host_root_fs(self):
|
||||
stdout, _ = self.run_binary(['host_root_fs'])
|
||||
self.assertIn('Test was successful', stdout)
|
||||
|
||||
def test_030_fopen(self):
|
||||
if os.path.exists("tmp/filecreatedbygraphene"):
|
||||
os.remove("tmp/filecreatedbygraphene")
|
||||
|
||||
Reference in New Issue
Block a user