Skip to content

Commit

Permalink
Migrate unit tests to jenkins (gramineproject#122)
Browse files Browse the repository at this point in the history
* Migrate running unit tests for Linux host to Jenkins.  Add a unit test for the Linux host, Debug build

* Ignore files generated as part of unit testsing.

* A quick and dirty fix for port collisions during CI tests.  Come back and do a better job if we continue having problems

* For some reason, the PAL Process regression tests fail using the default manifest under a debug build.  Go ahead and explicate a template for the Process test.
  • Loading branch information
donporter authored Dec 3, 2017
1 parent 1ccac87 commit ce49dcb
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 14 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ before_script:

script:
- 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
- cd $TRAVIS_BUILD_DIR/Pal/src && make clean && make SGX=1
- cd $TRAVIS_BUILD_DIR/Pal/src && make clean && make DEBUG=1
- cd $TRAVIS_BUILD_DIR/Pal/src && make clean && make SGX=1 DEBUG=1
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfiles/Jenkinsfile → Jenkinsfiles/Linux
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline {
stage('Build') {
steps {
sh '''
make
make clean && make
'''
}
}
Expand Down
70 changes: 70 additions & 0 deletions Jenkinsfiles/Linux-Debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
pipeline {
agent any
stages {
stage('Build') {
steps {
sh '''
make clean && make DEBUG=1
'''
}
}
stage('Test') {
steps {
sh '''
cd LibOS/shim/test/apps/gcc
make regression
'''
sh '''
cd LibOS/shim/test/apps/lmbench
make regression
'''
sh '''
cd LibOS/shim/test/apps/python
make regression
'''
sh '''
cd LibOS/shim/test/apps/lighttpd
make
make start-graphene-server &
./benchmark-http.sh 127.0.0.1:8000
'''
sh '''
cd LibOS/shim/test/apps/apache
make
make start-graphene-server &
./benchmark-http.sh 127.0.0.1:8000
'''
sh '''
cd Pal/regression
make regression
'''
sh '''
cd LibOS/shim/test/regression
make regression
'''
sh '''
cd LibOS/shim/test/apps/ltp
make
./syscalls.sh
'''
}
}
stage('Deploy') {
steps {
sh 'echo Deploying code'
}
}
}
post {
success {
echo 'Deployment successful'
}
failure {
echo 'Failure while on the pipeline'
}
unstable {
echo 'Pipeline marked as "unstable"'
}
}
}

3 changes: 3 additions & 0 deletions LibOS/shim/test/apps/gcc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bzip2
gzip
hello
6 changes: 6 additions & 0 deletions LibOS/shim/test/apps/lighttpd/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
ab.*
result-*
OUTPUT
build
html
lighttpd-*
lighttpd.conf

1 change: 1 addition & 0 deletions LibOS/shim/test/apps/lmbench/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lmbench-2.5/bin
1 change: 1 addition & 0 deletions LibOS/shim/test/apps/python/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.pyc
benchmarks
12 changes: 2 additions & 10 deletions LibOS/shim/test/apps/python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $(PYTHON_SRC)/configure: $(PYTHON_SRC).tgz
benchmarks: benchmarks.tar.gz
tar -xzf $<

regression:
regression:
@echo "\n\nBuilding Python..."
@$(MAKE) >> /dev/null 2>&1

Expand All @@ -40,15 +40,7 @@ regression:
-grep -q "fib2 55" OUTPUT
@rm -f OUTPUT

@echo "\n\nRun a HTTP server in the background"
python scripts/dummy-web-server.py 8000 & echo $$! > server.PID
sleep 1
@echo "\n\nRun test-http.py:"
-./python.manifest scripts/test-http.py 127.0.0.1 8000 > OUTPUT1
-wget -q http://127.0.0.1:8000/ -O OUTPUT2
-diff -q OUTPUT1 OUTPUT2
@kill `cat server.PID`
@rm -f OUTPUT1 OUTPUT2 server.PID
./web-test.sh


BENCHMARK = all,-rietveld,-spitfire,-tornado_http
Expand Down
14 changes: 14 additions & 0 deletions LibOS/shim/test/apps/python/web-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

## We really need to pick a unique ephemeral port; start by just picking pid+1024
PORT=$(($$ + 1024))

echo "\n\nRun a HTTP server in the background on port " + $PORT
python scripts/dummy-web-server.py $PORT & echo $! > server.PID
sleep 1
echo "\n\nRun test-http.py:"
./python.manifest scripts/test-http.py 127.0.0.1 $PORT > OUTPUT1
wget -q http://127.0.0.1:$PORT/ -O OUTPUT2
diff -q OUTPUT1 OUTPUT2
kill `cat server.PID`
rm -f OUTPUT1 OUTPUT2 server.PID
15 changes: 15 additions & 0 deletions Pal/regression/Process.manifest.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# the executable to run
# loader.exec = file:./HelloWorld

# debug type: inline|file
loader.debug_type = inline

# debug as file
# loader.debug_file = <path>

fs.mount.root.uri = file:

# allow to bind on port 8000
net.allow_bind.1 = 127.0.0.1:8000
# allow to connect to port 8000
net.allow_peer.1 = 127.0.0.1:8000

0 comments on commit ce49dcb

Please sign in to comment.