Browse Source

add Graphene-SGX building and non-SGX regression tests into .travis.yml

Chia-Che Tsai 6 years ago
parent
commit
580e465b39

+ 18 - 1
.travis.yml

@@ -1,7 +1,24 @@
 language: c
-script: make && make install
+
+before_install:
+  - sudo apt-get install python-protobuf python-crypto
+  - sudo apt-get install linux-headers-$(uname -r)
+
+before_script:
+  - git clone https://github.com/01org/linux-sgx-driver.git -b sgx_driver_$ISGX_DRIVER_VERSION
+
+script:
+  - make
+  - cd $TRAVIS_BUILD_DIR/Pal/src && make clean && make SGX=1
+  - cd $TRAVIS_BUILD_DIR/Pal/src/host/Linux-SGX/sgx-driver && make
+  - cd $TRAVIS_BUILD_DIR/Pal/regression && make regression
+  - cd $TRAVIS_BUILD_DIR/LibOS/shim/test/regression && make regression
+  - cd $TRAVIS_BUILD_DIR/LibOS/shim/test/apps/ltp && make regression
 
 matrix:
   include:
     - os: linux
       dist: trusty
+      env:
+        - ISGX_DRIVER_PATH=$TRAVIS_BUILD_DIR/linux-sgx-driver
+        - ISGX_DRIVER_VERSION=1.9

+ 4 - 1
LibOS/shim/test/apps/gcc/Makefile

@@ -90,7 +90,10 @@ obj/lib/$(MPC_OBJ): src/$(MPC_SRC)
 src/$(MPC_SRC): $(MPC_SRC).tar.gz src
 	cd src && tar -xzf ../$<
 
-regression: all
+regression:
+	@echo "\n\nBuilding GCC..."
+	@$(MAKE) >> /dev/null 2>&1
+
 	@echo "\n\nCompile hello.c:"
 	./gcc.manifest test_files/helloworld.c -o hello
 	@chmod 755 hello

+ 4 - 1
LibOS/shim/test/apps/ltp/Makefile

@@ -40,7 +40,10 @@ $(TESTCASEDIR)/manifest.template: manifest.template
 $(TESTCASEDIR)/Makefile: Makefile.testcases
 	ln -sf ../../../../$< $@
 
-regression: $(target)
+regression:
+	@echo "\n\nBuilding LTP..."
+	@$(MAKE) >> /dev/null 2>&1
+
 	@echo "\n\nLTP tests for system calls:"
 	./syscalls.sh
 

+ 14 - 1
Pal/ipc/linux/graphene-ipc.c

@@ -189,7 +189,11 @@ static inline void release_gipc_queue(struct gipc_queue *gq, bool locked)
 	while (gq->next != gq->last) {
 		idx = gq->next;
 		if (gq->pages[idx].page) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+			put_page(gq->pages[idx].page);
+#else
 			page_cache_release(gq->pages[idx].page);
+#endif
 			gq->pages[idx].page = NULL;
 		}
 		if (gq->pages[idx].file) {
@@ -353,10 +357,15 @@ static int get_pages (struct task_struct *task, unsigned long start,
 			DEBUG("GIPC_SEND get_user_pages %ld pages at %lx\n",
 			      addr, nr);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+			rv = get_user_pages(addr, nr,
+					    FOLL_GET|FOLL_FORCE|FOLL_SPLIT,
+					    pages + last, vmas + last);
+#else
 			rv = __get_user_pages(task, mm, addr, nr,
 					      FOLL_GET|FOLL_FORCE|FOLL_SPLIT,
 					      pages + last, vmas + last, NULL);
-
+#endif
 			if (rv <= 0) {
 				printk(KERN_ERR "Graphene error: "
 				       "get_user_pages at 0x%016lx-0x%016lx\n",
@@ -702,7 +711,11 @@ static int do_gipc_recv(struct task_struct *task, struct gipc_queue *gq,
 finish:
 		/* Drop the kernel's reference to this page */
 		if (page)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+			put_page(page);
+#else
 			page_cache_release(page);
+#endif
 		if (file)
 			fput_atomic(file);
 		if (rv)

+ 10 - 2
Pal/src/host/Linux-SGX/sgx-driver/link-intel-driver.py

@@ -2,6 +2,10 @@
 
 import sys, os, re
 
+
+isgx_path    = os.getenv("ISGX_DRIVER_PATH")
+isgx_version = os.getenv("ISGX_DRIVER_VERSION")
+
 try:
     # get the locations of directories
     print "\n" + \
@@ -12,17 +16,20 @@ try:
           "\n"
 
     while True:
-        isgx_path = raw_input('Enter the Intel SGX driver derctory: ')
+        if not isgx_path:
+            isgx_path = raw_input('Enter the Intel SGX driver derctory: ')
         if os.path.exists(isgx_path + '/sgx.h'):
             break
         if os.path.exists(isgx_path + '/isgx.h'):
             break
         print '{0} is not a directory for the Intel SGX driver'.format(isgx_path)
+        isgx_path = None
 
 
     # get the driver version
     while True:
-        isgx_version = raw_input('Enter the driver version (default: 1.8): ')
+        if not isgx_version:
+            isgx_version = raw_input('Enter the driver version (default: 1.8): ')
         if not isgx_version:
             isgx_version_major = 1
             isgx_version_minor = 8
@@ -33,6 +40,7 @@ try:
             isgx_version_minor = m.group(2)
             break
         print '{0} is not a valid version (x.xx)'.format(isgx_version)
+        isgx_version = None
 
 
     # create a symbolic link called 'linux-sgx-driver'