[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:
Dmitrii Kuvaiskii
2019-12-18 02:59:02 -08:00
parent 05cc50945f
commit b8a955c826
3 changed files with 51 additions and 0 deletions
+31
View File
@@ -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
+4
View File
@@ -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")