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

resources/VM-container-tests: Extract core dumps #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 20 additions & 2 deletions resources/VM-container-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ force_stop_vm() {
if echo "quit" | socat - ./${PROCESS_NAME}.qemumon;then
echo "Sucessfully requested VM to exit cleanly"
else
echo "Failed to request clean VM exit"
echo "Failed to request clean VM exit, sending SIGKILL"
pgrep ${PROCESS_NAME} | xargs kill -SIGKILL
fi

rm -f ${PROCESS_NAME}.vm_key
Expand All @@ -39,9 +40,15 @@ fetch_logs() {
skip=$(/sbin/fdisk -lu ${PROCESS_NAME}.img | tail -n1 | awk '{print $2}')
sectors=$(/sbin/fdisk -lu ${PROCESS_NAME}.img | tail -n1 | awk '{print $3}')
dd if=${PROCESS_NAME}.img of=${PROCESS_NAME}.data bs=512 skip=${skip} count=${sectors}

for i in `e2ls ${PROCESS_NAME}.data:/userdata/logs`; do
e2cp ${PROCESS_NAME}.data:/userdata/logs/${i} ${LOG_DIR}/
done

for i in `e2ls ${PROCESS_NAME}.data:/userdata/core`; do
e2cp ${PROCESS_NAME}.data:/userdata/core/${i} ${LOG_DIR}/
done

echo "Retrieved CML logs: $(ls -al ${LOG_DIR})"
fi
}
Expand All @@ -51,6 +58,14 @@ err_fetch_logs() {

trap - EXIT INT TERM

# Attempt to retrieve c0 coredumps
if [ -z "${LOG_DIR}" ];then
echo "-l / --log-dir not specified, skipping c0 core dump retrieval"
else
echo "Attempting to fetch core dumps from c0"
scp -v $SCP_OPTS '[email protected]:/data/core/*' "${LOG_DIR}"
fi

force_stop_vm

fetch_logs
Expand Down Expand Up @@ -590,6 +605,9 @@ do_test_complete() {
echo "STATUS: Test if cmld is up and running"
cmd_control_list

echo "$(ps aux | tail -n1 | awk '{print $2}')"
ssh ${SSH_OPTS} 'kill -6 $(ps aux | tail -n1 | awk "{print $2}")'

if [ "n" = "$USBTOKEN" ];then
# Skip these tests for physical schsm
cmd_control_change_pin_error "${CONTAINER}" "wrongpin" "$TESTPW"
Expand Down Expand Up @@ -919,7 +937,7 @@ fi
# Check if the branch matches the built one
if [[ $BRANCH != "" ]]
then
# Check if cmld was build
# Check if cmld was built
if [ -z $(ls -d tmp/work/core*/cmld/git*/git) ]
then
echo "ERROR: No cmld build found: did you compile?"
Expand Down