-
-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lan Xia <Lan_Xia@ca.ibm.com>
- Loading branch information
Showing
4 changed files
with
273 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0"?> | ||
<project name="criu-portable-checkpoint" default="build" basedir="."> | ||
<taskdef resource="net/sf/antcontrib/antlib.xml" /> | ||
<description> | ||
CRIU PingPerf | ||
</description> | ||
<import file="${TEST_ROOT}/external/build.xml"/> | ||
|
||
<!-- set properties for this build --> | ||
<property name="TEST" value="criu" /> | ||
<property name="DEST" value="${BUILD_ROOT}/external/${TEST}" /> | ||
<property name="src" location="." /> | ||
|
||
<target name="init"> | ||
<mkdir dir="${DEST}"/> | ||
</target> | ||
|
||
<target name="dist" description="generate the distribution"> | ||
<copy todir="${DEST}"> | ||
<fileset dir="${src}" includes="*.xml, *.mk, *.sh"/> | ||
</copy> | ||
</target> | ||
|
||
<target name="build"> | ||
<antcall target="dist" inheritall="true" /> | ||
</target> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -e | ||
|
||
pingPerfZipPath="" | ||
|
||
prepare() { | ||
echo "prepare at $(pwd)..." | ||
if [ -f "$pingPerfZipPath" ]; then | ||
rm -f PingperfFiles.zip | ||
cp "$pingPerfZipPath" . | ||
unzip PingperfFiles.zip | ||
else | ||
echo "${pingPerfZipPath} does not exist." | ||
exit 1 | ||
fi | ||
|
||
curl -OLJSks https://github.com/eclipse-openj9/openj9/files/8774222/criuseccompprofile.json.txt | ||
mv criuseccompprofile.json.txt criuseccompprofile.json | ||
git clone https://github.com/OpenLiberty/ci.docker.git | ||
( | ||
cd ci.docker || exit | ||
git checkout instanton | ||
) | ||
} | ||
|
||
buildImage() { | ||
echo "build image at $(pwd)..." | ||
sudo podman build -t icr.io/appcafe/open-liberty:beta-instanton -f ci.docker/releases/latest/beta-instanton/Dockerfile.ubi.openjdk17 ci.docker/releases/latest/beta-instanton | ||
sudo podman build -t ol-instanton-test-pingperf:latest -f Dockerfile.pingperf . | ||
} | ||
|
||
createRestoreImage() { | ||
echo "create restore image ..." | ||
sudo podman run --name ol-instanton-test-checkpoint-container --privileged --env WLP_CHECKPOINT=applications ol-instanton-test-pingperf:latest | ||
sudo podman commit ol-instanton-test-checkpoint-container ol-instanton-test-pingperf-restore | ||
sudo podman rm ol-instanton-test-checkpoint-container | ||
} | ||
|
||
unprivilegedRestore() { | ||
echo "unprivileged restore ..." | ||
echo -ne "CONTAINER_ID=" > containerId.log | ||
sudo podman run \ | ||
--rm \ | ||
--detach \ | ||
-p 9080:9080 \ | ||
--cap-add=CHECKPOINT_RESTORE \ | ||
--cap-add=NET_ADMIN \ | ||
--cap-add=SYS_PTRACE \ | ||
--security-opt seccomp=criuseccompprofile.json \ | ||
ol-instanton-test-pingperf-restore >> containerId.log | ||
} | ||
|
||
privilegedRestore() { | ||
echo "privileged restore ..." | ||
echo -ne "CONTAINER_ID=" > containerId.log | ||
sudo podman run \ | ||
--rm \ | ||
--detach \ | ||
--privileged \ | ||
-p 9080:9080 \ | ||
ol-instanton-test-pingperf-restore >> containerId.log | ||
} | ||
|
||
response() { | ||
echo "response ..." | ||
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://127.0.0.1:9080/pingperf/ping/greeting)" != "200" ]]; do sleep .00001; done' | ||
} | ||
|
||
checkLog() { | ||
echo "check log ..." | ||
if [ -f ./containerId.log ]; then | ||
cat ./containerId.log | ||
else | ||
echo "./containerId.log does not exist." | ||
exit 1 | ||
fi | ||
sleep 1 | ||
source ./containerId.log | ||
echo "podman logs --tail 10 ${CONTAINER_ID}" | ||
sudo podman logs --tail 10 "${CONTAINER_ID}" | ||
echo "find response ..." | ||
sudo podman logs --tail 10 "${CONTAINER_ID}" | grep "FR " | ||
} | ||
|
||
clean() { | ||
echo "clean ..." | ||
sudo podman stop --all | ||
sudo podman container rm --all -f | ||
} | ||
|
||
testCreateRestoreImageOnly() { | ||
clean | ||
prepare | ||
buildImage | ||
createRestoreImage | ||
} | ||
|
||
testUnprivilegedRestoreOnly() { | ||
unprivilegedRestore | ||
response | ||
checkLog | ||
} | ||
|
||
testPrivilegedRestoreOnly() { | ||
privilegedRestore | ||
response | ||
checkLog | ||
} | ||
|
||
testCreateImageAndUnprivilegedRestore() { | ||
testCreateRestoreImageOnly | ||
testUnprivilegedRestoreOnly | ||
} | ||
|
||
testCreateImageAndPrivilegedRestore() { | ||
testCreateRestoreImageOnly | ||
testPrivilegedRestoreOnly | ||
} | ||
|
||
if [ "$1" == "prepare" ]; then | ||
pingPerfZipPath=$2 | ||
prepare | ||
elif [ "$1" == "buildImage" ]; then | ||
buildImage | ||
elif [ "$1" == "createRestoreImage" ]; then | ||
createRestoreImage | ||
elif [ "$1" == "unprivilegedRestore" ]; then | ||
unprivilegedRestore | ||
elif [ "$1" == "privilegedRestore" ]; then | ||
privilegedRestore | ||
elif [ "$1" == "response" ]; then | ||
response | ||
elif [ "$1" == "checkLog" ]; then | ||
checkLog | ||
elif [ "$1" == "clean" ]; then | ||
clean | ||
elif [ "$1" == "testCreateRestoreImageOnly" ]; then | ||
pingPerfZipPath=$2 | ||
testCreateRestoreImageOnly | ||
elif [ "$1" == "testUnprivilegedRestoreOnly" ]; then | ||
testUnprivilegedRestoreOnly | ||
elif [ "$1" == "testPrivilegedRestoreOnly" ]; then | ||
testPrivilegedRestoreOnly | ||
elif [ "$1" == "testCreateImageAndUnprivilegedRestore" ]; then | ||
pingPerfZipPath=$2 | ||
testCreateImageAndUnprivilegedRestore | ||
elif [ "$1" == "testCreateImageAndPrivilegedRestore" ]; then | ||
pingPerfZipPath=$2 | ||
testCreateImageAndPrivilegedRestore | ||
else | ||
echo "unknown command" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<!-- | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
--> | ||
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../TKG/playlist.xsd"> | ||
<test> | ||
<testCaseName>criu_pingPerf_testCreateImageAndUnprivilegedRestore</testCaseName> | ||
<command>$(TEST_ROOT)/external/criu/pingPerf.sh testCreateImageAndUnprivilegedRestore $(TEST_ROOT)/external/criu/upload/PingperfFiles.zip; \ | ||
$(TEST_STATUS); \ | ||
$(TEST_ROOT)/external/criu/pingPerf.sh clean | ||
</command> | ||
<features> | ||
<feature>CRIU:required</feature> | ||
</features> | ||
<levels> | ||
<level>dev</level> | ||
</levels> | ||
<groups> | ||
<group>external</group> | ||
</groups> | ||
</test> | ||
<test> | ||
<testCaseName>criu_pingPerf_testCreateImageAndPrivilegedRestore</testCaseName> | ||
<command>$(TEST_ROOT)/external/criu/pingPerf.sh testCreateImageAndPrivilegedRestore $(TEST_ROOT)/external/criu/upload/PingperfFiles.zip; \ | ||
$(TEST_STATUS); \ | ||
$(TEST_ROOT)/external/criu/pingPerf.sh clean | ||
</command> | ||
<features> | ||
<feature>CRIU:required</feature> | ||
</features> | ||
<levels> | ||
<level>dev</level> | ||
</levels> | ||
<groups> | ||
<group>external</group> | ||
</groups> | ||
</test> | ||
<test> | ||
<testCaseName>criu_pingPerf_testCreateRestoreImageOnly</testCaseName> | ||
<disables> | ||
<disable> | ||
<comment>runtimes_backlog_issues_879</comment> | ||
</disable> | ||
</disables> | ||
<command>$(TEST_ROOT)/external/criu/pingPerf.sh testCreateRestoreImageOnly $(TEST_ROOT)/external/criu/upload/PingperfFiles.zip; \ | ||
$(TEST_STATUS); \ | ||
$(TEST_ROOT)/external/criu/pingPerf.sh clean | ||
</command> | ||
<features> | ||
<feature>CRIU:required</feature> | ||
</features> | ||
<levels> | ||
<level>dev</level> | ||
</levels> | ||
<groups> | ||
<group>external</group> | ||
</groups> | ||
</test> | ||
</playlist> |