Browse Source

Add a unit test and clearer debug print for issue #39

Don Porter 7 years ago
parent
commit
b3da2aff67

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
 /Runtime/
+*~

+ 9 - 0
Pal/regression/00_Bootstrap.py

@@ -98,3 +98,12 @@ regression.add_check(name="Bootstrap without Executable but Preload Libraries",
                       "Binary 2 Preloaded" in res[0].log)
 
 regression.run_checks()
+
+# Running Bootstrap6.manifest
+regression = Regression(loader, manifest_file("Bootstrap6"), timeout = 100000)
+
+regression.add_check(name="8GB Enclave Creation (SGX Only)",
+    check=lambda res: "Loaded Manifest: file:Bootstrap6.manifest.sgx" in res[0].log and
+                      "Executable Range OK" in res[0].log)
+
+regression.run_checks()

+ 7 - 0
Pal/regression/Bootstrap6.manifest.template

@@ -0,0 +1,7 @@
+loader.exec = file:./Bootstrap
+loader.debug_type = inline
+loader.preload = file:Preload1.so,file:Preload2.so
+
+fs.mount.root.uri = file:
+
+sgx.enclave_size = 8192M

+ 1 - 1
Pal/src/host/Linux-SGX/sgx_framework.c

@@ -191,7 +191,7 @@ int create_enclave(sgx_arch_secs_t * secs,
 
     SGX_DBG(DBG_I, "enclave created:\n");
     SGX_DBG(DBG_I, "    base:         0x%016lx\n", secs->baseaddr);
-    SGX_DBG(DBG_I, "    size:         0x%x\n",     secs->size);
+    SGX_DBG(DBG_I, "    size:         0x%016lx\n", secs->size);
     SGX_DBG(DBG_I, "    attr:         0x%016lx\n", secs->attributes.flags);
     SGX_DBG(DBG_I, "    xfrm:         0x%016lx\n", secs->attributes.xfrm);
     SGX_DBG(DBG_I, "    ssaframesize: %ld\n",      secs->ssaframesize);

+ 3 - 0
Scripts/regression.py

@@ -36,6 +36,7 @@ class Regression:
 
             run_times = 0
             outputs = []
+            timed_out = False
             while run_times < needed_times:
                 args = []
                 if self.loader:
@@ -64,6 +65,7 @@ class Regression:
                     sleep_time += 1
 
                 if not finish and p.poll() is None:
+                    timed_out = True
                     p.kill()
 
                 time.sleep(0.1)
@@ -82,6 +84,7 @@ class Regression:
                             print '\033[92m[Success]\033[0m', name
                         else:
                             print '\033[93m[Fail   ]\033[0m', name
+                            if timed_out : print 'Test timed out!'
                             keep_log = True
 
                 if self.keep_log and keep_log: