summaryrefslogtreecommitdiffstats
path: root/WebKitTools/BuildSlaveSupport/gtk/crashmon
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/BuildSlaveSupport/gtk/crashmon')
-rwxr-xr-xWebKitTools/BuildSlaveSupport/gtk/crashmon/crashmon73
-rwxr-xr-xWebKitTools/BuildSlaveSupport/gtk/crashmon/log/run38
-rwxr-xr-xWebKitTools/BuildSlaveSupport/gtk/crashmon/run74
3 files changed, 185 insertions, 0 deletions
diff --git a/WebKitTools/BuildSlaveSupport/gtk/crashmon/crashmon b/WebKitTools/BuildSlaveSupport/gtk/crashmon/crashmon
new file mode 100755
index 0000000..41705a2
--- /dev/null
+++ b/WebKitTools/BuildSlaveSupport/gtk/crashmon/crashmon
@@ -0,0 +1,73 @@
+#! /bin/bash
+#
+# Copyright (C) 2010 Carlos Lopez <clopez@igalia.com>, Igalia S.L.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+set -e
+
+[ "${coredir}" ] || {
+ echo "Env var '\${coredir}' not defined!" >&2
+ exit 111
+}
+[ "${programpath}" ] || {
+ echo "Env var '\${programpath}' not defined" >&2
+ exit 111
+}
+[ "${arch}" ] || {
+ echo "Env var '\${arch}' not defined" >&2
+ exit 111
+}
+[ "${mailto}" ] || {
+ echo "Env var '\${mailto}' not defined" >&2
+ exit 111
+}
+
+
+inotifywait -q -m --format '%f' --exclude '.trace.html$' -e close_write "${coredir}" | \
+while read -r coredump
+do
+ if grep -qE '^core-when_[[:digit:]]{10\,12}-_-who_[[:print:]]+-_-why_' <<< "${coredump}"
+ then
+ # Get revision number from Subversion sources
+ rev=$(cd "${crashmon_src_path}" && svn info | sed -e '/^Revision:/s/Revision: //p' -e d)
+
+ # Get the who from the coredump name
+ programfile=$(echo "${coredump}" \
+ | awk -F'-_-who_' '{ print $2 }'\
+ | awk -F'-_-why_' '{ print $1 }')
+
+ # Sometimes programfile gets cut when it is a long name:
+ # Search using wildcards
+ fullprogrampath=$(find "${programpath}" -executable -name "${programfile}"\* | head -n1)
+
+ ( printf "<html><head><title>StackTrace for ${programfile} from svn"
+ printf " rev ${rev}</title></head>\n<body>Core dump file: "
+ printf "<a href=\"cores/${coredump}\">${coredump}</a><br/>\n"
+ printf "<pre>Executable crashed: ${fullprogrampath}</pre>\n"
+ printf "<br/><hr><b>Stack Trace:</b><hr><br/>\n<pre>"
+
+ gdb -ex "thread apply all bt" --batch "${fullprogrampath}" "${coredump}" 2>&1 \
+ | sed -e 's/\&/\&amp/g;s/</\&lt;/g;s/>/\&gt;/g;s/\"/\&quot;/g' -e "s/'/\&\#039;/g"
+
+ printf "</pre></body></html>\n"
+ ) > "/var/www/svn_${rev}.${coredump}.trace.html"
+
+ # Make sure the web server can read it
+ chmod 644 "${coredump}"
+ fi
+done
+
diff --git a/WebKitTools/BuildSlaveSupport/gtk/crashmon/log/run b/WebKitTools/BuildSlaveSupport/gtk/crashmon/log/run
new file mode 100755
index 0000000..4dcd71f
--- /dev/null
+++ b/WebKitTools/BuildSlaveSupport/gtk/crashmon/log/run
@@ -0,0 +1,38 @@
+#! /bin/bash
+#
+# Copyright (C) 2010 Igalia S.L. All rights reserved.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+: ${BUILDBOT_CONFIG:=/etc/daemontools-buildbot.conf}
+
+# Read configuration file
+[ -r "${BUILDBOT_CONFIG}" ] && . "${BUILDBOT_CONFIG}"
+
+: ${buildbot_user:=${HOME}}
+: ${crashmon_log_path:=/var/log/crashmon}
+
+# Expand all "env_*" environment variables
+for varname in ${!env_*} ; do
+ eval "export ${varname#env_}=\${${varname}}"
+done
+
+mkdir -p "${crashmon_log_path}"
+chown "${buildbot_user}" "${crashmon_log_path}"
+
+exec /usr/bin/setuidgid "${buildbot_user}" \
+ /usr/bin/multilog t "${crashmon_log_path}"
+
diff --git a/WebKitTools/BuildSlaveSupport/gtk/crashmon/run b/WebKitTools/BuildSlaveSupport/gtk/crashmon/run
new file mode 100755
index 0000000..38be3fe
--- /dev/null
+++ b/WebKitTools/BuildSlaveSupport/gtk/crashmon/run
@@ -0,0 +1,74 @@
+#! /bin/bash
+#
+# Copyright (C) 2010 Igalia S.L. All rights reserved.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+exec 2>&1
+
+: ${BUILDBOT_CONFIG:=/etc/daemontools-buildbot.conf}
+
+# Read configuration file
+[ -r "${BUILDBOT_CONFIG}" ] && . "${BUILDBOT_CONFIG}"
+
+: ${buildbot_user:=${USER:-${LOGNAME}}}
+: ${crashmon_output:=''}
+
+# Expand all "env_*" environment variables
+for varname in ${!env_*} ; do
+ eval "export ${varname#env_}=\${${varname}}"
+done
+
+
+if [ ! -d "${crashmon_output}" ]
+then
+ if ! [ "${crashmon_output}" ]
+ then
+ echo "Dump directory '${crashmon_output}' does not exist (sleeping)"
+ fi
+ sleep $(( 60 * 60 * 4 ))
+ exit 111
+fi
+
+
+if ! [ "${buildbot_bits}" ]
+then
+ # Guess bits (32/64) from uname -m
+ machine=$(uname -m)
+ case ${machine} in
+ x86_64 | amd64 | ia64 | ppc64)
+ buildbot_bits="64" ;;
+ *)
+ buildbot_bits="32" ;;
+ esac
+fi
+
+: ${crashmon_bin_path:="${buildbot_path}/gtk-linux-${buildbot_bits}-debug/build/WebKitBuild/Debug/Programs"}
+
+
+cd "${crashmon_output}"
+exec /usr/bin/env - \
+ PATH="${PATH}" \
+ SHELL="/bin/bash" \
+ USER="${buildbot_user}" \
+ arch="${buildbot_bits}" \
+ LOGNAME="${buildbot_user}" \
+ coredir="${crashmon_output}" \
+ HOME="/home/${buildbot_user}" \
+ mailto="${crashmon_mailto:-''}" \
+ programpath="${crashmon_bin_path}" \
+ /usr/bin/setuidgid "${buildbot_user}" "$(pwd)/crashmon"
+