Skip to content

Commit

Permalink
kernel-containerized-performance-tests: pull container build logic in…
Browse files Browse the repository at this point in the history
…to central script

Pull out common container build logic from each containerized
performance test file into a single file and run it in run-ptest.

Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
  • Loading branch information
gratian authored and chaitu236 committed Dec 29, 2023
1 parent da1ba2b commit 16be6c6
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 86 deletions.
23 changes: 23 additions & 0 deletions recipes-kernel/kernel-tests/files/build-containers
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then
echo "Building cyclictest-container..."
DOCKER_BUILDKIT=1 \
docker build -t cyclictest-container --network=host ./cyclictest-container
if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then
echo "Failed to build cyclictest-container"
exit 77
fi
fi

if [ "$(docker images -q parallel-container:latest)" = "" ]; then
echo "Building parallel-container..."
DOCKER_BUILDKIT=1 \
docker build -t parallel-container --network=host ./parallel-container
if [ "$(docker images -q parallel-container:latest)" = "" ]; then
echo "Failed to build parallel-container"
exit 77
fi
fi

exit 0
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash

./build-containers || exit $?

./test_kernel_cyclictest_idle_containerized.sh
./test_kernel_cyclictest_hackbench_containerized.sh
./test_kernel_cyclictest_fio_containerized.sh
./test_kernel_cyclictest_iperf_containerized.sh

exit 0

Original file line number Diff line number Diff line change
@@ -1,36 +1,14 @@
#!/bin/bash

PTEST_LOCATION=/usr/lib/kernel-containerized-performance-tests/ptest

# Build the two containers
if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then
echo "Building cyclictest-container..."
DOCKER_BUILDKIT=1 \
docker build -t cyclictest-container --network=host ${PTEST_LOCATION}/cyclictest-container
if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then
echo "Failed to build cyclictest-container"
exit 77
fi
fi
if [ "$(docker images -q parallel-container:latest)" = "" ]; then
echo "Building parallel-container..."
DOCKER_BUILDKIT=1 \
docker build -t parallel-container --network=host ${PTEST_LOCATION}/parallel-container
if [ "$(docker images -q parallel-container:latest)" = "" ]; then
echo "Failed to build parallel-container"
exit 77
fi
fi

