Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This page shows how to run automated tests while PBS is running under memory diagnostics tools like valgrind, electric fence or purify

However this page mostly focus on valgrind only but this step can used to run any diagnostics tools such as code coverage tools etc...

Step-by-step guide

Compile Python with valgrind support

  1. Install valgrind devel package
    1. Command: yum install valgrind-devel
  2. Compile python from source as follow
    1. ./configure --prefix=<python_install_dir> --without-pymalloc --with-pydebug --with-valgrind

    2. make

    3. make install

Compile PBS with above python and in partial debug mode

  1. ./configure --prefix=<installdir> --with-python=<python_install_dir> CFLAGS="-g -O0 -DPy_DEBUG -Wall -Werror"
    1. NOTE: Do not add '-DDEBUG' option in CFLAGS because it will start all PBS daemons in foreground mode which will hang PBS init script forever

Change in pbs_init.d script

NOTE: This step applies only if you are using PBS code before https://github.com/PBSPro/pbspro/commit/d46352b21eb76c38a21849b987b0b9dd719a839a commit

Replace below lines in check_started() as shown

# strip out everything except executable name
  prog_name=`echo ${ps_out} | awk '{print $1}' | \
       awk -F/ '{print $NF}' | awk '{print $1}'`
  if [ "${prog_name}" = $2 ] ; then

with

# strip out everything except executable name
  prog_name=`echo ${ps_out} | grep -how "$2"`
  if [ "x${prog_name}" = "x$2" ] ; then


Generate diagnostics tool wrapper script for binaries

#!/bin/bash
 
PBS_CONF_FILE=${PBS_CONF_FILE:-/etc/pbs.conf}
 
. "${PBS_CONF_FILE}"
 
${PBS_EXEC}/libexec/pbs_init.d stop
 
mv "${PBS_EXEC}/sbin/pbs_server.bin" "${PBS_EXEC}/sbin/pbs_server.bin.vgld"
cat >"${PBS_EXEC}/sbin/pbs_server.bin"<<-EOF
#!/bin/bash
 
exec valgrind --suppressions=<path to valgrind.supp file> --tool=memcheck --leak-check=full --track-origins=yes --log-file=<path to location where you want to store logs>/server_\$(date "+%s").log --vgdb=no "${PBS_EXEC}/sbin/pbs_server.bin.vgld" \${1+"\$@"}
EOF
chmod 0755 "${PBS_EXEC}/sbin/pbs_server.bin"
 
mv "${PBS_EXEC}/sbin/pbs_mom" "${PBS_EXEC}/sbin/pbs_mom.vgld"
cat >"${PBS_EXEC}/sbin/pbs_mom"<<-EOF
#!/bin/bash
 
exec valgrind --suppressions=<path to valgrind.supp file> --tool=memcheck --leak-check=full --track-origins=yes --log-file=<path to location where you want to store logs>/mom_\$(date "+%s").log --vgdb=no "${PBS_EXEC}/sbin/pbs_mom.vgld" \${1+"\$@"}
EOF
chmod 0755 "${PBS_EXEC}/sbin/pbs_mom"
 
mv "${PBS_EXEC}/sbin/pbs_comm" "${PBS_EXEC}/sbin/pbs_comm.vgld"
cat >"${PBS_EXEC}/sbin/pbs_comm"<<-EOF
#!/bin/bash
 
exec valgrind --suppressions=<path to valgrind.supp file> --tool=memcheck --leak-check=full --track-origins=yes --log-file=<path to location where you want to store logs>/comm_\$(date "+%s").log --vgdb=no "${PBS_EXEC}/sbin/pbs_comm.vgld" \${1+"\$@"}
EOF
 
chmod 0755 "${PBS_EXEC}/sbin/pbs_comm"
 
mv "${PBS_EXEC}/sbin/pbs_sched" "${PBS_EXEC}/sbin/pbs_sched.vgld"
cat >"${PBS_EXEC}/sbin/pbs_sched"<<-EOF
#!/bin/bash
 
exec valgrind --suppressions=<path to valgrind.supp file> --tool=memcheck --leak-check=full --track-origins=yes --log-file=<path to location where you want to store logs>/sched_\$(date "+%s").log --vgdb=no "${PBS_EXEC}/sbin/pbs_sched.vgld" \${1+"\$@"}
EOF
 
chmod 0755 "${PBS_EXEC}/sbin/pbs_sched"
 
${PBS_EXEC}/libexec/pbs_init.d start


NOTE: Above script only generates wrapper script for all PBS daemons only, but you can modify above script for any binaries which you want to run under diagnostics tool with any options


Now run your automated test.

  • No labels