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

[CI] LTP: Add MAP_PRIVATE patch to LTP sources and enable LTP in SGX CI #2187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 3 additions & 2 deletions LibOS/shim/test/ltp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/build/
/install/
/build*/
/install*/
/ltp*.xml
/pal_loader
/PATCH_APPLIED
24 changes: 20 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 @@ -66,9 +82,9 @@ ltp-sgx.xml: CFG = ltp.cfg ltp-sgx.cfg ltp-bug-1075.cfg

%.xml: $(CFG) $(target) $(INSTALLDIR)/INSTALL_SUCCESS
./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