# Start background disk I/O load
echo "Starting fio load..."
LOAD_CONT=$(docker run -d --privileged -v ${PTEST_LOCATION}:/ptests -t parallel-container \
LOAD_CONT=$(docker run -d --privileged -v ${PWD}:/ptests -t parallel-container \
bash run_fio.sh)

# Run cyclictest
echo "Running cyclictest in docker container..."
RESULT=$(docker run --privileged --network=host \
-v ${LOG_DIR}:${LOG_DIR} -v ${PTEST_LOCATION}:/ptests -v /home/admin:/home/admin \
-v ${LOG_DIR}:${LOG_DIR} -v ${PWD}:/ptests -v /home/admin:/home/admin \
-v /usr/share/fw_printenv:/usr/share/fw_printenv -v /sbin/fw_printenv:/sbin/fw_printenv \
-v /usr/share/nisysinfo:/usr/share/nisysinfo -v /dev:/dev \
-t cyclictest-container \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,14 @@
#!/bin/bash

PTEST_LOCATION=/usr/lib/kernel-containerized-performance-tests/ptest

# Build the two containers
if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then
echo "Building cyclictest-container..."
DOCKER_BUILDKIT=1 \
docker build -t cyclictest-container --network=host ${PTEST_LOCATION}/cyclictest-container
if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then
echo "Failed to build cyclictest-container"
exit 77
fi
fi
if [ "$(docker images -q parallel-container:latest)" = "" ]; then
echo "Building parallel-container..."
DOCKER_BUILDKIT=1 \
docker build -t parallel-container --network=host ${PTEST_LOCATION}/parallel-container
if [ "$(docker images -q parallel-container:latest)" = "" ]; then
echo "Failed to build parallel-container"
exit 77
fi
fi

# Start background scheduler load
echo "Starting hackbench load..."
LOAD_CONT=$(docker run -d --privileged -v ${PTEST_LOCATION}:/ptests -t parallel-container \
LOAD_CONT=$(docker run -d --privileged -v ${PWD}:/ptests -t parallel-container \
bash run_hackbench.sh)

# Run cyclictest
echo "Running cyclictest in docker container..."
RESULT=$(docker run --privileged --network=host \
-v ${LOG_DIR}:${LOG_DIR} -v ${PTEST_LOCATION}:/ptests -v /home/admin:/home/admin \
-v ${LOG_DIR}:${LOG_DIR} -v ${PWD}:/ptests -v /home/admin:/home/admin \
-v /usr/share/fw_printenv:/usr/share/fw_printenv -v /sbin/fw_printenv:/sbin/fw_printenv \
-v /usr/share/nisysinfo:/usr/share/nisysinfo -v /dev:/dev \
-t cyclictest-container \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
#!/bin/bash

PTEST_LOCATION=/usr/lib/kernel-containerized-performance-tests/ptest
LOG_DIR="/var/local/ptest-results/kernel-containerized-performance-tests"

# Build the two containers
if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then
echo "Building cyclictest-container..."
DOCKER_BUILDKIT=1 \
docker build -t cyclictest-container --network=host ${PTEST_LOCATION}/cyclictest-container
if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then
echo "Failed to build cyclictest-container"
exit 77
fi
fi

# Run cyclictest
echo "Running cyclictest in docker container..."
RESULT=$(docker run --privileged --network=host \
-v ${LOG_DIR}:${LOG_DIR} -v ${PTEST_LOCATION}:/ptests -v /home/admin:/home/admin \
-v ${LOG_DIR}:${LOG_DIR} -v ${PWD}:/ptests -v /home/admin:/home/admin \
-v /usr/share/fw_printenv:/usr/share/fw_printenv -v /sbin/fw_printenv:/sbin/fw_printenv \
-v /usr/share/nisysinfo:/usr/share/nisysinfo -v /dev:/dev \
-t cyclictest-container \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

PTEST_LOCATION=/usr/lib/kernel-containerized-performance-tests/ptest

source /home/admin/.iperf.info
if [ -z "$IPERF_SERVER" ]; then
echo "Warning: iperf server not configured; skipping iperf based network load test."
Expand All @@ -18,36 +16,16 @@ if [ ! -z "$IPERF_PORT" ]; then
fi
fi

# Build the two containers
if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then
echo "Building cyclictest-container..."
DOCKER_BUILDKIT=1 \
docker build -t cyclictest-container --network=host ${PTEST_LOCATION}/cyclictest-container
if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then
echo "Failed to build cyclictest-container"
exit 77
fi
fi
if [ "$(docker images -q parallel-container:latest)" = "" ]; then
echo "Building parallel-container..."
DOCKER_BUILDKIT=1 \
docker build -t parallel-container --network=host ${PTEST_LOCATION}/parallel-container
if [ "$(docker images -q parallel-container:latest)" = "" ]; then
echo "Failed to build parallel-container"
exit 77
fi
fi

# Start background network load
echo "Starting iperf load..."
LOAD_CONT=$(docker run -d --privileged \
-v ${PTEST_LOCATION}:/ptests -v /home/admin:/home/admin --network=host \
-v ${PWD}:/ptests -v /home/admin:/home/admin --network=host \
-t parallel-container bash run_iperf.sh)

# Run cyclictest
echo "Running cyclictest in docker container..."
RESULT=$(docker run --privileged --network=host \
-v ${LOG_DIR}:${LOG_DIR} -v ${PTEST_LOCATION}:/ptests -v /home/admin:/home/admin \
-v ${LOG_DIR}:${LOG_DIR} -v ${PWD}:/ptests -v /home/admin:/home/admin \
-v /usr/share/fw_printenv:/usr/share/fw_printenv -v /sbin/fw_printenv:/sbin/fw_printenv \
-v /usr/share/nisysinfo:/usr/share/nisysinfo -v /dev:/dev \
-t cyclictest-container \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RDEPENDS:${PN}-ptest:append:armv7a = " u-boot-fw-utils"
ALLOW_EMPTY:${PN} = "1"

SRC_URI += "\
file://build-containers \
file://run-ptest \
file://run-cyclictest \
file://upload_cyclictest_results.py \
Expand All @@ -36,6 +37,7 @@ SRC_URI += "\
"

do_install_ptest:append() {
install -m 0755 ${S}/build-containers ${D}${PTEST_PATH}
install -m 0755 ${S}/run-ptest ${D}${PTEST_PATH}
install -m 0755 ${S}/run-cyclictest ${D}${PTEST_PATH}
install -m 0755 ${S}/upload_cyclictest_results.py ${D}${PTEST_PATH}
Expand Down

0 comments on commit 16be6c6

Please sign in to comment.