Skip to content
Snippets Groups Projects
Commit 32a3cb52 authored by Dragoș-Iulian ARGINT's avatar Dragoș-Iulian ARGINT
Browse files

Add daemon for logging dmesg output


	* Add so2_vm_checker_logger.sh daemon which periodically saves the output of dmesg
	* Add the initialization in checker.sh for assginment 2

Signed-off-by: default avatarDragoș-Iulian ARGINT <dragosargint21@gmail.com>
parent 1103af84
No related branches found
No related tags found
No related merge requests found
Pipeline #61784 passed
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
SO2_WORKSPACE=/linux/tools/labs SO2_WORKSPACE=/linux/tools/labs
SO2_VM_LOG=/tmp/so2_vm_log.txt SO2_VM_LOG=/tmp/so2_vm_log.txt
DMESG_LOG=""
ASSIGNMENT0_TIMEOUT=300 # 5 min ASSIGNMENT0_TIMEOUT=300 # 5 min
ASSIGNMENT0_MOD=list.ko ASSIGNMENT0_MOD=list.ko
...@@ -60,6 +60,13 @@ usage() ...@@ -60,6 +60,13 @@ usage()
} }
configure_logger()
{
DMESG_LOG="/linux/tools/labs/skels/log.txt"
cp ./checker/checker_daemons/so2_vm_checker_logger.sh /linux/tools/labs/rootfs/etc/init.d
chmod +x /linux/tools/labs/rootfs/etc/init.d/so2_vm_checker_logger.sh
chroot /linux/tools/labs/rootfs update-rc.d so2_vm_checker_logger.sh defaults 0 0
}
recover_grade_from_timeout() recover_grade_from_timeout()
{ {
...@@ -83,10 +90,12 @@ timeout_exceeded() ...@@ -83,10 +90,12 @@ timeout_exceeded()
pkill -SIGKILL qemu pkill -SIGKILL qemu
echo "" echo ""
echo "TIMEOUT EXCEEDED !!! killing the process" echo "TIMEOUT EXCEEDED !!! killing the process"
echo "dumping SO2_VM_LOG=${SO2_VM_LOG} output" if [[ $DMESG_LOG != "" ]]; then
echo "------------------------------------------------------" echo "dumping DMESG_LOG=${DMESG_LOG} output"
cat $SO2_VM_LOG echo ">>>>---------------DMESG_LOG_STARTS_HERE------------------<<<<<"
echo "------------------------------------------------------" cat $DMESG_LOG
echo ">>>>----------------DMESG_LOG_ENDS_HERE-------------------<<<<<"
fi
if [[ $RECOVER_GRADE_TIMEOUT == 0 ]]; then if [[ $RECOVER_GRADE_TIMEOUT == 0 ]]; then
if [ -f $output ]; then if [ -f $output ]; then
...@@ -94,8 +103,6 @@ timeout_exceeded() ...@@ -94,8 +103,6 @@ timeout_exceeded()
else else
cat $output cat $output
fi fi
echo "dumping SO2_VM_LOG=${SO2_VM_LOG} output"
cat $SO2_VM_LOG
echo "The Recover Grade Timeout option is not set! Please contact a teaching assistant!" echo "The Recover Grade Timeout option is not set! Please contact a teaching assistant!"
else else
...@@ -223,7 +230,7 @@ run_checker() ...@@ -223,7 +230,7 @@ run_checker()
if ((timeout >= TIMEOUT)); then if ((timeout >= TIMEOUT)); then
if [ -f $output ]; then if [ -f $output ]; then
echo "" echo ""
dump_output $output dump_output $output $timeout
compute_total $output compute_total $output
fi fi
timeout_exceeded $output timeout_exceeded $output
...@@ -238,6 +245,8 @@ run_checker() ...@@ -238,6 +245,8 @@ run_checker()
popd &> /dev/null popd &> /dev/null
} }
case $1 in case $1 in
0-list) 0-list)
TIMEOUT=$ASSIGNMENT0_TIMEOUT TIMEOUT=$ASSIGNMENT0_TIMEOUT
...@@ -252,6 +261,7 @@ case $1 in ...@@ -252,6 +261,7 @@ case $1 in
2-uart) 2-uart)
TIMEOUT=$ASSIGNMENT2_TIMEOUT TIMEOUT=$ASSIGNMENT2_TIMEOUT
RECOVER_GRADE_TIMEOUT=1 # If set to 1, in case of a timeout, will calculate the total grade based on the output directory RECOVER_GRADE_TIMEOUT=1 # If set to 1, in case of a timeout, will calculate the total grade based on the output directory
configure_logger
run_checker $ASSIGNMENT2_MOD $ASSIGNMENT2_DIR $ASSIGNMENT2_CHECKER_LOCAL_DIR $ASSIGNMENT2_CHECKER_DIR $ASSIGNMENT2_OUTPUT $ASSIGNMENT2_FINISHED $1 $ASSIGNMENT2_HEADER_OVERWRITE $ASSIGNMENT2_CHECKER_AUX_LIST run_checker $ASSIGNMENT2_MOD $ASSIGNMENT2_DIR $ASSIGNMENT2_CHECKER_LOCAL_DIR $ASSIGNMENT2_CHECKER_DIR $ASSIGNMENT2_OUTPUT $ASSIGNMENT2_FINISHED $1 $ASSIGNMENT2_HEADER_OVERWRITE $ASSIGNMENT2_CHECKER_AUX_LIST
;; ;;
3-raid) 3-raid)
......
#!/bin/sh
# THIS SCRIPT RUNS INSIDE THE SO2 VM
LOG_FILE=/home/root/skels/log.txt
start()
{
set -x
echo "" > ${LOG_FILE}
while true
do
sleep 1
echo ------------------START_HERE------------------ >> $LOG_FILE
dmesg >> $LOG_FILE
echo -------------------END_HERE------------------- >> $LOG_FILE
done
}
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting so2_vm_checker_logger.sh..."
start & # start in background
;;
*)
echo "Usage: /etc/init.d/foo {start|stop}"
exit 1
;;
esac
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment