Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
[CI, LTP] Add MAP_PRIVATE patch to LTP sources and enable LTP in SGX CI
Browse files Browse the repository at this point in the history
Signed-off-by: Jinen Gandhi <[email protected]>
  • Loading branch information
jinengandhi-intel committed Mar 24, 2021
1 parent 0824a0c commit 7d62b94
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 636 deletions.
12 changes: 12 additions & 0 deletions .ci/lib/stage-test-sgx.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
stage('test-sgx') {
timeout(time: 45, unit: 'MINUTES') {
try {
sh '''
cd LibOS/shim/test/ltp
make ${MAKEOPTS} all sgx-tokens
make ltp-sgx.xml
'''
} finally {
archiveArtifacts 'LibOS/shim/test/ltp/ltp-sgx.xml'
junit 'LibOS/shim/test/ltp/ltp-sgx.xml'
}
}
timeout(time: 5, unit: 'MINUTES') {
sh '''
cd Examples/python-simple
Expand Down
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "LibOS/shim/test/ltp/src"]
path = LibOS/shim/test/ltp/src
url = https://github.com/linux-test-project/ltp.git
ignore = dirty
1 change: 1 addition & 0 deletions LibOS/shim/test/ltp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/install/
/ltp*.xml
/pal_loader
/PATCH_APPLIED
25 changes: 21 additions & 4 deletions LibOS/shim/test/ltp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,24 @@ $(SRCDIR)/Makefile:
$(SRCDIR)/configure: $(SRCDIR)/Makefile
$(MAKE) -C $(SRCDIR) autotools

.SECONDARY: $(ROOTDIR)/PATCH_APPLIED
$(ROOTDIR)/PATCH_APPLIED:
# To run LTP tests with SGX (which doesn't support shared memory mappings),
# as a workaround we change the mmap flag from MAP_SHARED to MAP_PRIVATE
# (unintuitively, the LTP framework still works correctly with this change)
# No such change is intended for LTP tests with non-SGX.
$(eval export patch-status = $(shell patch -p1 -l -N -s --dry-run < ltp_sgx_mmap_fix.patch 1>&2 2> /dev/null; echo $$?))
@if [ $(SGX) = 1 -a $(patch-status) = 0 ] ; then \
patch -p1 -l < ltp_sgx_mmap_fix.patch; \
touch $@; \
else \
if [ $(SGX) = 0 -a $(patch-status) = 1 ]; then \
patch -R -s -f -i ltp_sgx_mmap_fix.patch src/lib/tst_test.c; \
fi; \
fi

.SECONDARY: $(BUILDDIR)/BUILD_SUCCESS
$(BUILDDIR)/BUILD_SUCCESS: $(SRCDIR)/configure
$(BUILDDIR)/BUILD_SUCCESS: $(SRCDIR)/configure $(ROOTDIR)/PATCH_APPLIED
# Out-of-tree build steps were taken from ltp/INSTALL.
# The instructions below assume that SRCDIR and BUILDDIR are absolute.
mkdir -p $(BUILDDIR)
Expand Down Expand Up @@ -53,7 +69,7 @@ sgx-tokens: build-manifest

.PHONY: regression
regression:
ifeq ($(SGX),"1")
ifeq ($(SGX),1)
$(RM) ltp-sgx.xml
$(MAKE) ltp-sgx.xml
else
Expand All @@ -65,10 +81,11 @@ ltp.xml: CFG = ltp.cfg
ltp-sgx.xml: CFG = ltp.cfg ltp-sgx.cfg ltp-bug-1075.cfg

%.xml: $(CFG) $(target) $(INSTALLDIR)/INSTALL_SUCCESS
# LTPSCENARIO := $(INSTALLDIR)/$(LTPSCENARIO)
./contrib/conf_lint.py $(CFG) --scenario $(LTPSCENARIO)
./runltp_xml.py $(RUNLTPOPTS) $(foreach cfg,$(CFG),-c $(cfg)) $(LTPSCENARIO) -O $@
./runltp_xml.py $(RUNLTPOPTS) $(foreach cfg,$(CFG),-c $(cfg)) $(LTPSCENARIO) -o ltproot=$(LTPROOT) -O $@

.PHONY: clean-build
clean-build:
$(MAKE) -C $(SRCDIR) clean
$(RM) -r $(BUILDDIR) $(INSTALLDIR) ltp*.xml
$(RM) -r build* install* ltp*.xml PATCH_APPLIED
Loading

0 comments on commit 7d62b94

Please sign in to comment.