Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meson LTP changes #71

Merged
merged 2 commits into from
Jan 12, 2022
Merged
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
2 changes: 1 addition & 1 deletion ci/linux-direct-ubuntu20.04-gcc-release.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ node(node_label) {
try {
stage('checkout'){
dir ('./') {
git url: 'https://github.com/jinengandhi-intel/graphene_local_ci.git'
git url: 'https://github.com/jinengandhi-intel/graphene_local_ci.git'
}

dir ("gramine") {
Expand Down
14 changes: 10 additions & 4 deletions ci/stage-test-direct.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ stage('test-direct') {
timeout(time: 30, unit: 'MINUTES') {
sh '''
cd LibOS/shim/test/ltp
make ${MAKEOPTS} -f Makefile.LTP all LTPCFG=$CFG LTPTESTFILE=$PWD$LTPSCENARIO
make -f Makefile.LTP ltp_results_1.xml LTPCFG=$CFG LTPTESTFILE=$PWD$LTPSCENARIO
cp -f toml_files/tests_direct.toml tests.toml
make ${MAKEOPTS} -f Makefile.LTP all
'''
// Run tests in a separate block, so that Jenkins measures build time and run time
// separately
sh '''
cd LibOS/shim/test/ltp
python3 -m pytest -v -n4 --junit-xml=ltp.xml
'''
/*
sh '''
cd LibOS/shim/test/ltp
Expand All @@ -20,8 +26,8 @@ stage('test-direct') {
env.build_ok = false
sh 'echo "LTP Test Failed"'
} finally {
archiveArtifacts 'LibOS/shim/test/ltp/ltp_results_*.xml'
junit 'LibOS/shim/test/ltp/ltp_results_*.xml'
archiveArtifacts 'LibOS/shim/test/ltp/ltp.xml'
junit 'LibOS/shim/test/ltp/ltp.xml'
}

try{
Expand Down
16 changes: 10 additions & 6 deletions ci/stage-test-sgx.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ stage('test-sgx') {
timeout(time: 60, unit: 'MINUTES') {
sh '''
cd LibOS/shim/test/ltp
make ${MAKEOPTS} -f Makefile.LTP SGX=1 all LTPCFG="$CFG" LTPTESTFILE=$PWD$LTPSCENARIO
bash update_manifest.sh
make ${MAKEOPTS} -f Makefile.LTP SGX=1 sgx-tokens LTPCFG="$CFG" LTPTESTFILE=$PWD$LTPSCENARIO
make -f Makefile.LTP ltp-sgx_results_1.xml SGX=1 LTPCFG="$CFG" LTPTESTFILE=$PWD$LTPSCENARIO
cp -f toml_files/tests_sgx.toml tests.toml
make ${MAKEOPTS} -f Makefile.LTP SGX=1 all
'''
// Run tests in a separate block, so that Jenkins measures build time and run time
// separately
sh '''
cd LibOS/shim/test/ltp
python3 -m pytest -v --junit-xml=ltp-sgx.xml
'''
/*
sh '''
cd LibOS/shim/test/ltp
Expand All @@ -23,8 +27,8 @@ stage('test-sgx') {
env.build_ok = false
sh 'echo "LTP Test Failed"'
} finally {
archiveArtifacts 'LibOS/shim/test/ltp/ltp-sgx_results_*.xml'
junit 'LibOS/shim/test/ltp/ltp-sgx_results_*.xml'
archiveArtifacts 'LibOS/shim/test/ltp/ltp-sgx.xml'
junit 'LibOS/shim/test/ltp/ltp-sgx.xml'
}
}

Expand Down
1 change: 1 addition & 0 deletions ci/ubuntu18.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3-protobuf \
python3-pyelftools \
python3-pytest \
python3-pytest-xdist \
python3-scipy \
sqlite3 \
shellcheck \
Expand Down
1 change: 1 addition & 0 deletions ci/ubuntu20.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3-protobuf \
python3-pyelftools \
python3-pytest \
python3-pytest-xdist \
python3-recommonmark \
python3-scipy \
python3-sphinx-rtd-theme \
Expand Down
1 change: 1 addition & 0 deletions ci/ubuntu21.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3-protobuf \
python3-pyelftools \
python3-pytest \
python3-pytest-xdist \
python3-recommonmark \
python3-scipy \
python3-sphinx-rtd-theme \
Expand Down
75 changes: 34 additions & 41 deletions ltp_config/Makefile.LTP
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
include makevars.mk
ROOTDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

target = $(INSTALLDIR)/INSTALL_SUCCESS build-manifest
exec_target =

clean-extra += clean-build
BUILDDIR = $(ROOTDIR)/build
INSTALLDIR = $(ROOTDIR)/install
TESTCASEDIR = $(INSTALLDIR)/testcases/bin
LTP_SCENARIO = "install/runtest/syscalls-new"
SRCDIR = $(ROOTDIR)/ltp_src
clean-extra += clean-build
CFG = ltp_tests.cfg
XML_FILE = ltp.xml
ifeq ($(SGX),1)
BUILDDIR:=$(BUILDDIR)-sgx
INSTALLDIR:=$(INSTALLDIR)-sgx
LTPROOT = install-sgx
else
LTPROOT = install
LTP_SCENARIO = "install-sgx/runtest/syscalls-new"
CFG = ltp_tests.cfg ltp-sgx_tests.cfg ltp-bug-1075_tests.cfg
XML_FILE = ltp-sgx.xml
endif

VERSION = $(shell uname -r)
export VERSION

include ../../../../Scripts/Makefile.rules
include ../../../../Scripts/Makefile.configs
# Make ARCH_LIBDIR visible in Makefile.Test
export ARCH_LIBDIR
include Makefile.Test

ifeq ($(BUILD_VERBOSE),1)
RUNLTPOPTS += -v
endif
.PHONY: all
all: $(INSTALLDIR)/INSTALL_SUCCESS manifests etc/nsswitch.conf etc/passwd

$(SRCDIR)/Makefile:
$(error "$(SRCDIR) is empty. Please run `git submodule update --init $(SRCDIR)` or download the LTP source code (https://github.com/linux-test-project/ltp) into $(SRCDIR).")
Expand Down Expand Up @@ -53,33 +49,30 @@ $(INSTALLDIR)/INSTALL_SUCCESS: $(BUILDDIR)/BUILD_SUCCESS
ln -sf $(abspath Makefile_testcases.LTP) $(TESTCASEDIR)/Makefile
touch $@

.PHONY: build-manifest
build-manifest: $(TESTCASEDIR)/manifest.template $(INSTALLDIR)/INSTALL_SUCCESS
$(MAKE) -C $(TESTCASEDIR)
.PHONY: manifests
manifests: $(INSTALLDIR)/INSTALL_SUCCESS
gramine-test build

$(TESTCASEDIR)/manifest.template: manifest.LTP $(INSTALLDIR)/INSTALL_SUCCESS
sed -e 's|$$(ARCH_LIBDIR)|'"$(ARCH_LIBDIR)"'|g; s|TESTCASEDIR|$(TESTCASEDIR)|g' \
$< > $@
etc/nsswitch.conf:
mkdir -p etc
printf "passwd: compat\ngroup: compat\nshadow: compat\nhosts: files\n" > $@

.PHONY: sgx-tokens
sgx-tokens: build-manifest
$(MAKE) -C $(TESTCASEDIR) $@
etc/passwd:
mkdir -p etc
printf "root:x:0:0:root:/root:/bin/bash\nnobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\n" > $@

.PHONY: regression
regression:
ifeq ($(SGX),1)
$(RM) ltp-sgx.xml
$(MAKE) ltp-sgx.xml
else
$(RM) ltp.xml
$(MAKE) ltp.xml
endif

%.xml: $(LTPCFG) $(target) $(INSTALLDIR)/INSTALL_SUCCESS
./contrib/conf_lint.py $(LTPCFG) --scenario $(LTPTESTFILE)
./runltp_tests.py $(RUNLTPOPTS) $(foreach cfg,$(LTPCFG),-c $(cfg)) $(LTPTESTFILE) -o ltproot=$(LTPROOT) -O $@
regression: manifests
LTP_CONFIG="$(CFG)" LTP_SCENARIO=$(LTP_SCENARIO) python3 -m pytest -v --junit-xml="$(XML_FILE)"

.PHONY: clean-build
clean-build:
.PHONY: clean
clean:
if test -f $(INSTALLDIR)/INSTALL_SUCCESS; then gramine-test clean; fi
$(MAKE) -C $(SRCDIR) clean
$(RM) -r build* install* ltp*.xml
$(RM) -r \
$(BUILDDIR) \
$(INSTALLDIR) \
ltp*.xml \
etc/ \
.pytest_cache \
__pycache__
85 changes: 85 additions & 0 deletions ltp_config/manifest.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
loader.entrypoint = "file:{{ gramine.libos }}"
libos.entrypoint = "{{ entrypoint }}"

loader.env.LD_LIBRARY_PATH = "/lib:{{ arch_libdir }}:/usr/lib:/usr/lib64"
loader.env.PATH = "/bin:/usr/bin:."
loader.env.LD_PRELOAD = "{{ coreutils_libdir }}/libstdbuf.so"
loader.env._STDBUF_O = "L"
loader.insecure__use_cmdline_argv = true

fs.root.type = "chroot"
fs.root.uri = "file:{{ binary_dir }}"

fs.mount.etc.type = "chroot"
fs.mount.etc.path = "etc"
fs.mount.etc.uri = "file:etc"

fs.mount.bin.type = "chroot"
fs.mount.bin.path = "/bin"
fs.mount.bin.uri = "file:/bin"

fs.mount.boot.type = "chroot"
fs.mount.boot.path = "/boot"
fs.mount.boot.uri = "file:/boot"

fs.mount.proc.type = "chroot"
fs.mount.proc.path = "/proc"
fs.mount.proc.uri = "file:/proc"

fs.mount.shm.type = "chroot"
fs.mount.shm.path = "/dev/shm"
fs.mount.shm.uri = "file:/tmp"

fs.mount.lib.type = "chroot"
fs.mount.lib.path = "/lib"
fs.mount.lib.uri = "file:{{ gramine.runtimedir() }}"

fs.mount.lib64.type = "chroot"
fs.mount.lib64.path = "{{ arch_libdir }}"
fs.mount.lib64.uri = "file:{{ arch_libdir }}"

fs.mount.usr.type = "chroot"
fs.mount.usr.path = "/usr"
fs.mount.usr.uri = "file:/usr"

fs.mount.tmp.type = "chroot"
fs.mount.tmp.path = "/tmp"
fs.mount.tmp.uri = "file:/tmp"

fs.experimental__enable_sysfs_topology = true
sys.brk.max_size = "32M"
sys.stack.size = "4M"
sgx.nonpie_binary = true
sgx.debug = true
sgx.thread_num = 13

sgx.allowed_files = [
"file:/tmp",
"file:etc",
"file:{{ gramine.runtimedir() }}",
"file:/bin",
"file:/proc",
"file:{{ gramine.runtimedir() }}/libnss_compat.so.2",
"file:{{ arch_libdir }}/libnss_compat.so.2",
"file:{{ arch_libdir }}/libnss_systemd.so.2",
"file:install-sgx/testcases/bin/pipe2_02_child",
"file:install-sgx/testcases/bin/execvp01_child",
"file:install-sgx/testcases/bin/execv01_child",
"file:install-sgx/testcases/bin/execlp01_child",
"file:install-sgx/testcases/bin/execl01_child",
]

sgx.trusted_files = [
"file:{{ gramine.libos }}",
"file:{{ binary_dir }}/{{ entrypoint }}",
"file:{{ gramine.runtimedir() }}/ld-linux-x86-64.so.2",
"file:{{ gramine.runtimedir() }}/libc.so.6",
"file:{{ gramine.runtimedir() }}/libdl.so.2",
"file:{{ gramine.runtimedir() }}/libm.so.6",
"file:{{ gramine.runtimedir() }}/libpthread.so.0",
"file:{{ gramine.runtimedir() }}/librt.so.1",
"file:{{ coreutils_libdir }}/libstdbuf.so",
"file:{{ gramine.runtimedir() }}/libnss_files.so.2",
"file:{{ arch_libdir }}/libnss_files.so.2",
]

Loading